-
-
Notifications
You must be signed in to change notification settings - Fork 87
Adding 9-bit support to the hardware serial UART #379
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
Open
vashadow
wants to merge
7
commits into
arduino:main
Choose a base branch
from
vashadow:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+21
−1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added to write function declarations for functions being added to the serial.cpp to support the 9-bit functionality of the processor. The "bool wake" allows turning on the 9-bit, also known as the wake bit.
Loading status checks…
Add two functions and the supporting 9N1 case logic to allow for turning on 9-bit support and sending commands. The second argument, bool, allows for turning on or off the 9th bit, also known as the wake bit. Serial1.begin(19200, SERIAL_9N1); Serial1.write_9bit(0x81, true); Serial1.write_9bit(&temp[1], false, len - 1);
The git tests will fail until the pull request "Added 9N1 support to HardwareSerial.h #238" on the ArduinoCore-API side is approved and merged. |
Loading status checks…
I removed two unnecessary functions that I added with this pull request to turn on 9bit. There was a little code cleanup /refactoring.
Loading status checks…
I removed functions that are unnecessary for the 9-bit code to work.
Loading status checks…
Publish 1.2.2
Loading status checks…
Loading status checks…
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The new UNO R4 WIFI supports 9-bit operations on the hardware UART as per page 28.2.6 of the Renesas RA4M1 Groups: User Manual: Hardware.
https://forum.arduino.cc/t/9-bit-uart-is-built-in-to-the-new-ra4m1-chips/1310858
There has also been a pull request to the API HardwareSerial.h file to allow for 9N1. These changes effectively put the UART into 9-bit mode and allow transmitting from the UART TDRHL 16-bit register with and without the 9th bit (wake bit) being set.
The second argument allows for turning on or off the wake bit. TRUE = wake bit set to 1 FALSE = wake bit set to 0
Example command use:
Serial1.begin(19200, SERIAL_9N1);
Serial1.write_9bit(temp[0], true);
Serial1.write_9bit(&temp[1], false, len - 1);
UPDATE:
Removed the write_9bit commands in favor of using the native write command in byte array mode:
uint16_t d[] = {0xFF01, 0xFC8A, 0xFC00, 0xFC23};
Serial1.write((uint8_t *)d, sizeof(d));