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.

CC2652R7: UART Receive not working

Part Number: CC2652R7


Hi 

SDK Used : simplelink_cc13xx_cc26xx_sdk_7_10_01_24

Code Used : simple_peripheral_LP_CC2652R7_tirtos7_ticlang

We are using UART communication between processor and CC2652R7 MCU. We are using UART2.h library for UART interface.  Here "UART2_read" will be in blocking call. While transmitting data from Processor  we are able to receive using "UART2_read" API. 80% It is working properly. Sometime While transmitting data from Processor This "UART2_read" is not triggering to read the data but, while performing 2nd transmit from processor  we are receiving both the data . 

Example: 

1st Transmit from processor (20 bytes)  sent successfully - But Not received on MCU

2nd Transmit from processor (20 bytes)  sent successfully - Received together of both the data  (40 bytes )

Why sometimes It is happening like above scenario ? Please help us to solve this problem. 

UART Configuration Used in my code : 

UART2_Params params;

UART2_Params_init(&params);
params.baudRate = 115200;
params.readMode = UART2_Mode_BLOCKING;
params.writeMode = UART2_Mode_BLOCKING;

Uhandle = UART2_open(CONFIG_UART2_SOC, &params);
if(Uhandle == NULL)
{
gcam_printf(LOGE, "UART Open error ...!");
}

  • Hello Mohan Prasanna R

    I hope you are doing well. I think I had a similar experience with my own UART application, where I needed to clear the buffer, and flush the UART so the UART_read can read the data correctly. Could you try flushing your UART in your loops to see if that does anything? Otherwise we could try debugging, seeing why two packets are being received together. Your small UART snippet seems right. For more UART2 examples follow the code snippets in the "examples" in your syscfg (UART2.h File Reference). 

    Thanks,
    Alex F

  • Hi Alex,

    Thanks for your reply. Already I am doing that, after every read still we are facing the problem. Please do debugging and provide some solution for this .

    Snippet for Read :

    memset(pMsg_proces_buf, 0, MAX_SINGLE_PAYLOAD_SIZE);

    usBufflen = MAX_SINGLE_PAYLOAD_SIZE;


    status = UART2_read(Uhandle, pMsg_proces_buf, usBufflen, &usReadLen);
    if (status != PNRJ_GCAM_SUCCESS)
    {

    }

    UART2_flushRx(Uhandle);

  • Hello Mohan Prasanna R,

    Do you happen to have a PuTTY terminal that outputs the data? In my test earlier where I needed to enter my own data twice, I entered the data in via PuTTY and that is where I added the UART2_flushRx as well as setting the message buffer to zero (with memset). Below is an snippet of how I configured my own program. 

    What is the delay between sending the two pieces of data?

    Thanks,
    Alex F