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

Adding 9-bit support to the hardware serial UART #379

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vashadow
Copy link

@vashadow vashadow commented Oct 5, 2024

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.

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);

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.
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);
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Oct 5, 2024
@vashadow
Copy link
Author

vashadow commented Oct 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants