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

Bluetooth SDK Forum Discussions

ToKo_4602001
Level 4
Level 4
50 sign-ins 25 replies posted 25 sign-ins

How could we know if UART tx buffer is empty or not?

If wiced_hal_puart_write() is issued and soon baudrate is changed with wiced_hal_puart_configuration(), baudrate will be chaged in the middle of transmitting data.

Especially, we should consider baudrate change during UART flow control.

So we'd like to wait until all buffered data output to UART.

Regard,

0 Likes
1 Solution

Hi,

That's because baudrate configuration overrides data transfer because they are controlled by different units that cannot detect each other. You have to develop your mechanism to avoid this kind of confliction.

Best regards

View solution in original post

0 Likes
3 Replies
Charles_Lai
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 100 replies posted

Hi,

It seems the APIs don't cover your needs exactly. But I suggest you may try the following function:

void wiced_hal_puart_synchronous_write ( UINT8 * buffer, UINT32 length)

It is a blocking function and it makes sure your data will go into FIFO before returning from it. So I think It can help you with what you need.

Best regards

0 Likes

Thank you for your suggestion.

I tried wiced_hal_puart_synchronous_write().

But unfortunately I find that this function is not blocked.

If I change baudrate by using  wiced_hal_puart_configuration() after issuing wiced_hal_puart_synchronous_write(), baudrate is changed during data transmitting.

Thanks,

0 Likes

Hi,

That's because baudrate configuration overrides data transfer because they are controlled by different units that cannot detect each other. You have to develop your mechanism to avoid this kind of confliction.

Best regards

0 Likes