Data Issues


I have set up 2 XBEE modules in AT mode, one co-ordinator and one router/end device.

There is data communication between them, however the data in and out just isn’t correct.
I have included a file that shows in the first column what the coordinator is sending, the second column shows the data i am recieving.

Can anyone understand why it is not correct?


Are you in API mode or have you not set your baud rates to match?

Unfortunately neither module is in API mode, and both are set to the correct baud rates of 9600, with 8N1 setup.

Well, that was an interesting little brain-teaser. I think I’ve figured it out.

I wrote a little program to construct the RS-232 bit sequence (start, data, stop) and then to decode it. I was able to reproduce your table if I inverted the data stream (interchanging 1 and 0 throughout). The only exception was that h decodes as 09, not 08 as in the table. Could that be a typo in the table?

So I think some part of your circuitry is performing a signal inversion where it shouldn’t.

Does that help?

Well i double checked and i am pleased to say that yes, i had put in a typo of h being 0x08, it should have been 0x09!

Thank you so much!
Do you know of a way in software that i can change this? I don’t really want to have to mess with the hardware, where possible.

Many thanks

Looks like the diagnosis is right then. Sorry, there’s no way to fix that one in software - I reckon you’re going to have to dive into the hardware.

It does occur to me to ask: are you by any chance connecting an XBee directly to an RS-232 port? If so, that would explain the signal inversion because they use opposite polarities. Connecting an XBee to an RS-232 line needs level converters in the circuit if it’s to work properly. If you look at the Digi schematic for an RS-232 development board you’ll see how it’s done.

I’d like to say thanks to johnf, I have finally got round to modifying the hardware and it now works as I’d expect.
Many thanks again.


Great! I love it when a solution comes together, and that was a nice puzzle too.

Thanks for the update.