Post a new topicPost a reply Page 2 of 3   [ 22 posts ]
Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: Waspmote Gateway
PostPosted: Mon Mar 22, 2010 1:05 pm 

Joined: Mon Mar 22, 2010 12:28 pm
Posts: 10
Hi All

I'm having the same problem/query. I want to communicate between a Waspmote and a USB gateway (using very similar code to javlig).
  • I've set up and confirmed the Gateway's Xbee as an AT coordinator (firmware 2021) with a baud of 38400
  • I've set up and confirmed the Mote's Xbee as an API Router (firmware 2321) with a baud of 38400 and escape characters enabled for the API mode(using the ATAP2)

When I check, the coordinator has chosen a PANID and a channel. The Mote reports that it has not chosen a channel (i.e. xbee.channel returns 0 even after calling xbee.getChannel() ). If I try the create network example, I get an error message about setting a channel (although is this about setting the channels which the device scans?).

If I do a Node Discover on the gateway Xbee, I find that I can see the other Xbee. Even more interesting is that if I swap the Xbees (i.e. put the coordinator into the waspmote and the router into the gateway), data comes through fine from the mote to the gateway (although it obviously has lots of rubbish in it, because the library on the waspmote is obviously writing using the API command form to a transparent Xbee). This makes me suspect that the issue is with the xbee802 library on the waspmote - is there any jumper or setting that needs to be configured to get it work correctly?

Thanks,
Cheers,
Gordon


Top
 Profile  
 
 Post subject: Re: Waspmote Gateway
PostPosted: Mon Mar 22, 2010 1:54 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
Hi Gordon,

Are you using 'XBee ZigBee' libraries? There are different libraries depending on the XBee you are using. If you are using 'XBee 802.15.4', you must use 'xbee802' library and if you are using 'XBee ZigBee', you must use 'xbeeZB' library.

Once you have checked that point, we can go on discovering your problem.

Regards


Top
 Profile  
 
 Post subject: Re: Waspmote Gateway
PostPosted: Mon Mar 22, 2010 2:58 pm 

Joined: Mon Mar 22, 2010 12:28 pm
Posts: 10
Hi

Thanks for the prompt reply!

I'm using the Xbee Series 2 - there seems to be some confusion on the Digi website, as the product name has changed. Are there further submodels? I'm using the xbee802 library in my code. Should I try the Zigbee library instead?

I'm not too fussy about using either 802.15.4 or Zigbee, although Zigbee would suit me for later applications.

Cheers,
Gordon


Top
 Profile  
 
 Post subject: Re: Waspmote Gateway
PostPosted: Mon Mar 22, 2010 3:06 pm 

Joined: Mon Mar 22, 2010 12:28 pm
Posts: 10
Hi

OK, so I changed to the xbeeZB library, and its working now :)

So do the different waspmote libraries essentially map to different Xbee devices or firmware versions? For example if I rather wanted to use 802.15.4 instead of Zigbee, could I do that with the Xbee Series 2 devices?

Thanks,
Cheers,
Gordon


Top
 Profile  
 
 Post subject: Re: Waspmote Gateway
PostPosted: Mon Mar 22, 2010 3:08 pm 

Joined: Tue Mar 16, 2010 5:47 pm
Posts: 19
Hi again,

I configured the devices like that:

1. Gateway like COODINATOR API, PANID=15, SCAN CHANNELS=FF, BAUD=5(38400) and API ENABLE (2).

2. Waspmote like ROUTER API with the next code:

Code:
 
  uint8_t PANID[1]={0x15};
  xbeeZB.setPAN(PANID);
  if(!xbeeZB.error_AT){
    XBee.println("PANID was changed");
  }
  else{XBee.println("Error PANID");}
 
  xbeeZB.setScanningChannels(0x0B,0xFF);// list of channels to scan
  xbeeZB.setDurationEnergyChannels(2);// get energy on each channel
  /* energyChannel[0-15] contains each channel energy */
  /* order the array elements */

  while(xbeeZB.totalScannedBrothers==0)
  {
    xbeeZB.setChannel(0x0B); // It is supposed it is the maximum energy channel
    XBee.println("Set Channel finished");
    xbeeZB.scanNetwork();
     XBee.println("ScanNetwork finished");
    // perform a Node Discovery on each channel until
    //response
  }
  /* when exiting the loop, that will be the correct channel*/
 
  xbeeZB.getAssociationIndication();
  if(!xbeeZB.associationIndication){
      Utils.setLED(LED0,LED_ON);   
  }
  else if(xbeeZB.associationIndication==0xAB){
      Utils.setLED(LED1,LED_ON);   
  }
  else{
          Utils.setLED(LED0,LED_ON);   
          Utils.setLED(LED1,LED_ON);   
  }


The problem is that the while loop never ends. The hyperterminal responses is:

Code:
Set Channel acabado
~RNDScanNetwork acabado
Set Channel acabado
~RNDScanNetwork acabado
Set Channel acabado
~RNDScanNetwork acabado


