Equivalent of blecm_getAvailableTxBuffers() for UART TX FIFO ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

What is the equivalent of blecm_getAvailableTxBuffers() for UART TX FIFO ?

How do I know how many bytes are currently available in 16 bytes TX FIFO before using e.g. puart_write function ?

P_UART_TX_FIFO_IS_EMPTY() macro only checks if TX FIFO is empty.

0 Likes
1 Solution
asridharan
Employee
Employee
10 comments on KBA 5 comments on KBA First comment on KBA

There is no API to get the number of bytes (or free bytes) in the TX FIFO. Even if there was one, the value returned will be invalid as soon as it is read from the HW block because the HW runs its own TX state machine and will stream the bytes out as long as the FIFO is non-empty. So any value read by such API will be stale. The only steady-state value is FIFO empty. Or the interrupt that it has reached the set watermark (which can be between 0 and 15 both included). See discussion mwf_mmfae linked to above.

View solution in original post

2 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

Have you checked this thread: UART Routines

0 Likes
asridharan
Employee
Employee
10 comments on KBA 5 comments on KBA First comment on KBA

There is no API to get the number of bytes (or free bytes) in the TX FIFO. Even if there was one, the value returned will be invalid as soon as it is read from the HW block because the HW runs its own TX state machine and will stream the bytes out as long as the FIFO is non-empty. So any value read by such API will be stale. The only steady-state value is FIFO empty. Or the interrupt that it has reached the set watermark (which can be between 0 and 15 both included). See discussion mwf_mmfae linked to above.