I am trying to interface the ESP32 (using UART1) with an RS485 serial interface, this interface is half duplex. I need to be able to read data from the RX on UART1 (RX1), wait for a specific character which signifies the end of transmission from the remote interface and then within 4 milliseconds send my message (obviously on the UART1 TX line).
Is there a way to set an interrupt on each byte received on RX1? Or would I be better to continuously read RX1 waiting for the termination character?
Reading unbuffered data from UART1
Re: Reading unbuffered data from UART1
You can interrupt on a # of received chars or a specific command char
Code: Select all
UART_AT_CMD_CHAR_DET_INT: Triggered when the receiver detects the configured at_cmd char.
Re: Reading unbuffered data from UART1
Thanks for the hint. I ended up using `uart_enable_pattern_det_intr()`, such that the code looked like the following:
Where `uart_event_task` is the function to call.
Code: Select all
//Set uart pattern detect function.
uart_enable_pattern_det_intr(EX_UART_NUM, 0xCE, 1, 10000, 10, 10);
//Create a task to handler UART event from ISR
xTaskCreate(uart_event_task, "uart_event_task", 2048, NULL, 12, NULL);
Who is online
Users browsing this forum: No registered users and 146 guests