In our project based on ESP32-WROOM-32D we use two UART ports:
-one is the "default" UART0 port (using standard TXD0 and RXD0 pins) used by customer
-the other is connected to a LTE modem (gpio_27 as TX pin and gpio_25 as RX pin)
In particular situation,it is necessary to talk directly to the modem via UART0 and we actually accomplish this behavior reading from UART0 and writing to UART1 and viceversa. In practice something like below:
Code: Select all
//Read data from UART0
int len = uart_read_bytes(UART_NUM_0, buffer, UART_BUFFSIZE, 100 / portTICK_RATE_MS);
if (len > 0)
{
//write to UART1
uart_write_bytes(UART_NUM_1, (const char*) buffer, len);
}
You may say: "Use interrupt on TXD0 and use gpio_set_level of gpio_27 to replicate the status". You are right but I would like to avoid interrupt.
Thanks in advance