I want to connect an esphome device to an rs485 bus that uses 9 data bits. This is supported by the Arduino hardware serial, but not by esphome. Are there any ways to make it work?
uart: [source ventilatie.yml:39]
- id: bus
tx_pin: GPIO22
rx_pin: GPIO21
baud_rate: 9600
value must be at most 8.
data_bits: 9
stop_bits: 1
parity: none
debug:
direction: BOTH
Not the OP, but I have been working on this. My use case is a set of Simarine sensor devices, wanting to replace the Pico display.
So the bottom line is that it is not possible to use an ESP32 UART in 9 bit mode. What I ended up doing was programming another chip (I used a rather ancient Silabs C8051F320 because I have lots of them on hand) which does support 9 bit mode. It sends the data to the ESP via USB (but other protocols like SPI or I2C could be used, or even 8 bit UART.)
The other issue in this application is that the timing requirements for polling the sensor devices are tight, too tight for the ESP32 to reliably deal with in the 16ms loop. So I had the 8051 handle the polling and CRC checking and the ESP just manages the higher levels of the protocol and converts the data to sensors.