Hi all,
I’m developing firmware using USB CDC with UART async API to transmit data at about 102 kB/s. However, during uart_tx() calls, I often get a -16 error (EBUSY). Sometimes the transmission succeeds after several retries.
Here’s my setup and logic:
-
Bluetooth (NUS service) receives about 204 bytes every 2 ms.
-
After receiving data, I push it into a message queue (k_msgq) for the UART TX thread.
-
The UART TX thread retrieves data from the queue and immediately calls
uart_tx(). -
After sending, the thread waits about 1 µs before checking the queue again.
Issue:
-
uart_tx()frequently returns -16 (EBUSY). -
Sometimes it takes several retries before the data can be sent successfully.
Question:
-
What is the most likely cause of the frequent
-16errors in this async setup? -
Is there a recommended way to manage continuous data transmission via USB CDC (UART async) to avoid TX busy states?
Thank you for your support!
Best Regards!
Ben