XBee serial link setup...

Hi.

I’m relative new to this kind of work, but for a project I’d like to connect my Garmin GPSMAP76S to my serial port on my computer via two XBee modems.

I’d like to send the NMEA 0183 string from the GPS tor the computer. When I connect my GPS i can read i plain text using either X-CTU or Hyperterminal the information sent by the GPS. When connecting through the XBee modems I can se that information is sent by the GPS, but the information witch shows in either Hyperterminal or X-CTU is not understandable at all.

}m•å›Ÿ™›—›§S§“™Ÿ

My first guess is a Baud rate mismatch or the serial set-up mismatch.

The XBees uses 8 bit, no parity and 1 stop bit by default. Check that this matches on both ends as well as the baud rate.

This could be either between the GPS and the transmitting XBee or between the receiving XBee and the PC.

Can you read the XBee modem configurations with X_CTU? This is where you check the XBee settings and make changes if needed.

The signals from the GPS, are they RS232, e.g. from a 9 pin D-sub connector? You may need to invert the signals to get the correct signal polarity for the TTL/UART communication with the Xbee module.

When connecting the GPS to the computer, exactly how is it connected? Are you using a serial port on the computer, or maybe a USB to serial adapter?

Try running the GPS data output (GPS Tx to Xbee Din) through a 74HC04. It could do the trick.

/Johan Adler

is GPS serial data logic level or RS232?

If RS232, you know about voltage levels needed for the XBee, right?

If logic level, it may be inverted.

Of course, you know that most NMEA serial defaults to 4800baud

The GPS signal is sent via an 9-pin D-sub connector, which I’ve connected ground from Gps -cable to GND on Xbee serial board, and GPS TX signal to Din on the Xbee serial board. I’m not sure if this qualifies for logic level or RS232, but my impression was to the RS232.

If RS232, how does the voltage level compare to what the Xbee needs?

Baud 4800, databits 8, parity none, stop bit 1 on both XbeePro’s.

I configure both from X-CTU. I’m pretty sure the baud rate settings are ok, so I think it’s a trick with the serial setup. Something is passing through, but i dont know what.

When connecting directly to the computer I use the 9-pin D-sub serial port.

Here is a screen shot. GPS to computer on the left. Via Xbee and X-CTU on the right…

http://www.flickr.com/photos/43334986@N08/3984174173/

Thanks

permagne:
When connecting directly to the computer I use the 9-pin D-sub serial port.

If that 9-pin ‘D’ from the GPS works when connected the your PC it will not work if connected directly to the XBee.

The serial signals into a PC COM port are negative logic and are +/-12V to be fully RS232 compliant. However, most COM ports on PC these days work perfectly fine with 0 to 5V signals but they are still negative logic.

On asynchronous serial’s logic level the start bit is high, a 1 is high and a 0 is low with the stop bit being low (normally 0V for a low and 5V for a high). On true RS232 the logic is inverted and driven to -12V for a logic high and +12V for a logic low (Start bit is -12V, stop is +12V). Or the PC will accept 0V for a high and +5V for a low (Start is 0V and stop is +5V).

As stevech said about inverted logic. I get back to this in a minute.

The PC UART will decode the inverted bit stream (just like a wrong baud rate) as garbage. Also the XBee’s inputs are NOT 5V tolerant (spec is 3.6V MAX). But the SparkFun XBee regulated board has saved the XBee by blocking the +5V with a diode (just went through this with someone on the Digi Int forum and my own interfacing of an XBee with a PIC) so that the XBee’s Din never sees a +voltage. For the Din to go high the internal pull-up, AT command ‘PR’ bit 7, needs to be enabled or an external pull-up installed. Check the XBee Doc and the SparkFun XBee regulated board schematic.

The XBee Explorer Serial should have worked as to contains an RS232 receiver that inverts the serial logic. Did you get garbage or nothing when you tried this on the GPS end?

Try to simplify and not use the GPS. Since you have two XBees and two XBee Explorer Serial boards connect both to your PC on two COM ports. You should be able to open two terminal programs (or a terminal program and X-CTU’s terminal tab ) and send data from one to the other.

Once you have this working then try adding in the GPS.

I looked up the GPS you have and check the user’s manual but as with too much of the commercial stuff that is sold today the information was extremely lacking. If you have access to an O-scope then the signal voltages, logic and timing can be measured. Then we would know exactly what to do.

You will need to invert the signal. Run the RS232 Tx (from GPS) through a 74HC04 or similar.

Check http://jarduino.com/2009/08/connect-br-355-gps/ for more details.

Good catch Johan.

Inverted logic will get you.

Hope everyone can get their Garmins working through the XBee now.

waltr:
Good catch Johan.

Inverted logic will get you.

Looks like some praise gets shared with Steve too. :smiley:

stevech:
is GPS serial data logic level or RS232?

If RS232, you know about voltage levels needed for the XBee, right?

If logic level, it may be inverted.

Yep, Steve also.

Sorry Steve.

lost in the word-storm.

Thanks guys!

This will help me on my way. I’ll post more when I’m lost again and have time to test some more… As a mechanical engineer, bauds, stop bits, en pull high/low is a bit difficult to “see”. So you might need som patiance with me.

thx

Per Magne

Since we’re praising the guys who figured this out, let me add my thanks. I was facing the same question, and following closely here.

As I wrote on my blog I chose a Globalsat BR-355 for my Arduino project in order to have an external weatherproof unit that can be placed for optimal reception. I tried for a very long time to make it work, and it was not until I bought a Saleae Logic analyzer that I was able to figure out what the problem was.

The BR-355 was also cheaper than the smaller units usually sold for use with microcontroller projects. When I opened it I found what I guess might be an EM-406a module inside. If I am right this receiver might actually be a cheaper source for the EM-406a than buying the module itself. It even has the same kind of connector as the EM-406a and can easily be disconnected from the rest of the receiver.

Nice blog Johan. Appreciate you taking the time to write about your debugging and testing efforts.

Also - interesting deduction on the internal module. Might be worth a followup call to USGlobalSat to confirm.

mitchind: I chose not to ask Globalsat about it, since if it really is the same module and the packaged BR-355 receiver is cheaper (probably due to much higher volumes) they might decide to do something about it in order to make it more difficult for inventive persons such as us to buy the cheaper package and strip it to get the naked module.

Maybe I am just wrong, or too cautious.

Might be right - but I’ve always found the techie dept are usually very forthright and like to talk the lingo - just stay away from sales.

Good luck, and share your results.

Globalsat BR-355 - $40 a nice price. Which distributor did you use?

It’s a couple of generations back - 80mA is high consumption versus the latest ones. But if mains powered, no problem. Also, with the SiRF receiver, the power-down/sleep commands are proprietary and you have to get an NDA signed to get the API documents.

Its interface is TTL, not RS232 as you know. Since most RS232 level converters have a data inversion - you have to accommodate.

My project is for my car, so 80 mA with car engine running is OK for me. This is also a reason that I have not even looked for the low power modes in the reference manual from Globalsat – http://www.usglobalsat.com/downloads/Si … otocol.pdf – available without NDA. (A quick look shows several commands for low power modes, and software commanded shutdown.)

I bought it from a Swedish store, http://www.kjell.com/, but since I bought it they raised the price just a bit, and the dollar/SEK exchange rate has changed a lot in our favor, so the current price converted to dollars would be more than $60 I’m afraid.