I have an application where I need to implement 9 bit serial,
The device I'm trying to talk to uses 8 bit data with constantly changing parity as a method data validation.
I was looking at bit-banging but would rather hardware if possible due to more reliable comms.
I've attached an example of the serial stream I want to creat.
Thanks
9bit hardware serial is it possible
-
- Posts: 9725
- Joined: Thu Nov 26, 2015 4:08 am
Re: 9bit hardware serial is it possible
The ESP32 UART supports hardware parity. See the UART driver for more info.
Re: 9bit hardware serial is it possible
It doesn't support "constantly changing parity" though. If you notice the first byte is odd parity and the next two are even. I don't know if you could use the UART_TXFIFO_EMPTY_INT to change the parity mid frame.ESP_Sprite wrote:The ESP32 UART supports hardware parity. See the UART driver for more info.
Re: 9 bit hardware serial is it possible (Yes)
Constantly changing parity!?? Your example does show both odd and even parity in a single transmission.
OK, if that is what you want begin() with odd then send 1 char then begin() and change to even and send 1 char...
I suspect that the example is incorrect.
Tom Meyers
OK, if that is what you want begin() with odd then send 1 char then begin() and change to even and send 1 char...
I suspect that the example is incorrect.
Tom Meyers
IT Professional, Maker
Santiago, Dominican Republic
Santiago, Dominican Republic
Re: 9bit hardware serial is it possible
9N1 has a history in Arduino.
I googled Arduino 9N1 and found a lot of information.
What I learned was that 9N1 is not uncommon and sometimes implemented in the UART so the first step could be to check the esp32 uart capability. Life will be easier if the UART has the capability.
The solution I suggested, above, still might work for sending 9bit data.
Tom Meyers
I googled Arduino 9N1 and found a lot of information.
What I learned was that 9N1 is not uncommon and sometimes implemented in the UART so the first step could be to check the esp32 uart capability. Life will be easier if the UART has the capability.
The solution I suggested, above, still might work for sending 9bit data.
Tom Meyers
IT Professional, Maker
Santiago, Dominican Republic
Santiago, Dominican Republic
Re: 9bit hardware serial is it possible
It might work if you send one byte at a time but if the delay between bytes is too long the other device might consider it a framing error.
Re: 9bit hardware serial is it possible
Thanks for the replies so far
Yes the data is 100% correct and is not corrupt.
I've tried sending the data by sending 1 byte then changing parity then sending the next but framing errors occur as you predicted
Yes the data is 100% correct and is not corrupt.
I've tried sending the data by sending 1 byte then changing parity then sending the next but framing errors occur as you predicted
-
- Posts: 9725
- Joined: Thu Nov 26, 2015 4:08 am
Re: 9bit hardware serial is it possible
FWIW, if you go the bitbanging route, you may be better off abusing the RMT peripheral as it'll handle all the timings for you.
Who is online
Users browsing this forum: No registered users and 70 guests