Shop OBEX P1 Docs P2 Docs Learn Events
XBee on built in BS2 serial port — Parallax Forums

XBee on built in BS2 serial port

sonnysonny Posts: 10
edited 2012-09-17 08:07 in Accessories
Hi,

Sorry if this was answered in another post. I searched but could not find anyting...

I want to use an xbee to communicate with a BS2 via the built in serial (pin 1 and 2). My app works fine if I use pins 14 and 15, but the data is garbeled if I try using the built in port. I am running at 9600 baud. I have tried 84 and 16468 for the baud mode with no success. I do have a pullup resistor on both Tx/Rx, which worked fine when using pins 14 and 15.

Any ideas?

Thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-09-16 15:15
    The "built-in" serial port is very different from using any other pins for a serial port. The voltage levels are wrong and the signal is inverted because Sin / Sout (pins 1 and 2) are intended for use with an RS232 serial port which the xBee is not. There are other differences as well. You could use a MAX3232 between the xBee and Sin / Sout and that would convert the 3.3V logic levels of the xBee to RS232 levels for Sin / Sout.

    Do not continue to use the xBee directly with the Stamp without some kind of adapter or you will damage the xBee. The xBee is a 3.3V device while the Stamps are 5V devices and are not directly compatible. Parallax makes an adapter board for the xBee for use with the Stamps and other 5V logic devices.
  • sonnysonny Posts: 10
    edited 2012-09-16 16:28
    Oh, I forgot to mention..

    I am using the adapter board. Parallax P/N 32401.

    That being said, would it be possible to use the built in SIN/SOUT? I am trying to keep all 16 IO pins available for data, even if that means using a MAX232 converter. It would be nice if it could be done without it though...

    Sonny
  • Mike GreenMike Green Posts: 23,101
    edited 2012-09-16 19:07
    You'd be best off using the MAX232. Here's one sample circuit for that plus some alternatives.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-09-17 05:51
    The Stamps' Sin/Sout are 0/5V.
    For this XBee application a simple transistor (common emitter) circuit or CMOS inverter will do.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-09-17 08:07
    As others have pointed out, the problem is that the signals out from the debug port are always inverted, no matter whether you choose $54 or $4054 as the baud mode. For it to work, the signal has to be re-inverted for the XBee, but the 32401 adapter board does not do that. It has a buffer chip, 74LVC244, that translates the voltage from 5V on the Stamp side to 3.3V on the XBee side, but it does not invert. One way to approach it, given that the #32401 is a kit, would be to substitute a 74LVC240 in place of the 74LVC244. It has the same pinout, and it does the 5V/3.3V level translation, but it inverts. I've made adapter boards that use that chip successfully with the XBee on the debug port. It also works on the other Stamp pins (inverted).

    P.S. Oh, i see #32401 is a kit only in that you attach the headers. The 74LVC244 is an SMT part that comes from Parallax already soldered onto the board. My suggestion above would work only if you are comfortable with swapping SMT chips.
Sign In or Register to comment.