Buffering of incoming UDP frames
Posted: Mon Mar 16, 2026 1:36 pm
Hi,
I have a project which uses an epaper display type inkplate 6Motion from the Soldered company. It is fitted with a ESP32 as a coprocessor to handle wifi communication, and the whole is supported by a library supplied by the manufacturer.
The library uses the SPI AT protocol, that is, a SPI is used along with a GPIO configured as an output at the ESP32 side and an interrupt input on the main microcontroller side, according to the SPI AT documentation (https://docs.espressif.com/projects/esp ... PI_AT.html).
I experience transmission failures, and after some investigation, I can narrow my search to the way incoming UDP frames are stored in a buffer.
My project is a remote display that connects through wifi to a system. The system sends a 40-byte UDP frame every 500 ms, regardless of someone is listening or not.
When my application receives one frame, it processes it and returns a 22-byte UDP frame, that is, for each frame received there will be one frame transmitted.
The epaper display requires a periodic refresh, about every 50 seconds, and a refresh takes 750 to 1000 ms.
The problem is that at the time of refresh, the code cannot keep up with the incoming data. When I start the execution, I see that each received frame is correctly processed, with a frame sent in response; and at the time of refresh, I see two frames being read from the ESP32 in a row (at a few ms interval).
However, after a few minutes, after one refresh I see only one frame read from the ESP32, and the write function that is called to send the transmitted frame fails. Then I found the cause of the failure: in the write function, the ESP32 state is "ready for read" instead of "ready to send".
This, added to the fact that only one incoming frame was read instead of two, point to a problem with the buffering of incoming frames when more than one frame has been received and not read by the application.
I could not find any rule related to the buffering mechanism or the handling of incoming frames.
Is there such a document? Who knows how the buffering is handled?
I also observed once the following behavior: three times in a row only one incoming frame was read instead of two, and the fourth time four frames were retrieved in a row by the microcontroller, suggesting that three unread frames were somehow stuck in a buffer, and eventually let go by the ESP32.
Thanks for help.
Jean-Marc
I have a project which uses an epaper display type inkplate 6Motion from the Soldered company. It is fitted with a ESP32 as a coprocessor to handle wifi communication, and the whole is supported by a library supplied by the manufacturer.
The library uses the SPI AT protocol, that is, a SPI is used along with a GPIO configured as an output at the ESP32 side and an interrupt input on the main microcontroller side, according to the SPI AT documentation (https://docs.espressif.com/projects/esp ... PI_AT.html).
I experience transmission failures, and after some investigation, I can narrow my search to the way incoming UDP frames are stored in a buffer.
My project is a remote display that connects through wifi to a system. The system sends a 40-byte UDP frame every 500 ms, regardless of someone is listening or not.
When my application receives one frame, it processes it and returns a 22-byte UDP frame, that is, for each frame received there will be one frame transmitted.
The epaper display requires a periodic refresh, about every 50 seconds, and a refresh takes 750 to 1000 ms.
The problem is that at the time of refresh, the code cannot keep up with the incoming data. When I start the execution, I see that each received frame is correctly processed, with a frame sent in response; and at the time of refresh, I see two frames being read from the ESP32 in a row (at a few ms interval).
However, after a few minutes, after one refresh I see only one frame read from the ESP32, and the write function that is called to send the transmitted frame fails. Then I found the cause of the failure: in the write function, the ESP32 state is "ready for read" instead of "ready to send".
This, added to the fact that only one incoming frame was read instead of two, point to a problem with the buffering of incoming frames when more than one frame has been received and not read by the application.
I could not find any rule related to the buffering mechanism or the handling of incoming frames.
Is there such a document? Who knows how the buffering is handled?
I also observed once the following behavior: three times in a row only one incoming frame was read instead of two, and the fourth time four frames were retrieved in a row by the microcontroller, suggesting that three unread frames were somehow stuck in a buffer, and eventually let go by the ESP32.
Thanks for help.
Jean-Marc