ZigBee interrupts in Waspmote PRO v1.2

Wireless communications in Waspmote, topologies, node types...
Post Reply
dwtpdOn
Posts: 4
Joined: Fri Oct 06, 2017 10:51 am
Company: Universidad Zaragoza

ZigBee interrupts in Waspmote PRO v1.2

Post by dwtpdOn » Fri Dec 22, 2017 1:10 pm

Hello,

I'm using a Gateway with XBee Pro S2 ZigBee radio module as a coordinator and a Waspmote board with a XBee Pro S2 ZigBee as a router. Both radio modules are in API mode and using the same PAN ID and same channel.

The Waspmote is v1.2 and I have read that it´s possible to implement ZigBee interrupts on socket0.

Following the steps of the Interruptions Programming Guide, I have programmed a simple application to check it. In this code, I active the XBee module and I enable its interrupts. After that, I put Waspmote in sleep mode leaving on only socket0.

I send broadcast packets from the Coordinator to the Waspmote (configured as a router). However, nothing happens on the Waspmote.

So that, I wonder: what am I doing wrong? Can I actually implement XBee interrupts on waspmote v1.2 in this way?

Thanks in advance!

Here it´s the code:

#include <WaspXBeeZB.h>

// define variable
uint8_t error;


void setup()
{
// init USB port
USB.ON();
USB.println(F("Receiving BROADCAST packets example"));

//////////////////////////
// 1. init XBee
//////////////////////////
xbeeZB.ON();
enableInterrupts(XBEE_INT);

delay(3000);

//////////////////////////
// 2. check XBee's network parameters
//////////////////////////
checkNetworkParams();
}



void loop()
{
USB.println("Enter sleep");

//Leave socket0 ON
PWR.sleep(SENS_OFF);
USB.ON();
USB.println("Wake up");

xbeeZB.ON();


if( intFlag & XBEE_INT )
{
error = xbeeZB.receivePacketTimeout( 10000 );

// check answer
if( error == 0 )
{
// Show data stored in '_payload' buffer indicated by '_length'
USB.print(F("Data: "));
USB.println( xbeeZB._payload, xbeeZB._length);

// Show data stored in '_payload' buffer indicated by '_length'
USB.print(F("Length: "));
USB.println( xbeeZB._length,DEC);

// Show data stored in '_payload' buffer indicated by '_length'
USB.print(F("Source MAC Address: "));
USB.printHex( xbeeZB._srcMAC[0] );
USB.printHex( xbeeZB._srcMAC[1] );
USB.printHex( xbeeZB._srcMAC[2] );
USB.printHex( xbeeZB._srcMAC[3] );
USB.printHex( xbeeZB._srcMAC[4] );
USB.printHex( xbeeZB._srcMAC[5] );
USB.printHex( xbeeZB._srcMAC[6] );
USB.printHex( xbeeZB._srcMAC[7] );
USB.println();
USB.println(F("--------------------------------"));
}
else
{
// Print error message:
/*
* '7' : Buffer full. Not enough memory space
* '6' : Error escaping character within payload bytes
* '5' : Error escaping character in checksum byte
* '4' : Checksum is not correct
* '3' : Checksum byte is not available
* '2' : Frame Type is not valid
* '1' : Timeout when receiving answer
*/
USB.print(F("Error receiving a packet:"));
USB.println(error,DEC);
USB.println(F("--------------------------------"));
}
}

}


/*******************************************
*
* checkNetworkParams - Check operating
* network parameters in the XBee module
*
*******************************************/
void checkNetworkParams()
{
// 1. get operating 64-b PAN ID
xbeeZB.getOperating64PAN();

// 2. wait for association indication
xbeeZB.getAssociationIndication();

while( xbeeZB.associationIndication != 0 )
{
delay(2000);

// get operating 64-b PAN ID
xbeeZB.getOperating64PAN();

USB.print(F("operating 64-b PAN ID: "));
USB.printHex(xbeeZB.operating64PAN[0]);
USB.printHex(xbeeZB.operating64PAN[1]);
USB.printHex(xbeeZB.operating64PAN[2]);
USB.printHex(xbeeZB.operating64PAN[3]);
USB.printHex(xbeeZB.operating64PAN[4]);
USB.printHex(xbeeZB.operating64PAN[5]);
USB.printHex(xbeeZB.operating64PAN[6]);
USB.printHex(xbeeZB.operating64PAN[7]);
USB.println();

xbeeZB.getAssociationIndication();
}

USB.println(F("\nJoined a network!"));

// 3. get network parameters
xbeeZB.getOperating16PAN();
xbeeZB.getOperating64PAN();
xbeeZB.getChannel();

USB.print(F("operating 16-b PAN ID: "));
USB.printHex(xbeeZB.operating16PAN[0]);
USB.printHex(xbeeZB.operating16PAN[1]);
USB.println();

USB.print(F("operating 64-b PAN ID: "));
USB.printHex(xbeeZB.operating64PAN[0]);
USB.printHex(xbeeZB.operating64PAN[1]);
USB.printHex(xbeeZB.operating64PAN[2]);
USB.printHex(xbeeZB.operating64PAN[3]);
USB.printHex(xbeeZB.operating64PAN[4]);
USB.printHex(xbeeZB.operating64PAN[5]);
USB.printHex(xbeeZB.operating64PAN[6]);
USB.printHex(xbeeZB.operating64PAN[7]);
USB.println();

USB.print(F("channel: "));
USB.printHex(xbeeZB.channel);
USB.println();

}

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: ZigBee interrupts in Waspmote PRO v1.2

Post by libelium-dev » Tue Dec 26, 2017 10:55 am

Hi,

We are sorry but the xbee interruption was developed for digimesh modules. On the other hand, the xbee interruptions don't work as you expect, it isn't possible to wake Waspmote when a package is received by the xbee module.

A coordinator digimesh module manage the cycle sleep mode. There is an interruption in the router modules that awaken Waspmote in each cycle. Just the coordinator can change the times of the cycle mode. Here you can find more information about cycle mode and interruption but it isn't possible for zigbee modules
http://www.libelium.com/downloads/docum ... df#page=23
http://www.libelium.com/v12/development ... leep-mode/

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest