-
Notifications
You must be signed in to change notification settings - Fork 3k
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
UARTSerial enhancement request: flow control #4428
Comments
cc @hasnainvirk @kjbracey-arm |
@RobMeades Yes this work item is on the to-do list. We are even thinking a step further:
@kjbracey-arm will be the architectural planner. Thank you for highlighting this. |
Looking through the targets, it seems almost every target does implement the set_flow_control() API via hardware assist, so maybe we don't need to worry about software-controlled version in the first pass. However, XON/XOFF could be useful for the cases where RTS and CTS aren't connected - which is actually quite common. So maybe we just don't bother with the middle case (RTS and CTS handled as GPIO). Step 1 is then pass through the set_flow_control, and modify the RX data pump to not read data when the buffer is full, so the RX HW flow control works. |
Sounds good to me. |
It would be good to get this flow control cooking, it might help with my attempts to run the modem interface at higher data rates. |
@kjbracey-arm: is it possible to get some idea when HW flow control might be available in a PR? I've some work that needs higher data rates that I can only realistically schedule with this in place. |
Not sure we've got the resource available to work on testing this at our end in the next couple of weeks. Seems like it should be basically making the Rx IRQ handling more similar to the Tx IRQ handling - IRQ handler can disable it, and foreground read routine re-enables it. If I knock out a quick patch proposal can you test it? |
Yup, absolutely. |
Try this. Untested apart from compilation. https://github.com/kjbracey-arm/mbed-os/tree/uartserial_flow |
Testing now, will continue via e-mail shortly. |
It occurred to me that it might get a bit stuck without the same basic "do it in the foreground" logic as TX. Extra tweak added to branch. |
ARM Internal Ref: MBOTRIAGE-330 |
Resolved via 5088 (referenced above) |
Description
Enhancement
#4119 introduced
UARTSerial
, which provides a very neat interface to buffered serial operations. One thing it is missing, though, is flow control. IfUARTSerial
receives data faster than it can get rid of it, characters are lost without notice. This is a particular issue when using therecv()
method of the equally newATCmdParser
with the serial stream, since thesscanf()
ing involved can take quite some time and could cause data loss, especially if there are out of band thingies to capture.All that is required is for
UARTSerial
to expose theset_flow_control()
bit ofSerialBase
, I think.The text was updated successfully, but these errors were encountered: