Author Topic: how to change Xbee baud using Axon  (Read 2041 times)

0 Members and 1 Guest are viewing this topic.

Offline AdminTopic starter

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,660
  • Helpful? 169
    • Society of Robots
how to change Xbee baud using Axon
« on: October 11, 2010, 03:13:25 PM »
Anyone have proven code to send a serial command to change the baud rate of an Xbee?

Reading the manual and browsing the web, I gathered this below code is what I should do . . . but no luck. I'm sure its something simple I'm not doing right . . .

Code: [Select]
rprintf("+++++++++++++++++++++++");
delay_ms(3100);
rprintf("ATBD7,WR,CN");

(I know it doesn't work as I can still send data at the default 9600bps without data corruption)

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
Re: how to change Xbee baud using Axon
« Reply #1 on: October 11, 2010, 03:59:38 PM »
You only need three +'s.

Not through an Axon, but I just tried your command. Got the OK response, and had to guess what baud rate it was talking at afterwards to get it to come back.

I also only delayed for less then a second, not 3, but shouldn't make a difference as the time out is 10 seconds before it closes the settings time window.
« Last Edit: October 11, 2010, 04:02:58 PM by madsci1016 »

Offline AdminTopic starter

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,660
  • Helpful? 169
    • Society of Robots
Re: how to change Xbee baud using Axon
« Reply #2 on: October 11, 2010, 04:11:41 PM »
hmmmm not sure what I'm doing wrong . . .

I tried it with hyperterminal, still no luck.

I am however able to change it using the X-CTU software.

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
Re: how to change Xbee baud using Axon
« Reply #3 on: October 11, 2010, 04:20:09 PM »
Are you at least getting an OK after three rapid +'s?

What series are your Xbee's?

Offline AdminTopic starter

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,660
  • Helpful? 169
    • Society of Robots
Re: how to change Xbee baud using Axon
« Reply #4 on: October 11, 2010, 04:30:28 PM »
Nope, didn't see an OK when using Hyperterminal, although it did stop echoing data it was receiving wirelessly from another Xbee after the +++ command.

Using XBP24, according to the X-CTU software.

Offline KurtEck

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 12
Re: how to change Xbee baud using Axon
« Reply #5 on: October 11, 2010, 05:44:12 PM »
I don't currently have code on the Axon2 to change the baud rate, I did this earlier with an external program. But I do have my code switch to packet mode at startup.  That code looks like:
Code: [Select]
// Set us into API mode
rprintfInit(WIRELESS_ACTIVATE);
delay_ms(20); // wait 20ms for guard time to enter into command mode
rprintf("+++"); // Now output the string to enter command mode
WaitForXBeeTransmitComplete();
delay_ms(20); // wait 20ms for guard time to enter into command mode

rprintf("ATAP 1\rATCN\r"); // Ok output the enter API mode command and also the exit from command mode
delay_ms(20); // wait 20ms to let the xbee have time to respond...
Note: My external code also switched the guard time to 3 (ATGT 3) so I don't have to wait very long to get into command mode.

A couple of things. You need to have the XBEE not receive anything for the Guard time before the +++ is sent without a CR. And you must wait the guard time after the +++
Then you can issue your commands. You must then either wait for the guard time after your last command for the XBee to time out of API mode or you can issue the ATCN command.

Good Luck
Kurt

EDIT: I forgot to mention, if you wish for the changes to be permanent, issue the ATWR command.
« Last Edit: October 11, 2010, 05:47:32 PM by KurtEck »

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
Re: how to change Xbee baud using Axon
« Reply #6 on: October 11, 2010, 05:53:24 PM »
You need to have the XBEE not receive anything for the Guard time before the +++ is sent without a CR.

This is Admin's problem then.

data it was receiving wirelessly from another Xbee after the +++ command.

 I figured this was the case with my own observations of not being able to change settings using X-CTU while SAGAR was transmitting to the Xbee I was attempting to program, but never confirmed my suspicions by looking it up.

Offline AdminTopic starter

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,660
  • Helpful? 169
    • Society of Robots
Re: how to change Xbee baud using Axon
« Reply #7 on: October 11, 2010, 06:06:27 PM »
I forgot to mention, if you wish for the changes to be permanent, issue the ATWR command.
So the XBee baud returns to default upon power reset, unless that command is issued?

If so, thats another reason why it wasn't working . . . I'm reseting very often over here . . . doh!

You need to have the XBEE not receive anything for the Guard time before the +++ is sent without a CR.

This is Admin's problem then.
Too lazy to redo baud rates to verify, but hmmmm doh! (again)

Offline KurtEck

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 12
Re: how to change Xbee baud using Axon
« Reply #8 on: October 11, 2010, 06:17:45 PM »
I forgot to mention, if you wish for the changes to be permanent, issue the ATWR command.
So the XBee baud returns to default upon power reset, unless that command is issued?

If so, thats another reason why it wasn't working . . . I'm reseting very often over here . . . doh!
Actually this depends.  If the Axon resets, but not the XBEE (ie it still has power), than it still has whatever parameters like new Baud rate and trying to communicate at the default baud rate (9600) will fail...   

That is one reason why I did the majority of my init stuff external to my main program.

Kurt

Offline AdminTopic starter

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,660
  • Helpful? 169
    • Society of Robots
Re: how to change Xbee baud using Axon
« Reply #9 on: October 11, 2010, 06:36:07 PM »
Wait, looking at my command from earlier, I was already calling the ATWR command :P

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
Re: how to change Xbee baud using Axon
« Reply #10 on: October 11, 2010, 08:46:46 PM »
Wait, looking at my command from earlier, I was already calling the ATWR command :P

Then the second 'doh!' was most likely the problem then.  ;D

 


Get Your Ad Here

data_list