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/PROCESSOR-SDK-AM335X: PDK UART driver problem

Part Number: PROCESSOR-SDK-AM335X


Tool/software: TI-RTOS

When I use readTimeout, The logic of UART will confusion。The readTimeout is used to UART_osalPendLock().

If the Task run becaues Semaphore timeout.  Before the Task disable the receive interrupt, the INT have trigger. In the INT, it will use the UART_osalPostLock().

Now, it no tast to pend the semaphore, so the semaphore can use.

Then,the next time to receive data. When use UART_osalPendLock(), It finds the semaphores is available,so the Task continues to run.The semaphore not block the task.

Now, we use the UART, we will find the UART is being used. The mode is not the blocking mode.

  • Which Processor SDK RTOS version are you using?

    Best Regards,
    Yordan
  • ti-processor-sdk-rtos-am335x-evm-05.00.00.15-Windows-x86-Install.
    bios_6_52_00_12.
  • Just.wang,

    I am not sure that I completely follow what you are trying to bring to our attention here. Can you please clarify.

    The readTimeout condition is provided so that the Task performing UART transaction doesn`t pend on the UART transfer infinitely and that there is a way to exit a transfer API if the transfer doesn`t occur in a given amount of time. If the interrupt occurs then the semaphore is posted and no longer needs the timeout condition as the transfer occurred. The timeout timer condition will restart next time the API is called.

    Is this your understanding as well? Given this information do you still think that there is an issue with the implementation ? If yes, then please elaborate or provide an example where this timeout will not work as expected.

    Regards,
    Rahul
  • I set the readTimeout to 3, it`s mean timeout is 3 milliseconds. The mode is blocking. Every time to receive 10 bytes.
    Use tool in PC to set the serial port sends data every 10ms, each time 10 bytes.
    Look down, I add a breakpoint in ret = -1. The task can stop when return from UART_read() is -1.
    whlie(1)
    {
    ret = UART_read(handle, buff, 10);
    if(ret == -1)
    {
    ret = -1;
    }
    }
    After running many times,you will found the task stop in ret = -1.
    When UART_read() return -1?
    Look the function, i find it will return -1 when the UART in used.

    The probability of this problem is not high, it is recommended to try several times. If you find this problem, please look at my question again.
  • Hi,Rahul

    I think this problem is a bug in PDK. And the problem is due to the use of semaphores.

    semaphores timeout -------> disable interrupt.
    This is the ideal situation. But in practice, we will find the interrupt can be trigger between of them, because there are several lines of code in the middle. And that's the order.
    semaphores timeout -------> interrupt trigger -------> disable interrupt.
    It is important that the interrupt can post semaphores if completion of reception in this interrupt . But no task is waiting for this semaphore,because the timeout. This results in the next pend semaphore being obtained directly. So the semaphore not block the task.

    I hope you can pay attention to it,thanks.

    Best Regards,
    Just
  • I have reported this problem into the development team and we will try to incorporate a corner test case to test for this scenario based on your explanation. This currently not planned for 1Q19 so you will need to take neccessary precautions at application level.

    thanks for your explanation for other community users to be aware of this issue.

    Regards,
    Rahul