RS 485 RTS/DE pin
Posted: Sun Jun 12, 2022 2:26 pm
Hello,
I'm looking into how RS 485 works with the ESP32. I've already successfully implemented a solution on the AVR ATtiny1614 microcontroller which has the XDIR pin that is automatically managed when sending RS 485. On the AVR I can even detect changes to the RX pin to prevent any transmitting at the earliest stage. This has reduced collisions massively in my tests.
From what I've read now, the ESP32 has no such support and relies on the driver (in ESP-IDF?) to set a pin at the correct times. Let's hope its timing is accurate and the bugs I've seen here will eventually be fixed (sometime after the current IDF 4.4.1).
Everybody's talking about using the RTS pin for the used UART. Now that's a big problem, because no such pins are actually available on the WROOM module. The UART0 is used by the serial terminal and prints all kinds of stuff all the time, also at boot. I'll also need that for firmware upgrades. UART1 is blocked by the flash memory and UART2 is still free. That's what I'll have to use in my application. But the RTS pins of UART1 and 2 are also blocked by flash. Can I just use any other pin? And since this is all software-defined, could I use another workaround with any custom GPIO? What's the recommended procedure here for new designs?
Also, can I still run an interrupt on RX level changes to detect the beginning of a bus transmission before the first byte is complete?
I'm looking into how RS 485 works with the ESP32. I've already successfully implemented a solution on the AVR ATtiny1614 microcontroller which has the XDIR pin that is automatically managed when sending RS 485. On the AVR I can even detect changes to the RX pin to prevent any transmitting at the earliest stage. This has reduced collisions massively in my tests.
From what I've read now, the ESP32 has no such support and relies on the driver (in ESP-IDF?) to set a pin at the correct times. Let's hope its timing is accurate and the bugs I've seen here will eventually be fixed (sometime after the current IDF 4.4.1).
Everybody's talking about using the RTS pin for the used UART. Now that's a big problem, because no such pins are actually available on the WROOM module. The UART0 is used by the serial terminal and prints all kinds of stuff all the time, also at boot. I'll also need that for firmware upgrades. UART1 is blocked by the flash memory and UART2 is still free. That's what I'll have to use in my application. But the RTS pins of UART1 and 2 are also blocked by flash. Can I just use any other pin? And since this is all software-defined, could I use another workaround with any custom GPIO? What's the recommended procedure here for new designs?
Also, can I still run an interrupt on RX level changes to detect the beginning of a bus transmission before the first byte is complete?