-
-
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
HardwareSerial modifications #1221
Conversation
comunication and added an event (processed like SerialEvent) for a tx finished interrupt.
Hi, very good work! I have try it on mega2560 and It works very well. Thanks a lot! |
Hi Alex, I leave the development of HardwareSerial... I saw that the 2014-04-14 22:34 GMT+02:00 alexsandrino notifications@github.com:
Debugging is twice as hard as writing the code in the first place. |
IIRC this pullrequest has been discussed on the mailing list, but since it doubles the buffer size even if not using the 9-bit mode, it's unlikely it will be merged. There was also a post about https://github.com/Bouni/Arduino/tree/hardware-serial-9bit, which adds 9-bit support by using two bytes per character, which is probably a better approach. |
@alexsandrino having recently spent quite a bit of time going through the SAM3X8E datasheet looking to improve the Due's various serial libraries I can confirm that as it stands, these modifications will not work on the Due. Using 9-bit on the Due is something I'm looking into. A less resource hungry implementation that I've seen mentioned somewhere could be to use two consecutive bytes in the buffer rather than making the buffer be uint16_t. |
Hi, As @matthijskooijman mentioned I've created the 9-bit version of the HardwareSerial. I've just looked at the SAM3X8E datasheet, the UART section [1] does not describe anything about the possible bit modes. But the USART is capable of 5 to 9 bits [2]. So i think i should be able to get the 9-bit changes done for both platforms! Can anybody with SAM3X8E experience tell me if that UART is just for special purposes!? [1] USART, page 755 |
The UART isn't for special purposes as such, its just that it only supports the more standard setups ie 8-bit and some parity options. The USART module allows for much more flexibility. FWIW, I submitted a pull request a while ago (#2006) that enabled the use of the extra modes and prepared for 9-bit mode but I never found a way to prevent illegal configs at compile time. |
Can I build this pull request? |
Sure but is an old release... You could only replace HardwareSerial.cpp and Debugging is twice as hard as writing the code in the first place. 2014-08-22 13:52 GMT+02:00 ArduinoBot notifications@github.com:
|
@agalliazzo sorry for the comment from arduinobot. we are setting up automated build of all PRs, so that we can provide a downloadable version of the patched IDE |
What happened with this? |
I modified the Hardware serial for 1.0.X and 1.5.X and submitted pull requests for both: But nothing happened since then, which is a little disappointing :( If you need 9-bit serial for your projects, you can clone my repo and use that: https://github.com/Bouni/Arduino/tree/ide-1.5.x-hardware-serial-9-bit |
Squash and rebase of arduino/Arduino#2291 Supersedes arduino/Arduino#1221
Superseded by #2291 |
Added the possibility to configure the hardware serial port for 9 bit comunication and added an event (processed like SerialEvent) for a txfinished interrupt (usefull if you're using the serial port with a rs485 transceiver to drive RE/DE line).
I've tested the modifications with an arduino mega2560 and a pic microcontroller as a receiver with Serial1.
for use the txFinished event you should have a function like this:
void transmissionFinishedEvent1(){
doSomething...
}