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.

RTOS/AM5728: UART read issue

Part Number: AM5728

Tool/software: TI-RTOS

Hi

I am using UART_readPolling function while reading uart data. But UART_readPolling will not return until size data was read to the UART so i need to use UART_CMD_GETRXCOUNT in the UART_control function before UART_readPolling. However in this case this function always return 0.

I am currently running on sdk-rtos-am57xx-evm-02.00.02.11. And this is the default code in the uart driver.

static int32_t UART_control_v0 (UART_Handle handle, uint32_t cmd, void *arg)  /*for misra warnings*/
{
    return(0);
}

Also sdk-rtos-am57xx-evm-04.01.00.06 have same dafult code. As a solution of this problem UARTTiva.c is used. (https://e2e.ti.com/support/embedded/tirtos/f/355/t/422623) Can I use this function in same manner in my own SDK. If not what should i do? I asked these questions because in the case of cutting the uart connection as a result of any problem, task is stop the running and it could not pass the other task.

Regards.

  • The RTOS team have been notified. They will respond here.
  • Bilal,

    Note that AM572x SOC uses the v1 version of the driver and not v0. However, the answer for both the versions of the driver is currently the same. We don`t support UART_control in current implementation so UART_CMD_GETRXCOUNT will not help you get this functionality.

    If you cut the UART connection there are two options of handling this scenario. There is a dedicated Time-out and connection break interrupt for UART on this device which can be used.

    From SW perspective, you can use a SW timeout to recover from this condition and call UART_canelRead and UART_close and re-open UART instance?

    Regards,

    Rahul

  • Hi Rahul,

    I am newly about working on RTOS. So i need some more explanation. I am also working on software interrupt solution. Your two scenarios are seems to be very reasonable. But could you please share with me some example codes or information about applications of these two options so that i can use them in my project.


    Regadrs,
  • the example for timeout and Read Cancel is provided with the UART LLD driver examples in PRSDK. Please install the Processor SDK RTOS and generate the CCS project using pdkProject create for the UART Examples.

    The example that has the relevant code is called UART_BasicExample_idkAM572x_DMA_armTestProject. Refer to the test for the following TEST IDs: UART_TEST_ID_DMA_TO, UART_TEST_ID_TO and UART_TEST_ID_CANCEL

    Regards,
    Rahul
  • Hi Rahul,

    I solved this problem. Thank you for your answers