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.

EK-TM4C123GXL: How to operate UART5 Tx and Rx pins(PE5 and PE4) of tm4c123gxl for communication with Xbee?

Part Number: EK-TM4C123GXL
Other Parts Discussed in Thread: ENERGIA

Hi, I am using PE4 and PE5 as my Rx and Tx pins to receive signal from Xbee. My code is working fine with other microcontrollers but I am not able to receive any signal when I am using these pins. I have used my default Rx and Tx pins for other purposes so I am restricted to use these pins for communication with Xbee. I have read about unlocking UART pins before usage and I have tried many codes but I am not able to get anything on serial monitor. Can you guide me about how to use these pins?

  • Hi,

     I'm confused with your question.

    Hrishikesh Relekar said:
    My code is working fine with other microcontrollers

      Where is your code running from? Is it running on the TM4C123? What do you mean it is working fine with other microcontrollers? 

    Hrishikesh Relekar said:
    I have used my default Rx and Tx pins for other purposes so I am restricted to use these pins for communication with Xbee.

    I'm confused when you said you are using the default RX and Tx pins for other purposes. What other purposes? Later on you said you are restricted to use these pins for communication with Xbee. So what are trying to do? Aren't you using PE4/PE5 as RX/TX pins to interface with Xbee. Then why are you using RX/TX pins for other purposes.

      If you want to know whether or not the UART5 is working on the PE4/PE5 then why don't you create a simply example for UART5 and and use the scope to see if you are seeing any TX/RX activities on the bus. 

  • Hi Charles,

    I believe he has (likely) used 'Arduino/similar' (only) when referencing 'other' Microcontrollers.    No connection to your MCU (at that time).

    As to default RX/TX - it is suspected he is using those pins for (other) UART Applications - thus they are unavailable for his Xbee.

    Might a simple explanation reveal that  'Stdio' - does NOT extend - to encompass UART_5?    (seems reasonable - as he has gotten the other UARTS to work...)

    Follows an extract from uartstdio.c:     (it is noted that poster's desired UART - UART5 ... is  AWOL...)

    //*****************************************************************************
    //
    // The list of possible base addresses for the console UART.
    //
    //*****************************************************************************
    static const unsigned long g_ulUARTBase[3] =
    {
    UART0_BASE, UART1_BASE, UART2_BASE
    };

  • Thanks in advance

    Answers to your questions -

    1)I am running my code using energia.

    2)Other microcontroller includes Arduino models for which my code is working fine.

    3) Yes my default Rx and Tx pins are utilized in other UART applications so I decided to use PE4 and PE5 pins for Xbee communication.

    What do you mean by simply example for UART5 in your last line, I didn`t get what are you trying to say?

    Regards

  • MIght you check the recent post - one up - from yours of 2:27?      Have you employed the stdio UART Function?    If so - (that) appears your issue!

  • Thanks for the clarification.

    First of all, we are not experts in Energia. You may find better support if you post your questions to Energia fourm at forum.43oh.com/.../.

    What I meant about the UART5 example was that if you have doubt where the PE4/PE5 pins for UART5 are not working then you can write a simple UART example targeting UART5 to see if you get any pin activities. Of course, you can do the debug by taking the scope capture on the PE5/PE4 with your existing Xbee code running to see it is working. In any case, the scope is the best thing to debug your problem as I don't think Energia offers much debug capabilities.

  • There are several steps that have to be taken before the UART is completely functional. The stdio library handles this for UART0, UART1, and UART2, but you have to do everything yourself for UART5. I have not used Energia or the TM4C123x, but here is code that is similar to what works on the TM4C129x chips:

    	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART5);
    	GPIOPinConfigure(GPIO_PE4_U5RX);
    	GPIOPinConfigure(GPIO_PE5_U5TX);
    	GPIOPinTypeUART(GPIO_PORTE_BASE, GPIO_PIN_4 | GPIO_PIN_5);
    	UARTConfigSetExpClk(UART5_BASE, ui32Clk, 31250, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE);
    	UARTFIFODisable(UART5_BASE);	// REVIEW: does the FIFO hurt anything?
    	UARTIntEnable(UART5_BASE, UART_INT_RX | UART_INT_RT);

    You may have to change some #define's for your TM4C123GXL. Also, you'll note that I have enabled interrupts because I also have an interrupt handler routine. That needs to be installed in the startup.c vector table, and you'll have to write that code yourself. If you're just polling the UART then you should skip UARTIntEnable().

  • Do note that - far earlier - the limitation imposed by 'uartstdio.c' was (clearly) presented & listed. It remains unclear - 'IF' this poster has employed uartstdio.c.

    The remainder of your post - to my mind - most excellent...