Post a new topicPost a reply Page 2 of 3   [ 27 posts ]
Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: Sending Receiving ZigBee
PostPosted: Mon Oct 04, 2010 10:59 am 

Joined: Fri May 28, 2010 12:11 pm
Posts: 23
libelium-dev wrote:
Your 2nd router is in other channel so it is not in the same network.

Modify the parameter JV and set to 1. Then, unplug the 2 routers and plug them again with the Coordinator disconnected. Wait a few seconds till you read with the X-CTU the parameters and see the channel and PANID are empty. Once those parameters are empty in both routers, then connect the Coordinator and wait for them to connect to the network.
Regards


Now both routers have JV set to 1.

When you say: "Once those parameters are empty in both routers".
Dou you refer at Operating channel and Operating PANID? If it is, then are and empty in both routers.

"then connect the Coordinator and wait for them to connect to the network"

How much time I have to wait?


Can you make a little guide of how connect this 2 routers and 1 coordinator?
I'm Spanish, can I talk on Spanish in another forum, or maybe in a private conversation?

Thanks


Top
 Profile  
 
 Post subject: Re: Sending Receiving ZigBee
PostPosted: Mon Oct 04, 2010 1:04 pm 

Joined: Fri May 28, 2010 12:11 pm
Posts: 23
Hi again!

When I execute the source from "WaspXBeeZB_2_sending_receiving"
Code:
void loop()
{
  // Set params to send
  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, "5678", MY_TYPE);
  xbeeZB.setDestinationParams(paq_sent, "0013A200406075C3", data, MAC_TYPE,DATA_ABSOLUTE);
  xbeeZB.sendXBee(paq_sent);
  if( !xbeeZB.error_TX )
  {
    XBee.println("ok");
  }
  free(paq_sent);
  paq_sent=NULL;
 
.....


xbeeZB.error_TX is '1' and not '0'

I hope that this help you.

Thanks again.


Top
 Profile  
 
 Post subject: Re: Sending Receiving ZigBee
PostPosted: Wed Oct 13, 2010 2:01 am 

Joined: Fri May 28, 2010 12:11 pm
Posts: 23
Could you help me?

Thanks in advance

Francisco.


Top
 Profile  
 
 Post subject: Re: Sending Receiving ZigBee
PostPosted: Wed Oct 13, 2010 10:04 am 

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

If the variable 'error_TX' is '1' then you don't have the nodes in the same network.

Please, check that the fields 'Operating PANID' and 'channel' are the same in all the nodes because if don't you'll not be able to send any packet among them.

You have to connect the Coordinator and leave it running. Then, you connect the routers and wait some seconds till they join to the network. Once the routers have the same parameters, you can change the 'JV' parameter to '0' and try the examples.

Regards


Top
 Profile  
 
 Post subject: Re: Sending Receiving ZigBee
PostPosted: Wed Oct 13, 2010 5:15 pm 

Joined: Fri Sep 24, 2010 1:19 pm
Posts: 50
I have too the two router zigbee pro in the two waspmotes, and the coordinator zigbee in the gateway, but the two routers always losed theit configuration.

I mean, both of them have the JV parameter at '1', and if I connect one of them to the gateway, it has the right channel (the same as the coordinator), but if I read de modem configuration again the channel changes to '0'.

And when I'm trying the sending/receiveing example, I can't get the correct working mode.
I only watch "Test message!" but nothing more.


Top
 Profile  
 
 Post subject: Re: Sending Receiving ZigBee
PostPosted: Thu Oct 14, 2010 8:12 am 

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

Please create a program that does nothing but powering the XBee and upload to one Waspmote.

Then, plug the Coordinator in this Waspmote. In this way, we'll have the Coordinator powered and the network will be created.

After this, plug one router in the Gateway and wait till it is connected to the Coordinator. Now, change the 'JV' parameter to '0' and check the Router is still connected to the network. Repeat the process with the other router.

Once you have done these 3 steps, you'll have the 3 nodes in the same network and you'll be able to send packets among them.

