XBee Settings

I have set my new (self supplied) XBee modules to API 2. Can any one tell me if this means they will now be API 2 over a power restart? In which case I guess I can remove the code I wrote to do it? Will it do any harm if this code is left and is always setting API 2 over and again?

I am also concerned about the baud rate but I do not fully understand what the issues are.

My calls to the libelium API, which came with the boards the (libelium supplied) xbee modules are plugged into, turn on the XBee and appear normally to set baud 38400. However the digi docs say default when new 9600. So, I am using 9600 with my new (self supplied) XBees and 38400 with the other (libelium supplied) XBees. Both seem to work.

I am not clear if the baud is permanently fixed in the XBee (according to product code) or in the communicating board and one or other of these must be set to use that same rate in its communications or if the baud can simply be chosen according to preference and what should influence that preference.

Any advice would be appreciated. Thank you.

Can any one tell me if this means they will now be API 2 over a power restart?

Yes.

In which case I guess I can remove the code I wrote to do it?

Yes.

Will it do any harm if this code is left and is always setting API 2 over and again?

It performs a write-to-EEPROM each time, so it's not necessarily a good thing. On the other hand, you are unlikely to reset the Arduino 100,000 times or more.

I am also concerned about the baud rate

Why?

My calls to the libelium API

A link?

The answer is a bit more complex Paul. If you change baud rate, it won't be saved such that next time you reset the XBee it'll be the new rate unless you write it; that's the WR command. If you're doing that, a reset or power off of the XBee will come up at the new rate. Same with the API 2 commands, they have to be saved also. If you're changing the XBees with XCTU, XCTU does a save to rom automatically for you. If you're doing it in your own code, look and see if you're doing the WR command.

The baud rate is ONLY for the serial port on the XBee and has no affect on the speed the two XBees talk to each other. The XBees have only one speed talking to each other: as fast as they can. So, you can have one XBee at 9600 and the rest at some other speed and they can still communicate with each other and you just fine.

Regarding what speed to choose: I always choose the highest baud rate the processor connect to the XBee can do and still do whatever else needs to be done. On an arduino, that usually tops out at 115K. You can use less if your software needs to.

It simply sounds like the libelium supplied XBee were pre-programmed to 38K for you. I'd just set the other ones to that speed so they were all the same and go for it.