Two UART periferals in the same GPIO pins
Posted: Thu Jan 23, 2025 1:10 pm
Hello,
I'm currently working with an ESP32-CAM board, so I don't have many pins available for external communication (I'm using both the camera and the PSRAM). I need to communicate the board via RS485, so I need 3 pins to make it work. I'm currently using GPIO12 (the only "free" pin I have left) for the RX ENABLE signal, but I still need TX and RX so I thought "well, I can use GPIO1 and GPIO3 for this", but the thing is that after setting the pins for UART_NUM_2, I loose serial output to the terminal even if I don't output anything via UART_NUM_2. Reading through the Technical Reference Manual I can't find anything that suggests that I can't use two peripherals on the same pins, but maybe this is related to UART_NUM_0 being routed via IOMUX and UART_NUM_2 via the GPIO Matrix. It would be nice to have this two UARTs because the RS485 line that I'm connecting to works at 9600 bauds and the ESP32-CAM works at 115200.
My question is: Is it possible to attach two UART peripherals to the same pins? And if so, how can I work around my current situation? I know that I can simply lower the baudrate for the ESP32 serial port but I would much rather have two separate peripherals.
I'm currently working with an ESP32-CAM board, so I don't have many pins available for external communication (I'm using both the camera and the PSRAM). I need to communicate the board via RS485, so I need 3 pins to make it work. I'm currently using GPIO12 (the only "free" pin I have left) for the RX ENABLE signal, but I still need TX and RX so I thought "well, I can use GPIO1 and GPIO3 for this", but the thing is that after setting the pins for UART_NUM_2, I loose serial output to the terminal even if I don't output anything via UART_NUM_2. Reading through the Technical Reference Manual I can't find anything that suggests that I can't use two peripherals on the same pins, but maybe this is related to UART_NUM_0 being routed via IOMUX and UART_NUM_2 via the GPIO Matrix. It would be nice to have this two UARTs because the RS485 line that I'm connecting to works at 9600 bauds and the ESP32-CAM works at 115200.
My question is: Is it possible to attach two UART peripherals to the same pins? And if so, how can I work around my current situation? I know that I can simply lower the baudrate for the ESP32 serial port but I would much rather have two separate peripherals.