-
-
Notifications
You must be signed in to change notification settings - Fork 7k
9-bit frame support to Hardware Serial 1.0.X #2292
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
Conversation
Can one of the admins verify this patch? |
I like the idea but would rather use templates for this. Because as it is right now it adds more flash to the serial. And its not likely that people will use this 9 bit more, even though its really cool. So in my opinion the whole Serial should be reworked as template, but they wont accept this anyways I guess. |
Unfortunately i have no idea how to use templates to achieve this :-/ |
FYI: I also found this: |
@NicoHood |
Well this now also applies to your code, as I've checked it. I am currently working on a basic setup to send 9N1 bytes. I got it working with 8N1. with 9N1 as sending setting and 8N1 as receiving setting I still get the lower 8 byte of data. Is this a normal behaviour? the extra bit is just thrown away as far as I can see. |
I think I've missed it. Thanks. Edit: but you could test a simple hello world print with 8 bit compared to the 9 bit. It would be nice to know how much overhead of ram and flash this takes. (for 1.6.x of course). |
@NicoHood you mean compare the standard Arduino IDE to my extended 9-bit version? |
Yes. But with the 1.6.x release. So we can see if it adds much overhead if this would be merged. IDE 8N1 with ram and flash usage. |
@NicoHood Can you explain how I can get the RAM and Flash usage? |
Its displayed after compiling. |
@NicoHood Ok, i did a few tests: i compiled SerialCallResponse.ino with 4 different Arduino setups using the CLI (except for 1.0.5)
Arduino 1.0.5 (master branch at the time i did my modifications)
Arduino ide-1.5.x (for comparison to 1.0.5)
Arduino ide-1.5.x-hardware-serial-9-bit
Arduino 1.6.4 (current version installed from arch linux AUR repo)
|
Those results are unclear to me. What is 1.5.x? What exact version did you use here? And what serial setting? 8N1 or 9N1? You have to tell me the Serial setting, otherwise it doesnt make any sense. I personally also do not care about 1.0.5 at all. You need to test all 3 that I listed above with 1.6.4 (or 1.6.5). IDE 8N1 vs PR 8N1 tells us how much overhead this PR gives us when its just implemented. If nobody uses those 9N1 function he also has the delta in his sketch. If this delta is too big its not worth to merge the PR. PR 8N1 vs PR 9N1 tells us if using 9N1 with the PR already enabled gives us even more overhead. But my guess is that there is no more overhead. |
@NicoHood post code snippet(s) you want to have compiled and i'll do it for 1.6.4, and the Pull request!
|
A simple Serial.begin(9600, 8N1) in setup() and a Serial.println("Hello World"); delay(1000); in the loop() should do it. |
Closing as 1.0.x branch is in maintenance mode only. |
I've added support for sending and receiving 9-bit frames for AVR based boards.
The changes are tested with a test sketch [1] and also with a logic analyzer (Saleae Logic 8).
I use two bytes in the buffer for storing a 9 bit frame. So i don't have to change the buffer type to uint16_t which means that all other modes then 9 bit don't waste RAM. The only downside for 9 bit users is that the buffer has only half the size.
[1] Test Sketch