Post a new topicPost a reply Page 1 of 1   [ 6 posts ]
Author Message
 Post subject: ERASE EXTRA CHARACTERS XBEE PRO S2
PostPosted: Mon Mar 05, 2012 8:03 am 

Joined: Wed Feb 15, 2012 8:54 pm
Posts: 4
Hi Libelium Team,

I've followed steps on -> viewtopic.php?f=17&t=7703

But I can't get a clear string using Xbee Pro S2 (with no extra character), could you helpme to erase them.

Image

I already tried to set AP=0 with setAPI(0) and with X-CTU on XBee coordinator, unsing send funtion at End-Device but still not working.

Thanks in advance...


Top
 Profile  
 
 Post subject: Re: ERASE EXTRA CHARACTERS XBEE PRO S2
PostPosted: Tue Mar 06, 2012 10:22 am 

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

Check different API modes into Digi's documentation. Reading it will help you to understand API modes. Also you can use X-CTU to change API modes.

Using API=0, Xbees makes a transparent communication, so all you send is transmitted with no changes. Check what you are sending (strange characters are AT commands for Xbee modules)

There is some information related to how to pharse received information in this post

We assume that you are using Zigbee modules, right? Maybe if you post the code you are using we can go further.

Let us know if you are success.

Best regards.


Top
 Profile  
 
 Post subject: Re: ERASE EXTRA CHARACTERS XBEE PRO S2
PostPosted: Wed Mar 07, 2012 8:23 am 

Joined: Wed Feb 15, 2012 8:54 pm
Posts: 4
This is my code so far...

Code:
/*
 *  ----- wasp_start_program_full_ZB_v1------
 *
 *  Explanation:
 *
 *  Waspmote starting program for XBee ZB module. This program
 *  initializes the XBee module, prepares the frame to send and every
 *  second it sends it.
 *
 *  Remarks: This code shall work with a XBeeZB-router, so before
 *  executing this example, A ZB-Coordinator must be plugged in your Gateway
 *  and your ZB-router must have: JV parameter set to '1'; BD parameter set to 5;
 *  and AP parameter set to 2.
 * 
 *
 *  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.1
 *  Design:                 David Gascón
 *  Implementation:         Marcos Yarza, Alberto Bielsa, Yuri Carmona
 */


packetXBee* paq_sent;
int8_t state=0;
long previous=0;
char aux[200];
char* macHigh="          ";
char* macLow="           ";
int aux_1 = 0;
int aux_2 = 0;

#define key_access "WaspmoteNetwKey!"

uint8_t direccion[8]={0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF};

void setup(){

   //Store key access in EEPROM
  for(int i=0;i<8;i++){
  Utils.writeEEPROM(i+107,key_access[i]);
  }
 
 
 // Opening UART to show messages using 'Serial Monitor'
  USB.begin();

  RTC.ON();
 
  ACC.ON();
 
 
  XBee.setMode(XBEE_ON);
  XBee.begin(38400);
  delay(1000);
//  XBee.print("+++");
//  delay(2000);
//  XBee.println("ATBD5,AP2,WR,CN");
//  delay(1500);
 
 
  XBee.setMode(XBEE_OFF);

  XBee.close();
   
  Utils.setLED(LED0, LED_ON);
  Utils.setLED(LED1, LED_ON);
  delay(5000);
  Utils.setLED(LED0, LED_OFF);
  Utils.setLED(LED1, LED_OFF);
  for (int i=0;i<24;i++){
    Utils.blinkLEDs(125);
  }
 
  xbeeZB.setAPI(0);
   
 
  // Inits the XBee XSC library
  xbeeZB.init(ZIGBEE,FREQ2_4G,NORMAL);
 
  // Powers XBee
  xbeeZB.ON();
 
  // Get the XBee MAC address

  delay(500);
 
  int counter = 0; 
  while(xbeeZB.getOwnMac()==1&&counter<4){
    xbeeZB.getOwnMac();
    counter++;
  }
 
  Utils.hex2str(xbeeZB.sourceMacHigh,macHigh,4);
  Utils.hex2str(xbeeZB.sourceMacLow,macLow,4);
 
 

}

void loop(){

  sprintf(aux,"-mac:%s%s -x:%d,y:%d,z:%d -temp:%d -bat: %d%c%c%c",macHigh,macLow,ACC.getX(),ACC.getY(),ACC.getZ(),RTC.getTemperature(),PWR.getBatteryLevel(),'%','\r','\n');
 
/*  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,MAC_TYPE);
  xbeeZB.setDestinationParams(paq_sent, "0013A200406B0712", aux, MAC_TYPE, DATA_ABSOLUTE);*/
  xbeeZB.send("0013A200406B0712", aux);
 
  /*free(paq_sent);
  paq_sent = NULL;*/
 
  delay(1000);
}



I've been using xbeeZB.setAPI(0) for API = 0, all comments disable the configuration for using xbeeZB.sendXBee() and AT commands... I should use Only send function?...

xbee model: Xbee PRO s2 - 2.4 ghz


Top
 Profile  
 
 Post subject: Re: ERASE EXTRA CHARACTERS XBEE PRO S2
PostPosted: Wed Mar 07, 2012 9:50 am 

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

Looking at your code we saw that you use xbeeZB.setAPI(0); just after close UART and disable XBEE. Try placing it after making XbeeZB.ON().

On the other hand, on section 7.6.6 on page 32 of Zigbee networking guide you have an example of how to send data without API headers. Please take a look into that.

Tip: If youpaste large codes please use edit/copy for forum.

Best regards


Top
 Profile  
 
 Post subject: Re: ERASE EXTRA CHARACTERS XBEE PRO S2
PostPosted: Sat Mar 10, 2012 6:26 pm 

Joined: Wed Feb 15, 2012 8:54 pm
Posts: 4
I already tried placing beeZB.setAPI(0) after call XbeeZB.ON(). as you told me... I've a question... how does it works?, I read Digi documentation (and saw the same on X-CTU) and they said there is only two values allowed, 1 or 2... I cant set API equals 0 ... Problem persists...

Image

Image

I also tried the code on te Zigbee networking guide with no success... What am i missing???


Top
 Profile  
 
 Post subject: Re: ERASE EXTRA CHARACTERS XBEE PRO S2
PostPosted: Tue Mar 27, 2012 2:29 pm 

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

I'm afraid you are right, in the XBee ZB modules transparent mode is not available, so you will have to parse the header characters in the receiver.

Regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 6 posts ]


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:
cron


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