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.

CCS/EK-TM4C1294XL: UART initiate interrupt routine and make data replication after send function

Part Number: EK-TM4C1294XL

Tool/software: Code Composer Studio

Hi

I have programmed the UART of TM4C1294XL kit to send Data as per the code below, but i noticed that the UART get interrupted once send function finish and get the same sent data, this problem has been fixed by disable and re-enable the UART port, but i'm sure there is more intellectual solution for this.

BR,

Hani

  • Hello Hani,

    I'm not entirely clear on the issue though I can definitely agree that a Disable/Enable sequence is not a good solution for what it is.

    From what you were saying, you get an interrupt once the Send function finishes, by this do you mean your UARTSend API?

    I am also not sure what you mean by "get the same sent data".

    What is the intended behavior you are looking for here, can you explain what adding the Disable/Enable sequence 'fixes'? The more I can understand about what you are doing, the better I can try and help you find a proper solution.

  • Hello Ralph 

    Yes i get the interrupt once my UARTSend API finish it operation.

    and i get the same data i have given to the UARTSend API function on the array of received characters, then when the actual data come form the slave device i get another interrupt with new data on the array of received characters. as i'm doing master slave modbus RTU application.

    BR

    Hani

  • Hello Hani,

    Have you checked to see which interrupt flag in the UART specifically is triggering? This would be done with a breakpoint before clearing flags and then checking the UART registers to understand what has been set.

    My guess is that the Receive Timeout is triggering for some reason. Possibly because there is still receive data in the FIFO?

    Though the same data piece is still confusing me a bit. Do you see the UART RX FIFO having the data you sent? Maybe then you turned on Loopback mode? That's about the only idea I'd have for why you'd see TX'd data into your RX FIFO.

  • Ralph Jacobi said:
    Maybe then you turned on Loopback mode? That's about the only idea I'd have for why you'd see TX'd data into your RX FIFO.

    If Modbus Multidrop communication over RS485 2 wire bus is used, could that cause TX'd data to enter the RX FIFO?

    I guess it depends upon how a RS485 transceiver in multidrop mode is configured.

  • Hello

    Sorry for coming late, here is the configuration of the UART port and i'm not aware about the loopback mode function or how it can be configured, the below configuration was used from one of the TI examples long long time ago.

  • Hello Hani,

    You still haven't answered most of my original questions - though it is good to see your configuration code. Please let me know the answers to the below:

    Have you checked to see which interrupt flag in the UART specifically is triggering? This would be done with a breakpoint before clearing flags and then checking the UART registers to understand what has been set.

    My guess is that the Receive Timeout is triggering for some reason. Possibly because there is still receive data in the FIFO?

    Though the same data piece is still confusing me a bit. Do you see the UART RX FIFO having the data you sent?

  • Hello Ralph

    I have checked the interrupt flags and noticed that there is receive time out interrupt but in the same time the Receive FIFO flag is showing empty as per the image while ring indicator is also on.

    and regarding the UART RX FIFO, where in the CCS can i see this FIFO data because i searched all the related registers of UART but couldn't find it.

    BR,

  • Hello Hani,

    That set of flags and states is strange to me as the FIFO is empty but the receive interrupt is triggered. That makes me think that the interrupt flags haven't been cleared correctly after reading data. Can you check if before you call the UARTIntDisable API that those flags are not already set?

    If they are, then you need to look into how your program is handling clearing them. That would explain why the interrupt is triggered on enabling. And by disabling the UART entirely, you would be essentially clearing those flags as the peripheral would be 'shut down'.

    Regarding the FIFO, you can look at UARTDR for the current FIFO data.

    The UART has two 16x8 FIFOs; one for transmit and one for receive. Both FIFOs are accessed via the UART Data (UARTDR) register (see page 1175). Read operations of the UARTDR register return a 12-bit value consisting of 8 data bits and 4 error flags while write operations place 8-bit data in the transmit FIFO