1

I have a similar issue. I want to use the ESP32 with RS485. I have used the Arduino and this works well assigning pins, but it seems not to allow full use of the UART.

I see the new uarts in the ESP32 can support the direction control (RTS) of the direction pin and there is actually a hardware RS485 mode. See the repository that the board package is based on: https://github.com/espressif/arduino-esp32

Then https://github.com/espressif/arduino-esp32/tree/master/tools/sdk/include/driver/driver uart.h

This shows we can actually have full hardware flow control, so no more guessing delays for controlling the DIR lines or getting interrupts when the send buffer is empty in order to know when to switch back to receive.

I found using board manager this did not all get installed, so I followed some tutorials on how to install it manually. The board either doesn't appear at all, or I can't reference "uart.h".

Any ideas or examples? Thanks, Mark

1

your example was of great help solving the problem of driving RTS properly, thanks a lot!

I found a small bug in the code example, the data buffer is allocated in the loop() function instead of setup() and as a result, eventually the memory leak will fill-up all available memory.

Ciao! Alessandro

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.