I'm writing code for an ESP32 to talk to two devices over the same UART line using an RS485 multiplexing setup. Because my setup is not standard, I have been hesitant to use the IDF's built-in RS485 mode and instead have opted to manually control the TX/RX select line in my communications architecture.
The basic communication flow is as follows:
- Set Select line to Write (TX) level
- Write message ()
Code: Select all
uart_write_bytes - Wait for TX to finish ()
Code: Select all
uart_wait_tx_done - Set Select line to Read (RX) level
- Read message, decode, process
Code: Select all
uart_wait_tx_done