Disable fifo buffers on the ESP32 UART?
Posted: Mon Nov 27, 2017 6:01 am
I need to send/transmit with very lot latency - for a bus protocol to connect to a legacy device (security system) I want to connect to. The protocol cannot be changed.
I need the ESP32 to wait for a message (about 16 bytes) on the UART, process it and send a small packet of data (4 bytes) in response to ack that message immediately. But the fifo buffering is causing things to get out of sync as TX messages are not sent immediately and RX responses seem only to arrive after 120 characters have filled the buffer.
Currently I see the following:
Polling for data - I only get notified when there are 120 bytes available to read.
When I send - (I can see from my oscilloscope) - it tends to not send the data Immediately - but buffers up several packets and send them together.
I need to find a way of removing the TX and RX buffering that appears to be happening. Any ideas anyone?
Thanks..
Following describes the buffering issue I'm having.
I need the ESP32 to wait for a message (about 16 bytes) on the UART, process it and send a small packet of data (4 bytes) in response to ack that message immediately. But the fifo buffering is causing things to get out of sync as TX messages are not sent immediately and RX responses seem only to arrive after 120 characters have filled the buffer.
Currently I see the following:
Polling for data - I only get notified when there are 120 bytes available to read.
When I send - (I can see from my oscilloscope) - it tends to not send the data Immediately - but buffers up several packets and send them together.
I need to find a way of removing the TX and RX buffering that appears to be happening. Any ideas anyone?
Thanks..
Following describes the buffering issue I'm having.
Code: Select all
byte data[]={1};
//I expect - [data][35ms silence][data][35ms silence][data]...
//but what i get is [35ms silence][data][data][data][data]...[35ms silence]
//ie. all the data is bunched together causing sync issues :(
void Test1() {
HardwareSerial Serial1(1);
Serial1.begin(2048, SERIAL_8N1, RXD_PIN, TXD_PIN);
while(true)
{
Serial1.write(data,1);
delay(35);
}
}