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

Xavi92
Posts: 45
Joined: Thu Mar 28, 2019 2:26 pm

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

Postby Xavi92 » Wed Apr 08, 2020 2:13 pm

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.

tommeyers
Posts: 184
Joined: Tue Apr 17, 2018 1:51 pm
Location: Santiago, Dominican Republic

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

Postby tommeyers » Wed Apr 08, 2020 5:09 pm

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
IT Professional, Maker
Santiago, Dominican Republic

Xavi92
Posts: 45
Joined: Thu Mar 28, 2019 2:26 pm

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

Postby Xavi92 » Thu Apr 09, 2020 9:23 am

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

Xavi92
Posts: 45
Joined: Thu Mar 28, 2019 2:26 pm

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

Postby Xavi92 » Mon Apr 20, 2020 7:42 am

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

User avatar
parthbhat13
Posts: 8
Joined: Wed Oct 07, 2020 2:07 pm

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

Postby parthbhat13 » Thu Apr 07, 2022 3:10 pm

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

joaomanfroi
Posts: 2
Joined: Wed Sep 28, 2022 2:08 pm

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

Postby joaomanfroi » Wed Sep 13, 2023 7:42 pm

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

Who is online

Users browsing this forum: No registered users and 54 guests