Post Go back to editing

UART API driver for bf70x: callback events

What is the difference between ADI_UART_EVENT_TX_BUFFER_PROCESSED and ADI_UART_EVENT_TX_COMPLETE to be checked inside the UART callback? I've noticed that only ADI_UART_EVENT_TX_BUFFER_PROCESSED happens supposedly at the end of a transmission. Does this corresponds to the completion of the transmission process? Can I safely close UART driver once this event occurs?

Thanks for you help,

Chiara

  • Thank you for your answer.

    In my test I transmit a 4-bytes buffer, ADI_UART_EVENT_TX_BUFFER_PROCESSED occurs and via the callback argument I can verify that the correct buffer is processed.

    With the oscilloscope I see that the buffer is transmitted correctly but the ADI_UART_EVENT_TX_COMPLETE  never occurs. Why is so?

  • Hi Chiara,

    ADI_UART_EVENT_TX_BUFFER_PROCESSED - The given Tx buffer is processed.
    ADI_UART_EVENT_TX_COMPLETE  - Completed sending out the data from device buffers

    Submit buffer function should be called at least once before enabling the data flow. At most two buffers can be submitted before getting a processed buffer. The processed buffer can be obtained using adi_uart_GetTxBuffer (in case of no callback is registered) or via the callback as callback argument to the ADI_UART_EVENT_TX_BUFFER_PROCESSED event. Once a processed buffer is received a subsequent buffer can be submitted.

    Please refer the below given help path for more details :
    CrossCoreRegistered Embedded Studio 2.6.0 > System Run-Time Documentation > System Services and Device Drivers > ADSP-SC58x (SHARC+ Core) API Reference > Modules>UART Device Driver

    Also you can refer the source file from the below path :
    <drive>\Analog Devices\CrossCore Embedded Studio 2.6.0\SHARC\lib\src\drivers\Source\uart

    Regards,

    Kader

  • Hi Chiaro,

    To assist you further can you please share us your project along with the steps to reproduce the issue

    Regards,

    Kader

  • Hi Kader, 

    in attachment a test project. You can simply run it: i've put some print in the callback events. (Loopback is enabled for RX but the same happens with a real receiver)

    A buffer is transmitted and correctly received but ADI_UART_EVENT_TX_COMPLETE is never happening.

    I'm using BF707 in BLIP2 board.

    Best regards,

       Chiara

    uart-test.zip
  • Hi Max,

    No I got no answer on this. As a workaround I did put a hardcoded delay after each "start transmission" so that there is enough time for it to complete before shutting everything down (I was having problems with long buffers). I'm aware that it's not a nice solution but for now it'll do.

    I'm open to suggestions for better approaches though

  • Hi Chiara,

    Did you manage to solve your ADI_UART_EVENT_TX_COMPLETE problem? I am encountering the same problem as you have.

    The ADI_UART_EVENT_RX_BUFFER_PROCESSED and ADI_UART_EVENT_TX_BUFFER_PROCESSED events do occur. But the ADI_UART_EVENT_TX_COMPLETE never happens while the buffer is fully processed.

  • Hi Chiara,

    To bad that it hasn't been solved yet... My work around is waiting till the UART Tx status has changed to done. Sadly this is blocking, but for now it works.

    This is how (for a SC58x processor at UART0):

    while((*pREG_UART0_STAT & BITM_UART_STAT_TEMT) == ENUM_UART_STAT_TX_NOT_DONE);

  • I don't know if you still need this but I contacted private support and they confirmed it is a known bug. It should be fixed in a future release of CCES.

    In the meantime there is a quick fix:

    The macro definition for ADI_UART_NO_EVENT is given wrong in the "adi_uart_def_bf60x.h" file, it is given as below,

     

    #define ADI_UART_NO_EVENT           0xFFFFFFFFu

     

    You would fix this as,

     

    #define ADI_UART_NO_EVENT           0u

     You can find adi_uart_def_bf60x.h file in <CCES path>\Blackfin\lib\src\drivers\source\uart\.