-
Notifications
You must be signed in to change notification settings - Fork 8.3k
modem: backend: uart: Add hw-flow-control for UART #87642
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
modem: backend: uart: Add hw-flow-control for UART #87642
Conversation
|
Ping @SeppoTakalo |
1ccdaed to
91d81e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you try making the receive buffers smaller in the uart backend test suite
| static uint8_t backend_receive_buffer[4096]; |
| ret = modem_pipe_receive(pipe, receive_buffer, sizeof(receive_buffer)); |
I have a suspicion bytes may be lost by disabling RX outright rather than using flow control (as disable may flush the rx buffer) :)
|
I tried this a little bit. Using nRF9151, I'm now able to reliably use 1 Mbit/s baud rate on the serial port without losing data on serial buffers. |
|
@bjarki-andreasen, sorry about bit of a delay. Currently the test does not actually test flow control and I don't think that I can change it as I do not believe that there are devices in the CI infrastructure that would have the suitable wiring. I tested this manually in MarkusLassila#1. With hw-flow-control enabled, no data is dropped. The RX buffers are not flushed when UART is disabled. |
91d81e5 to
23a3b09
Compare
bjarki-andreasen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please cherry pick updated test from #89250 and add a test case which enables the new CONFIG_TEST_HW_FLOW_CONTROL option.
7cae5c3 to
a0f7c88
Compare
Update the board overlays to support hardware flow control for testing. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
Extend test modem uart backend test suite to support testing hw flow control, which is performed by using a small receive buffer for the modem uart backend, and slowing down the read of received data, ensuring the buffer will be overrun if hw flow control is not working. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
a0f7c88 to
68ff3e4
Compare
|
@bjarki-andreasen: For whatever the reason, it does not seem that the CI ran the modem.backends tests. |
68ff3e4 to
994aa6c
Compare
|
ping @SeppoTakalo @tomi-font |
tomi-font
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed all but modem_backend_uart_async_hwfc.c. Looks good overall, just some minor remarks.
994aa6c to
efed65e
Compare
ce08cc4 to
307bdc1
Compare
Add Asynchronous UART implementation, which does not drop data when automatic hardware-flow-control is set in the device tree. With automatic hardware flow control, the CTS pin will be automatically deactivated when there are no more asynchronous UART RX buffers available. After buffer space becomes available, and UART RX is restarted, the CTS pin will be activated. Signed-off-by: Markus Lassila <[email protected]>
307bdc1 to
e7dfa4c
Compare
|
@tomi-font, @SeppoTakalo: Seems that a minor change dismissed your reviews. Apologies. |
Add Asynchronous UART implementation, which does not drop data when automatic hardware-flow-control is set in the device tree.
With automatic hardware flow control, the CTS pin will be automatically deactivated when there are no more asynchronous UART RX buffers available. After buffer space becomes available, and UART RX is restarted, the CTS pin will be activated.