ESP32-WROOM-32E Serial communication

ESP32-WROOM-32E
Serial communication is carried out using GPIO4 and GPIO36.
But some data will be lost along the way.
The serial settings are as follows:

  Serial1.begin(460800, SERIAL_8N1, RX1, TX1);
  Serial1.setRxBufferSize(1);

The data reception program is as follows:

  while( Serial1.available()){
    RxRing.dat[cnt] = Serial1.read();
    cnt++;
  }

When 20208 bytes of data are received
Reception will be interrupted around the 360th byte, and 130 to 260 bytes of data will be lost.
All subsequent data will be received normally.

Have you tried a lower data rate?

thanks for your reply.
I tried it with a low data rate(9600), but it stopped after receiving about 930 bytes.

can you post the complete code?
any particular reason to set

Serial1.setRxBufferSize(1);

what happens if you remove the statement?

1 Like

Thanks for your reply.
I can't post the complete code.

The initial baud rate setting was 115200bps.
In that case, I was able to receive up to about 11500 bytes,
but the same data was received twice repeatedly.
When I changed the baud rate setting to 460800bps,
I was able to receive up to 20208 bytes, although some data was missing.

Serial1.setRxBufferSize(1);
Even after deleting the statement, there was no change.

without a complete idea of what the code is doing it is impossible to help
e.g. is the code executing interrupt or callback routines which could upset the Serial1 timing?
could you implement a small program which displays the problem?
you can then post that

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.