The current ESP32 UART code only honors the BaudRate in the standard UARTConfig struct.
This makes it difficult to re-route UARTs to non-standard pins as the GPIO MUX needs to be re-configured to map the UART signals to the desired pins. The code to do this mapping is private to the machine package, so can't be re-use by application logic.
This is example code trying to map UART1 to non-standard pins:
uart := machine.UART1
uart.Configure(machine.UARTConfig{
BaudRate: 9600,
TX: RS485_TX_PIN,
RX: RS485_RX_PIN,
})
Current behaviour
No UART / RS485 functionality - signals go missing
Expected behaviour
UART works :)
I've got a patch incoming to fix this.
The current ESP32 UART code only honors the BaudRate in the standard UARTConfig struct.
This makes it difficult to re-route UARTs to non-standard pins as the GPIO MUX needs to be re-configured to map the UART signals to the desired pins. The code to do this mapping is private to the machine package, so can't be re-use by application logic.
This is example code trying to map UART1 to non-standard pins:
Current behaviour
No UART / RS485 functionality - signals go missing
Expected behaviour
UART works :)
I've got a patch incoming to fix this.