Regards


Top
 Profile  
 
 Post subject: Re: Sending Receiving ZigBee
PostPosted: Thu Oct 14, 2010 9:25 am 

Joined: Fri Sep 24, 2010 1:19 pm
Posts: 50
Thanks.

I did it but it doesn't work yet.

I study its behavior, and I can say that the router_2 didn't receive any packet.
I mean it never goes into the "XBee.avaliable()" although router_1 sended the packet.

I'll check all again.


Top
 Profile  
 
 Post subject: Re: Sending Receiving ZigBee
PostPosted: Thu Oct 14, 2010 9:47 am 

Joined: Fri Sep 24, 2010 1:19 pm
Posts: 50
I put here my configuration in case somebody can help me.

I have the coordinator in the gateway, and the two routers in each waspmote, both of them after joining the network with previous post instructions, so:

- Send_receive_A:

Code:
packetXBee* paq_sent;
 int8_t state=0;
 long previous=0;
 char*  data="Test message!";
 
void setup()
{
  // Inits the XBee ZigBee library
  xbeeZB.init(ZIGBEE,FREQ2_4G,PRO);
 
  // Powers XBee
  xbeeZB.ON();
 
//  xbeeZB.setAPSencryption(XBEE_ON);
 
  delay(2000);
}

void loop()
{
  // Set params to send
  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, NI_TYPE);
  xbeeZB.setDestinationParams(paq_sent, "Vuvuzela#", data, NI_TYPE,DATA_ABSOLUTE);
  xbeeZB.sendXBee(paq_sent);
  if( !xbeeZB.error_TX )
  {
    XBee.println("ok");
  }
  free(paq_sent);
  paq_sent=NULL;
 
  // Waiting the answer
  previous=millis();
  while( (millis()-previous) < 20000 )
  {
    if( XBee.available() )
    {
      xbeeZB.treatData();
      if( !xbeeZB.error_RX )
      {
        // Writing the parameters of the packet received
        while(xbeeZB.pos>0)
        {
          XBee.print("Network Address Source: ");
          XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->naS[0],HEX);
          XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->naS[1],HEX);
          XBee.println("");
          XBee.print("MAC Address Source: ");         
          for(int b=0;b<4;b++)
          {
            XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->macSH[b],HEX);
          }
          for(int c=0;c<4;c++)
          {
            XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->macSL[c],HEX);
          }
          XBee.println("");
          XBee.print("Network Address Origin: ");         
          XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->naO[0],HEX);
          XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->naO[1],HEX);
          XBee.println("");
          XBee.print("MAC Address Origin: ");         
          for(int d=0;d<4;d++)
          {
            XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->macOH[d],HEX);
          }
          for(int e=0;e<4;e++)
          {
            XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->macOL[e],HEX);
          }
          XBee.println("");
          XBee.print("RSSI: ");                   
          XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->RSSI,HEX);
          XBee.println("");         
          XBee.print("16B(0) or 64B(1): ");                   
          XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->mode,HEX);
          XBee.println("");
          XBee.print("Data: ");                   
          for(int f=0;f<xbeeZB.packet_finished[xbeeZB.pos-1]->data_length;f++)
          {
            XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->data[f],BYTE);
          }
          XBee.println("");
          XBee.print("PacketID: ");                   
          XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->packetID,HEX);
          XBee.println("");     
          XBee.print("Type Source ID: ");                             
          XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->typeSourceID,HEX);
          XBee.println("");     
          XBee.print("Network Identifier Origin: ");         
          for(int g=0;g<4;g++)
          {
            XBee.print(xbeeZB.packet_finished[xbeeZB.pos-1]->niO[g],BYTE);
          }
          XBee.println(""); 
          XBee.print("Source Destination: ");
          XBee.println(xbee.packet_finished[xbee.pos-1]->SD,HEX);
          XBee.print("Destination Endpoint: ");         
          XBee.println(xbee.packet_finished[xbee.pos-1]->DE,HEX);
          XBee.print("Cluster ID: ");         
          XBee.print(xbee.packet_finished[xbee.pos-1]->CID[0],HEX);
          XBee.println(xbee.packet_finished[xbee.pos-1]->CID[1],HEX);
          XBee.print("Profile ID: ");         
          XBee.print(xbee.packet_finished[xbee.pos-1]->PID[0],HEX);
          XBee.println(xbee.packet_finished[xbee.pos-1]->PID[1],HEX);
          free(xbeeZB.packet_finished[xbeeZB.pos-1]);
          xbeeZB.packet_finished[xbeeZB.pos-1]=NULL;
          xbeeZB.pos--;
        }
        previous=millis();
      }
    }
  }
 
  delay(5000);
}


