I spent the whole day struggling with the board, changing modules, trying to figure out why serial port 2 wasn't receiving data. I even tried a sample project from Arduino. Then I just opened the old version of Arduino IDE and everything worked.
ESP32 Dev module
I've split your question to its own topic.
I'm not familiar with your board but have you compared settings between IDE 1.8.19 and 2.3.7?
Are you using the same ESP32 board package in both IDEs? Verbose output during compilation might shine a light on that (first few lines).
Thank you, I'm not sure anymore, the sketch is a minimal test.
void setup() {
// initialize both serial ports:
Serial.begin(115200);
Serial2.begin(115200);
}
void loop()
{
// read from port 1, send to port 0:
if (Serial2.available()) {
int inByte = Serial2.read();
Serial.write(inByte);
}
}
It works when I compile and flash it in Arduino 1.8.19, which is installed in the FLPROG package. After that, I downloaded Arduino 1.8.19 separately from the official website, and the same sketch on the same board flashed in this Arduino no longer work
Perhaps the reason lies in different boards in the settings, in the working ESP32S DEV MODULE system and in the non-working ESP32 DEV MODULE, while ESP32S is not even in the list, although the latest ESP 3.3.7 library is installed. I will try to roll back to library version 2.0.17 and then select the ESP32S DEV MODULE if it appears in the list.
Finally, I checked all possible boards in different versions of Arduino, and all those that flash my esp32-wroom-32 module do not support serial port 2. At the same time, in the custom Arduino environment from flprog, there is an option for the FLPROG ESP32S DEV MODULE board, and only with it does the board work, and port 2 as well.
The problem solve is:
In newer Arduino ESP32 core versions (3.0.0+), Serial2default pins changed to RX=GPIO4 and TX=GPIO25, which may cause it to appear unsupported or fail [7]. To fix, explicitly define pins in Serial2.begin(9600, SERIAL_8N1, 16, 17)` (using standard GPIO16/17) to ensure compatibility