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.

TMDS273GPEVM: UART Interrupt mode in MCU + 8.2

Part Number: TMDS273GPEVM

Hardware :- TPR12 EVM (TMDS273GPEVM)

Software :- CCS, MCU+ 8.2


I am sending data over UART continuously from MATLAB.  I am trying to receive this data via UART in Interrupt mode on the EVM by modifying uart_echo test. I am continuously getting TIMEOUT error.

However, I can receive data correctly in POLLED mode. The only modification between the two tests is the transfer mode (from INTERRUPT to POLLED). 

I have attached my MATLAB and test code on EVM. 

Does the INTERRPUT mode expect some delay between transmissions?

matlab code.txt

s = serialport("COM5",115200)
idx0 = uint8(1);
idx1 = uint8(2);
idx2 = uint8(3);
idx3 = uint8(4);
idx4 = uint8(5);
idx5 = uint8(6);
idx6 = uint8(7);
var = 0;
while (var<50000)
    var = var + 1;
void uart_echo(void *args)

    UART_Params uartParams;
	uartParams.baudRate         = 115200U;
	uartParams.transferMode = UART_CONFIG_MODE_INTERRUPT;
	uartParams.readMode         = UART_TRANSFER_MODE_BLOCKING;
	uartParams.writeMode        = UART_TRANSFER_MODE_BLOCKING;
	uartParams.dataLength       = UART_LEN_8;
	uartParams.stopBits         = UART_STOPBITS_1;
	uartParams.parityType       = UART_PARITY_NONE;
	uartParams.readCallbackFxn = NULL;
	uartParams.writeCallbackFxn = NULL;

	UART_Transaction uartTrans;
    UART_Handle handle;

	handle    = UART_open(0U, &uartParams);
	if (handle == NULL)
		printf("UART handle is NULL");

	uartTrans.timeout = 10000U;

        printf("########## New Read Started ##########\n");

        uint32_t status;
        uint8_t printidx = 0U;

        uint8_t pu8TempUARTdata[7U];

        uartTrans.buf = (void*)&pu8TempUARTdata[0];
		uartTrans.count = 7;
        status = UART_read(handle, &uartTrans);
        if (status == 0 && pu8TempUARTdata[0] == 1)
            while (printidx<7)
                printf("Value at idx %u = %u\n", printidx, pu8TempUARTdata[printidx]);
        else if (status == 0 && pu8TempUARTdata[0] != 1)
            printf("Character missed/ Incorrect read\n");
            // while (printidx<7)
            // {
            //     printf("Value at idx %u = %u\n", printidx, pu8TempUARTdata[printidx]);
            //     printidx++;
            // }
            printf("UART Read Operation Failed\n");


  • Hi Sumedh,

    Can you please refer to below interrupt mode example in SDK and compare with your changes?

    AM273x MCU+ SDK: UART Echo Callback (



  • Hi Prasad,

    This example uses the callback option for write mode while I am using blocking mode. Other than that it's same

  • I also tried the default uart_echo_callback test. I got the following result

    I am sending [1 2 3 4 5 6 7 8] continuously over UART from MATLAB.
    I had modified the code to use a separate buffer for read operation. I am initializing the buffer as 0 before read operation. 

  • Hi Sumedh,

    The issue looks like is because you have printf in the target side code and it takes time to print on console.

    However the host side code is continuously sends the data.

    Can you remove the prints in the run time path where it is reading from uart and try to check in the code if you are getting the data correctly.



  • Hi Prasad,

    When I removed prints, I can read the data correctly once. 

    However, if I try running both matlab and example code continuously (only read operation in example code), I get a lot of incorrect reads. Does this have something to do with timing?

    I am doing a buffer check in the code to determine if the entire buffer has been read correctly and just printing correct/incorrect once in the console for every read operation

  • Hi Sumedh,

    In the PC side code you are sending the UART data continuously but on the target side you have some logic after receiving each set of data also you have a print for each operation correct/incorrect. During this time PC side code will keep sending the data.

    This will cause the sync to be lost between the master and slave and you see the data mismatch as there is no hardware sync between the sender and receiver.

    Either you initiate a transfer request with single request using a bigger buffer at the target side or have some delay at the PC side code after each iteration when your target side code is processing.

    Also Do not have prints in each iteration as the prints will take significant amount of time. You can use some other logic to determine the data consistency like store the result in some variable to get how many times you see mismatch and print at the end.



  • Hi Prasad,

    Based on your suggestions, after increasing the read buffer size, the example code works.

    We are testing an integrated sensor on our radar. It will continuously transmit data at 100 Hz over uart. If I try to read and process data in PDK, I can do it successfully with correct readings. The same however, fails for the MCU+. I am using UART interrupt callback mode in MCU+.

    The information packet from the sensor is 19 bytes. In UART, I read 37 bytes and perform a correctness check on the first two bytes of the packet (the first 2 bytes from the sensor are always same). In almost all of the cases this fails. In some cases it will pass but the actual data would be wrong. The same however works in the PDK.

    What could be causing this issue?

    Polling mode for the same test case works perfectly in MCU+. However, we cannot use this as this severely reduces our processing speed.

  • Hi Sumedh,

    Your PC side app is sending data continuously over uart right? or it is sending at 100 Hz?

    Can you update your PC side app to send some bytes every 100Hz as you require in real use case and check if you still see the issue?

    And also what is the baudrate you are configuring?