Page 1 of 1

Is it possible to support 9-bit multi drop bus on UART?

Posted: Wed Apr 08, 2020 2:13 pm
by Xavi92
Hello,

We are designing a device based on the ESP32 which acts as a bridge between devices using the MDB/ICP protocol. Tipically, a UART configured to support 9 data bits is used for this purpose, since the protocol defines a frame as:

Code: Select all

Start bit | Bits 0 to 7 | Mode bit | Stop bit
Where mode bit is 1 when address information is included and 0 for application data.
However, the ESP32 only supports up to 8 data bits, so it looks we are out of luck here. We have seen other devices which allow reusing the parity bit so it can be used as mode bit. Would that or other tricks be possible on the ESP32?

Thank you very much.

Re: Is it possible to support 9-bit multi drop bus on UART?

Posted: Wed Apr 08, 2020 5:09 pm
by tommeyers
If I needed to do this I would find a software serial library and modify it.

I assume you have searched for existing code.

A scope will make development easier.

Tom Meyers

Re: Is it possible to support 9-bit multi drop bus on UART?

Posted: Thu Apr 09, 2020 9:23 am
by Xavi92
Hello Tom,

You are completely right, a software-emulated UART would do the trick. I have been looking for implementations on the Internet, but most (if not all) are MCU-specific, so they would still need to be adapted to the ESP32.

Thanks a lot for your help,
Xavi

Re: Is it possible to support 9-bit multi drop bus on UART?

Posted: Mon Apr 20, 2020 7:42 am
by Xavi92
Another trick we came up that would allow a 9th data bit using the hardware UART is to reconfigure the parity on each byte. For example, if 9th bit == 1 and (data[0:7] & 1), odd parity is configured, and even parity is configured if !(data[0:7] & 1). A similar logic applies to 9th bit == 0.

While being more a hack than anything, is this method still valid for the ESP32? Should we expect any side effects because of configuring the parity bit so many times?

Thank you,
Xavi

Re: Is it possible to support 9-bit multi drop bus on UART?

Posted: Thu Apr 07, 2022 3:10 pm
by parthbhat13
Hey,
I wonder if you had any success with the same? its been a while even I am trying to do the same, found a solution on PicoVend but they have not shared anything. And i am not so found of using arduino to do my coding with the esp32. for now I am forced to use my go to AVR with esp32.



cheers!
Parth Yatin Temkar

Re: Is it possible to support 9-bit multi drop bus on UART?

Posted: Wed Sep 13, 2023 7:42 pm
by joaomanfroi
Hello, anything new on this research. I've been trying to use the parity bits but ESP won't let you read the data if there's a parity error