Getting two UART sources to work with a single Xbee

Discussion in 'The Projects Forum' started by icydash, Aug 15, 2012.

  1. icydash

    Thread Starter Active Member

    Jan 14, 2009
    81
    0
    Hey guys.

    So I have an Xbee, and I'd like to send it data over UART from two different sources. The first is a microcontroller, the second is a USB connection to my computer (I'm using a FT232RL as the USB-->UART interface for the computer hookup). Both sources should be able to transmit data to the Xbee over UART.

    My circuit, more or less (i left out a lot, but you get the idea), looks like this: [​IMG]

    If I disconnect the TXD and RXD lines from the microcontroller and try to send the Xbee data over UART from the computer using the FT232RL, it works perfectly. The data sends to the Xbee and all is well.

    However, the problem arises when both the TXD and RXD lines are connected from both sources to the Xbee at the same time, as shown in the diagram above. When I connect both sources, the microcontroller seems to work properly, but the FT232RL does not. The microcontroller can still send it's data to the Xbee correctly. But the FT232RL can't seem to send data to the Xbee; it just doesn't seem to work.

    EDIT: according to this http://www.sparkfun.com/tutorials/224 it seems like I must have some kind of "bus contention" going on, but I'm not sure how to solve it. The comments try to explain a work-around, but I don't really get it.

    Please help =)
     
    Last edited: Aug 15, 2012
  2. icydash

    Thread Starter Active Member

    Jan 14, 2009
    81
    0
    Ok so I figured some of it out. Had to add 1k resistors to the microcontroller's TXD and RXD lines, as shown in depth here: http://www.billporter.info/how-to-add-multiple-uart-connections/

    So that makes it so when the USB is not plugged in, it uses the microcontrollers TXD/RXD lines, and when the USB is plugged in, it uses the USB. Still, though, I'd like it to not *exclusively* use the USB when the USB is plugged in; I'd prefer it if the microcontroller could send data occasionally, too. Any thoughts on how I can use both devices simultaneously?
     
Loading...