This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCPDT: Interfacing with Xbee

Part Number: TM4C1294NCPDT

Howdy.

We are interfacing with an XBEE Pro S3B Module with our custom PCB.

There is a monitoring station that is sending the data from it's own XBEE to ours.

When we have our XBEE plugged into its socket (like the SparkFun breakout boards), and then apply power, the UART 1 RX pin stays at around 600-650 mV and we can't receive data.

When we power the Xbee and have the UART1 RX unconnected for a bit, and then connect the pin, it'll idle high and we can receive data. 

We suspect the UART 1 RX line is being pulled low by the Tiva during startup and the Xbee module can't get control of it. 

We're able to communicate with the XBEEs in xctu just fine. (Monitoring Station -> XCTU, XCTU -> Monitoring Station, XCTU -> Custom PCB, Custom PCB -> XCTU, Monitoring Station -> Custom PCB, etc). 

We just have to disconnect UART1 RX (DOUT) when the device powers up, wait, and then reconnect that line before we can receive data. 

  • If I understand you correctly the XBEE module and the TM4C are on different power supplies and the XBEE module is powered on before the TM4C. It is never a good idea to drive the input pin of an unpowered device. You are probably getting a latchup condition that is holding the TM4C UART RX pin low. (I assume you are not using any interface drivers on the UART, but rather connected the XBEE TX pin to the TM4C RX pin.) You might try limiting the current from the XBEE TX pin by adding a resistor (maybe 2.2K) between XBEE TX and TM4C RX.
  • Bob,

    We have a switching regulator outputting 3.3V to both the TM4C and the xbee module. We've also tried powering the uC while holding the xbee in a sleeping condition and then waking it up and the same problem happens.

    We will try it with the resistor though and report what happens.

  • If both are powered by the same supply, there might be something else going on. The resistor may help to identify what that is. Let me know what happens.
  • Bob,

    The resistor didn't work. We tried several different values and it still only works when the modules are powered and then the DOUT/RX line is jumped over.

    Another thing we tried was to initialize the TM4C TX/RX lines as GPIOs and write them to a high state, then configure them as UART pins. As soon as they're configured as UART pins, the pin idles back to around 650 mV and, again, no data received.
  • Was the voltage the same on both sides of the resistor, or high on the XBEE side but low on the TM4C side?
  • David Moore53 said:
    ...initialize the TM4C TX/RX lines as GPIOs and write them to a high state

    Would not that insure an, "Output to output" conflict - with (both) the Xbee & TM4X  driving their (now connected) outputs?    That cannot be good.  (i.e. Data Contention central!)

    Have you considered a pull-up resistor on the TM4C's UART_RX line?

    It would also be wise to repeat this test on a 2nd MCU board...

  • So we've tried different pull-up resistors (strong and weak) and the same problem persists. We reset the code to just initializing the UART1 module then setting the pins as UART.

    	//Enable Port C as UART1 and specify GPIOC as UART
    	//This UART is used to connect to the XBee module
    	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
    	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);
    	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    
    	//Configure GPIOC Pin 4 as RX and GPIOC Pin 5 as TX
    	//GPIO Pin type set as UART at Pin 4 and Pin 5
    	GPIOPinConfigure(GPIO_PQ4_U1RX);
    	GPIOPinConfigure(GPIO_PB1_U1TX);
    	GPIOPinTypeUART(GPIO_PORTQ_BASE, GPIO_PIN_4);
    	GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_1);
    
    	//Set UART parameters, 9600 clock speed, 8 bit message length, 1 stop bit, no parity
    	UARTConfigSetExpClk(UART1_BASE, g_ui32SysClock, 9600,
    			(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
    
    	IntMasterEnable();	//Enable master interrupt
    	IntEnable(INT_UART1);	//Set interrupt to UART1
    	UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT);	//Set UART1 RX pin and RT pins to be interrupts

    After probing the hardware we're seeing that once the UART1 module is initialized, the TX line goes high. The RX line jumps high as soon as it is configured as as UART pin (lasts for 6.3ms) and then drops down to the ~650mV level. With the XBEE powered, we then jump the DOUT line to the UART1 RX line then we can receive data. 

    Is the fact that we're setting the RX pin as an interrupt a factor?

  • The comments are off but the code gives you the right idea.
  • I don't see any issue in the PB1 (UART1 TX) pin behavior. Before the pin is configured, it is in a high impedance state with no pull attached. Once configured as UART1 TX it is driven high.

    The behavior of PQ4 (UART1 RX) is the question. Even when configured as UART1 RX, by default there is no pull-up and the level should be determined by the TX pin from the XBEE. The fact that the pin is low before you connect the XBEE TX is also of no concern.

    When you have the XBEE TX pin connected to PQ4 during power up is when you have the problem, correct? That connection stayed low, right? To verify that it is PQ4 on the TM4C1294 that is holding the XBEE TX pin low, when you had the resistor between them, was the XBEE TX pin side of the resistor high? If not, then it is not PQ4 that is pulling the connection low, rather a failure of the XBEE TX pin to drive high.

    Sorry if you have already determined the answer to this, but in the past I have found that I waste a lot of time if I do not carefully document why I chose to exclude a branch on a debug fault tree.
  • David Moore53 said:
    The comments are off but the code gives you the right idea.

    I (was) about to "squawk" at that!

    When that pin is configured as "UART_RX" I'm at a loss to explain how such pin can (apparently) "pull-down" your external device's output.    And - (only) do that from power-up.

    Upon "power-up" most MCU GPIO pins will default to input - likely (and deliberately) preventing such unwanted behavior.   Now - as your comments are (rushed - to be kind) might (other) areas of your code (briefly) configure "UART_RX" as an output?   (firm/I often find this due to rushed client development)

    Have you a 2nd MCU board - it would be useful to repeat this test - ideally w/a "Fresh MCU board!"   Your mention of "both MCU and Xbee outputs - set (high) - during a test" make suspect (both) the MCU AND Xbee pins!   Now those pins (may) appear to work when "specially handled" (you connect ONLY after both devices have powered up).   Yet - those pins (one or both) may have been damaged - and cannot support the "extra current transients" inflicted upon "awakening."   An ideal test would employ (BOTH) a new Xbee and new MCU board - avoiding any setting of both outputs "high!"

    Have you positively measured the (common) ground connection between both boards?   (recently?)   

    Would you be so good as to employ a 4K7-10K pull-up R (to 3V3) @ UART_RX - and then power up - w/out any external connections?   A scope capture of that pin - at power up & just beyond - would be useful.   From your writing we cannot tell if an, "Xbee-free" connection (i.e. the pull-up) will also yield the illegal voltage level (~0.6V) shortly after power up.   Such a test - and report - will be telling.

    For completeness it would be wise to monitor the 3V3 to (both) Xbee & your MCU board during "power-up."   You should also monitor (via scope) the "start-up" output signal from the Xbee - unattached to your board!   Might it over or under-shoot?   (i.e. exceed 3V3 or go below ground)   None of this detail has been reported - yet "Everything is suspect" in such an unusual case...

  • Bob,

    Correct, the problem happens when the XBEE TX pin is connected to PQ4 during power up. Also correct that the connection stays low.

    With the resistor in between, the XBEE side is slightly higher at ~880mV.
  • cb1,

    In hindsight, developing seven or eight other code snippets at the same time wasn't the brightest idea. Anyways, neither UART1 RX nor its GPIO (PQ4) are configured elsewhere in the code. We tried initializing PQ4 as a GPIO and driving it high initially, but as mentioned previously that didn't work.

    We have a 2nd PCB that we have tried this on and the same problem persists. The same thing happens when using the Launchpad. We've tried resetting the XBEE modules to factory settings and played with the configurations a bit, but to no avail. We have two different XBEE modules (the 2.4 GHz versions) that do the same thing with the DOUT/RX connection idling at 900mV.

    The PCB and XBEE module share a common ground plane, but the ground has been jumped over to a breadboard just to try new things, no change there.

    As for the pull-up resistor. First we connected RX to 3.3 through a 4.7K resistor and it goes high as expected. Then we jump 3.3 to the XBEE and RX to the XBEE's DOUT pin and turn power on and the line is pulled high but stays high. We can capture blips on the scope where the data is coming in but it's not a steady stream.

    Scope shows no nover or under-shoot.


    TLDR:
    The pull-up resistor improves the problem to a sometimes-working condition. The line is pulled high at startup but data comes in intermittently. We must have used too strong of a pull-up value when we previously tried this.
  • David,
    That is very significant. If there is only 220mV across 2.2K Ohms, then the XBEE is only sourcing 100uA. That is only a very weak pull-up.
  • David,

    What is the XBEE pin 17 connected to? If it is left floating, it might cause the XBEE to use SPI instead of UART.

  • Pin 17 is floating on the PCB, but through the XCTU configuration we have it internally pulled up.
  • It might be worth checking the level on that pin. Internal pull-ups can be pretty weak. The symptoms you are seeing are consistent with an indeterminate level on the pin that defines the XBEE serial interface.
  • To provide a, "Clean bill of health" to your MCU board cannot you route your (questionable) UART to a 2nd UART - resident upon that same MCU board - or upon a 2nd?   (I recommend that pull-up Rs appear at each UART_RX pin.)

    Success following that procedure would (almost) completely shift blame to the Xbee.

    When not using level translators (RS232/485 etc.) we find that (most) UART_RX pins either "require" or substantially benefit from the presence of a pull-up R. (we note that on Cortex M4 MCUs from several vendors (including this one)...)

    Note that we requested you to "scope monitor" the output of the Xbee - with NO Connection to your MCU board.   You complied and report NO over/under-shoot - yet did not specifiy if the output level was suitable for the MCU! (i.e. high at/around 3V3, low at/around ground.)    Such proves critical as the Xbee is drifting into "guilty party" prominence...

  • Any updates on this issue?

    I'm having similar problems with a XBee. If I power on the XBee without the Dout pin connected and then connect it to the Rx pin of the target device the pin pulls high to 3.3V and the communication works just fine. However, if I power on the XBee while Dout is connected to the target device it floats at ~1.6V forever and communications don't work. Note: the target device Rx pin floats at 1.2V when not connected to anything, also I don't know the internal circuitry to the target device, all I have is wire harness with a 3.3V-TTL UART interface (3.3V, Rx, Tx, Gnd).

    Also, I tried a 10k & 4.7k pull-up resistor on the Dout/Rx line and it brought the voltage up to ~1.5V.
  • No, there have not been any updates on this post, but I have a follow on question for you. Is the TM4C powered at the same time as the XBee board? If the XBee powers up first and tries to drive the UART Rx pin before the TM4C is powered, that could cause a soft latch-up issue.