Description
Describe the bug
Zephyr RTOS provides a transparent API to interact with physical UARTs and USB CDC ACM ones, so in theory one could create an UartTransport
with either one.
Using a physical UART with the mentioned transport works fine, however, when switching to a CDC ACM one, the server always returns 16 (kErpcStatus_ReceiveFailed
) after receiving an RPC call.
The issue resides in the UartTransport::underlyingReceive
function: the logic handles the case in which the uart_receive_buf
is not yet filled with the needed bytes, so it waits on a semaphore and only after the get the erpcStatus
is marked as success. However, when the uart_receive_buf
already has the needed bytes, the erpcStatus
is not updated and the read wrongfully fails.
erpc/erpc_c/transports/erpc_uart_zephyr_transport.cpp
Lines 154 to 182 in 85d3dd8
I believe this may fail in other context even with physical UARTs, but I was not able to validate the such statement.
I'm about to open a PR with a proposed solution.
To Reproduce
Simply create an erpc::UartTransport
using an USB CDC ACM node instead of a physical UART.
Expected behavior
The UartTransport should works with any kind of UART.
Desktop
The test were conducted with eRPC Version v1.12.0 using the python generated code for the client side and Zephyr v3.6.0-rc2 running on a NUCLEO-H563ZI.
Steps you didn't forgot to do
- I checked if there is no related issue opened/closed.
- I checked that there doesn't exist opened PR which is solving this issue.
Activity