What is wrong?


Top
 Profile  
 
 Post subject: Re: Waspmote Gateway
PostPosted: Mon Mar 22, 2010 3:17 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
Gordon wrote:
Hi

OK, so I changed to the xbeeZB library, and its working now :)

So do the different waspmote libraries essentially map to different Xbee devices or firmware versions? For example if I rather wanted to use 802.15.4 instead of Zigbee, could I do that with the Xbee Series 2 devices?

Thanks,
Cheers,
Gordon


Yes, each library maps to a different kind of XBee. You can't use 'xbee802' library with XBee Series 2 devices because these devices have different hardware and protocol.

Regards


Top
 Profile  
 
 Post subject: Re: Waspmote Gateway
PostPosted: Mon Mar 22, 2010 3:33 pm 

Joined: Mon Mar 22, 2010 12:28 pm
Posts: 10
Hi javlig

Thanks for creating this thread! It seems to be a slight gap in the Waspmote documentation.

Is there any particular reason you've set the gateway/coordinator to API mode? I find that it makes it difficult to read values from it in that. The waspmote/router must be set to the extended API mode, but as far as I know, the Gateway doesn't have to be.

The problem I seemed to have was that the firmware I had set on my Xbees wasn't matched to the software library I was using. What firmware version i.e. number code have you uploaded to your Xbees?

I've actually used code very similar to your original posting:

Code:
 packetXBee* paq_sent;
 int8_t state=0;
 long previous=0;
 char*  data="Test message!";
 int g=0;
 
void setup()
{
  // Inits the XBee Zigbee library
  xbeeZB.init(ZIGBEE,FREQ2_4G,NORMAL);
 
  // Powers XBee
  xbeeZB.ON();
 
  xbeeZB.setNodeIdentifier("test_node");

}

void loop()
{

  xbeeZB.getChannel();
  XBee.println(xbeeZB.channel,HEX);
 
  paq_sent=(packetXBee*) calloc(1,sizeof(packetXBee));
  paq_sent->mode=UNICAST;
  paq_sent->MY_known=0;
  paq_sent->packetID=0x52;
  paq_sent->opt=0;
  xbeeZB.hops=0;
  //xbeeZB.setOriginParams(paq_sent, "0013A2004030C153", MAC_TYPE);
  xbeeZB.setOriginParams(paq_sent, "node_test", NI_TYPE);
  //xbeeZB.setDestinationParams(paq_sent, "0013A200403A8933", data, MAC_TYPE, DATA_ABSOLUTE);
  xbeeZB.setDestinationParams(paq_sent, "node_gateway", data, NI_TYPE, DATA_ABSOLUTE);
  xbeeZB.sendXBee(paq_sent);
  if( xbeeZB.error_TX )
  {
    XBee.print("Error");
    XBee.println(xbeeZB.error_TX);
  }
  free(paq_sent);
  paq_sent=NULL;

  Utils.blinkLEDs(500);
  delay(500);
}


I obviously set my gateway to have a node identifier of "test_gateway" when using that addressing mode. As far as I can tell, the default networking settings should work for this simple example (i.e. the router should choose the only available PAN, the one created by the Coordinator, and the same with the channel scanning procedure). What happens when you try this simple code?

Cheers,
Gordon


Top
 Profile  
 
 Post subject: Re: Waspmote Gateway
PostPosted: Mon Mar 22, 2010 3:40 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
Hi javilg,

ZigBee networks are quite complicated to understand on first contacts, so I recommend you to go step by step.

First of all, check that both nodes connect on the same network. To do this, place the Coordinator on Waspmote gateway and run X-CTU. Write down the channel and PANID selected and place this Coordinator on Waspmote with a program that only powers XBee on and nothing else. After the Coordinator has been powered, place the Router on the gateway and run the X-CTU. Check if the Router has the same parameters you have just wrote down.

I also recommend not to set the PANID different from '0' now, so please restore all the parameters to default but AP and BD (AP=2, BD=5).

If you check that both XBees are on the same network, place the Coordinator on the gateway and the Router on the Waspmote. And now, you can upload one of the examples, for instance, 'WaspXBeeZB_2_sendingReceiving'. Change the MAC addresses and it should work.

Best regards


Top
 Profile  
 
 Post subject: Re: Waspmote Gateway
PostPosted: Mon Mar 22, 2010 5:27 pm 

Joined: Tue Mar 16, 2010 5:47 pm
Posts: 19
Thanks you so much,

I did all you said me and now it works.

javilg


Top
 Profile  
 
 Post subject: Re: Waspmote Gateway
PostPosted: Sat May 08, 2010 11:53 am 

Joined: Sat May 08, 2010 11:49 am
Posts: 26
Location: Bombay
Whats the X-CTU equivalent on linux?

Regards,
RKM


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 2 of 3   [ 22 posts ]
Go to page Previous  1, 2, 3  Next


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use