- Send_receive_B:

/
Code:
*
 *  ------Waspmote XBee ZigBee Sending & Receiving Example------
 *
 *  Explanation: This example shows how to send and receive packets
 *  using Waspmote XBee ZigBee API
 *
 *  This code sends a packet to another node and waits for an answer from
 *  it. When the answer is received it is shown.
 *
 *  This is the code for the receiver.
 *
 *  Copyright (C) 2009 Libelium Comunicaciones Distribuidas S.L.
 *  http://www.libelium.com
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Version:                0.2
 *  Design:                 David Gascón
 *  Implementation:    Alberto Bielsa
 */
 
 packetXBee* paq_sent;
 int8_t state=0;
 long previous=0;
 char*  data="Test message!";
 uint8_t destination[8];
 uint8_t i=0;
 
void setup()
{
  // Inits the XBee ZigBee library
  xbeeZB.init(ZIGBEE,FREQ2_4G,PRO);
 
  // Powers XBee
  xbeeZB.ON();
}

void loop()
{
  // Waiting message
  previous=millis();
  while( (millis()-previous) < 20000 )
  {
    USB.println("\n\tEsperando paquete...");
    if( XBee.available() )
    {
      xbeeZB.treatData();
      USB.println(xbeeZB.error_RX, DEC);
      if( !xbeeZB.error_RX )
      {
         // Sending answer back
         while(xbeeZB.pos>0)
         {
           if( (xbeeZB.packet_finished[xbeeZB.pos-1]->naO[0]==0x56) && (xbeeZB.packet_finished[xbeeZB.pos-1]->naO[1]==0x78) )
           {
             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, NI_TYPE);
             while(i<4)
             {
               destination[i]=xbeeZB.packet_finished[xbeeZB.pos-1]->macSH[i];
               i++;
             }
             while(i<8)
             {
               destination[i]=xbeeZB.packet_finished[xbeeZB.pos-1]->macSL[i-4];
               i++;
             }
             xbeeZB.setDestinationParams(paq_sent, "Blomfontain#", data, NI_TYPE, DATA_ABSOLUTE);
             xbeeZB.sendXBee(paq_sent);
             if( !xbeeZB.error_TX )
             {
               XBee.println("ok");
             }
             free(paq_sent);
             paq_sent=NULL;
           }
           free(xbeeZB.packet_finished[xbeeZB.pos-1]);   
           xbeeZB.packet_finished[xbeeZB.pos-1]=NULL;
           xbeeZB.pos--;
        }
      }
    }
  }

  delay(5000);
}


Top
 Profile  
 
 Post subject: Re: Sending Receiving ZigBee
PostPosted: Thu Oct 14, 2010 9:57 am 

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

'NI_TYPE' is still not supported by the function 'setDestinationParameters'.

Could you please try to send to the MAC address of the destination node using 'MAC_TYPE' ???

Regards


Top
 Profile  
 
 Post subject: Re: Sending Receiving ZigBee
PostPosted: Thu Oct 14, 2010 11:14 am 

Joined: Fri Sep 24, 2010 1:19 pm
Posts: 50
Hi again,

it was the first I probed.

I think it could be another configuration parameter that is wrong but I don't find it yet.

Regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 2 of 3   [ 27 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