-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Add isFlushed() method to HardwareSerial class for AVR and UARTClass for SAM #3737
Conversation
@PaulStoffregen @matthijskooijman Matt, you were right about the AVR code, should be fixed now. Everything is in one nice commit now as well. |
I believe the AVR code still has a race condition. Note that |
At this point I've spent way too much time on this. If someone wants to On Thu, Aug 27, 2015 at 9:24 AM, Matthijs Kooijman <notifications@github.com
|
If you do work on this more, I highly recommend connecting a MAX483 or similar chip. Just a little code after writing data should poll isFlushed() and de-assert the driver enable pin. If you monitor the chip's output, you'll be able to very easily tell if you're truncating the data. Or the same could be accomplished with a logic OR gate, or with a digital oscilloscope and no extra circuits at all. |
Also, if you want some other code to look at, my HardwareSerial code for Teensy has an extension called transmitterEnable(pin), which causes it to generate the driver enable control signal for those common RS-485 chips. Teensy has provided this feature for years. I have personally used it in projects and so have hundreds of other people, so I can say with very good confidence it has correct timing on controlling that pin on both AVR and ARM chips. |
Have a Due and a SP3485, going to do this within the hour actually. Don't On Thu, Aug 27, 2015 at 9:45 AM, Paul Stoffregen notifications@github.com
|
@thatcadguy, regarding the AVR code, I think (based on the current
I don't have time right now to actually test this, but perhaps you can put the above line in your PR for anyone else to test? And thanks for investing some time in the AVR part, even if it doesn't interest you directly! :-) |
@matthijskooijman Updated. I tested the SAM code on the Due today, works fine. |
Add isFlushed() to HardwareSerial class for AVR and to UARTClass class for SAM. This provides a non-blocking way to check if the transmit buffer is flushed.
Just rebased this in case anyone merges it soon. |
@cmaglie Hi, is there something else my branch needs to get merged? I'd like to see this get merged soon. |
I know its only being picky, but what about simply |
@Chris--A If that's what it takes to get this merged, then sure. |
Partially moved to arduino/ArduinoCore-sam#7 |
Closing because this hasn't been acted upon in 2 years. |
Please reopen and merge this commit. We need isFlushed() method for non-blocking Serial.write() on half duplex communication (such as RS485). Thanks. |
This is no longer the right place for this PR. To have it merged, it should be resubmitted to the ArduinoCore-avr repo (if not already done, for ArduinoCore-sam there seems to be arduino/ArduinoCore-sam#7). Also, any discussion about adding this method more generally into the Stream class (which might be appropriate), would need to happen in the ArduinoCore-API repo probably. |
Needed a non-blocking way to check if the transmit buffer was flushed/clear. This is a re-request because I stink at Git, original request was #3589. Sorry!