Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Conversation

agalliazzo
Copy link

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...
}

comunication and added an event (processed like SerialEvent) for a tx
finished interrupt.
@alexsandrino
Copy link

Hi, very good work! I have try it on mega2560 and It works very well.
You know if is it possible to use it on Arduino Due SAM3X8E ?

Thanks a lot!
Alex

@agalliazzo
Copy link
Author

Hi Alex, I leave the development of HardwareSerial... I saw that the
comunity is not so much interested in 9bit serial so I never go ahead in
testing with new versions of arduino... I never read the SAM3X8E datasheet
but maybe the library should work...
Bye
Alessio

2014-04-14 22:34 GMT+02:00 alexsandrino notifications@github.com:

Hi, very good work! I have try it on mega2560 and It works very well.
You know if is it possible to use it on Arduino Due SAM3X8E ?

Thanks a lot!
Alex


Reply to this email directly or view it on GitHubhttps://github.com//pull/1221#issuecomment-40414666
.

Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.
- Brian W. Kernighan

@matthijskooijman
Copy link
Collaborator

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.

@bluesign2k
Copy link
Contributor

@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.

@Bouni
Copy link

Bouni commented Aug 11, 2014

Hi,

As @matthijskooijman mentioned I've created the 9-bit version of the HardwareSerial.
I decided that using 2 bytes of the buffer for the 9-bit case would be a good practice because it doesn't add costs for those users who use the normal < 9-bit modes. But I've only modified the 1.X branch.
If I do the same changes for the 1.5.X branch, would there be a chance to get it merged?

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
[2] USART, page 775

@bluesign2k
Copy link
Contributor

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.

@ArduinoBot
Copy link
Contributor

Can I build this pull request?

@agalliazzo
Copy link
Author

Sure but is an old release... You could only replace HardwareSerial.cpp and
HardwareSerial.h in the arduino library folder

Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.
- Brian W. Kernighan

2014-08-22 13:52 GMT+02:00 ArduinoBot notifications@github.com:

Can I build this pull request?


Reply to this email directly or view it on GitHub
#1221 (comment).

@ffissore
Copy link
Contributor

@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

@CrabbyPete
Copy link

What happened with this?

@Bouni
Copy link

Bouni commented Feb 24, 2015

I modified the Hardware serial for 1.0.X and 1.5.X and submitted pull requests for both:

#2291
#2292

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

facchinm pushed a commit to arduino/ArduinoCore-avr that referenced this pull request Nov 13, 2017
@facchinm
Copy link
Member

Superseded by #2291

@facchinm facchinm closed this Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: HardwareSerial The hardware serial functionality of the core libraries feature request A request to make an enhancement (not a bug fix)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants