On the UNO R4 Wifi/Minima : Serial1.begin(9600, SERIAL_8E1) works fine . (As well as None, Odd Parity). But I can not use other databits than 8. Normally You could set between 5-8 databits here.
Will this be supported later ???
Also.. does anyone know what other commands could be used with Serial1 ?
I have the same problem with my UNO R4 Minima.
Trying to get Serial1 to transmit with SERIAL_7E1, but no such luck. The Arduino locks up every time.
To better understand what is happening and try different settings, Serial1 is connected to a PC (Win or Mac) with a USB-TTL adapter based on CH340 chip.
When receiving data in 7E1 from the PC, the Arduino will read single characters correctly. When trying to transmit data from the Arduino it will lock up every time, with or without the USB-TTL adapter connected to it.
I'm happy to start a separate thread with more details about what I'm trying to achive. But at this time I'd just like to second Christer_A1's question:
Do different No. databits work for Serial1 on the UNO R4? (More specifically SERIAL_7E1.)
If not, will this ever change?
Thanks. I also think that the hardware will support more than 8 bit. 7-9 bits !
There are many cases where 9bit support is needed.
In my case, several marine instrument systems use the 9bit as a separate signalling bit.
There are tweaks here for UNO R3 , ESP32.
Also Teensy support 9bit with a documented small change in a .h file.
It would be great if also UNO R4 could be used here.
On my machine this is the file: C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.2.2\cores\arduino\Serial.cpp
And if it works, then maybe someone can create a Pull request for the change.
Note: If it were me, I would probably also add a default:
line above the 8N1, such that if the format does not match any known ones, at least
the options are set to something...
EDIT: Should mention, I edited this on the fly, so could be typos or the like.
I Will do some more tests today.
And you are right, then it should be added to the official Core.
I am using Arduino as a small hobby so not the best person to do a Pull request. Never done before.
However if no one else…….I Will give it a try end of this month.
I did not add anything for 9 bit support. As there is no Arduino standard for this.
That is, it there are no modes defined in their API HardwareSerial.h file that supports
9 bits.
I also did not add anything, that does anything with all of the modes that the board
does not support, like 5 bit or 6 bit, or Mark Parity.
Hopefully that gives this PR a higher probability of being merged.
I hear you! My guess is that it is more of a long shot for Arduino to take in a PR
for the 9 bit code. That is I am not sure what they will think of the approach of passing in an array of bytes and assuming that the bytes in your array are in some specific order. (LSB or MSB...).
There are also issues, with API, as for example Serial1.write() only takes an 8 bit value...
Teensy We added another api: size_t write9bit(uint32_t c);
Also, when the 9 bit support was turned on: //#define SERIAL_9BIT_SUPPORT
Both the RX and TX queues were updated to hold 16 bit values (double the memory
usage).
Note: the API code is not setup to handle 16 bits. There are hacks around this, like take up two memory slots in the queue to hold the values. But then all sketches that process 9 bits would need to know to read two items... Or maybe the read method would need to know this, as well as the available and the peek methods...
Would mention the write and availableForWrite methods, but they are still not using
the queue that was defined within the object...
Stoffregan at Teensy wrote that 9 bit support is not in the standard core . You have to do a specified tweek and use a special api for TX of 9bit.
Double memory size and Legacy concern.
Once again Thank you for helping with this for UNO R4 !