-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Zephyr UART transport does not works with CDC ACM transport #409
Comments
Hi eRPC user. Thank you for your interest and welcome. We hope you will enjoy this framework well. |
Hi @gabbla , thank you for your inputs. I don't have skills with Zephyr, but i think your requested changes are not good. If i understand you correctly you mean that buffer in second case contains header+body. In first case header and body comes as two messages correct? |
Hi @Hadatko, thank you for the quick replay. Yes, while using CDC the buffer is filled immediately with header + body, meanwhile using the UART the header and body came byte by byte (on my platform). Platforms with bigger UART FIFO (in hardware) may rise an interrupt when they have more than a single byte ready to be read (similar to what is happening with CDC). My change should cover all cases, because if the condition
is false, that means we already have all the bytes we need, otherwise we need to wait. So it should not matter if we waited the semaphore or we already had all the bytes, erpcStatus should be kErpcStatus_Success in both cases. Or am I missing come cases?
I do not understand what do you mean with
Can you please elaborate? Gab |
transport: fix zephyr uart transport. See #409
Hi @gabbla, thank you for your contribution. Upon reviewing the bug, I think that the pull request from @gabbla is fine. In the interrupt, I am using the |
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 theuart_receive_buf
is not yet filled with the needed bytes, so it waits on a semaphore and only after the get theerpcStatus
is marked as success. However, when theuart_receive_buf
already has the needed bytes, theerpcStatus
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
The text was updated successfully, but these errors were encountered: