Hi,
I have problem in communication between ESP32 and a Modem SIMCOM When i upgrade Platform Espressif 32. If i use the version 3.0, everythings is OK. If i Upgrade to a higher version, problem occur.
exemple from the serial :
with the platform 3.0. if i send this command “—> AT+CCLK?”
i receive the response : +CCLK: “21/12/06,21:06:20+04”
so everything is OK
But if i upgrade, i receive +CCLK: “” and the rest comes later.
every command is bad.
I Have defined serial with the le library #include <HardwareSerial.h>
thanks for support
Your code is likely dependent on the exact Arduino core implementation. Looking at Releases · platformio/platform-espressif32 · GitHub, Platform version 3.1 is the first one that uses Arduino core 1.0.5, with the latest PlatformIO-supported version being 1.0.6.
Can you show the code you’re using for reading out responses? Is there a little delay / timeout waiting for characters logic in the code? There’s no reason why it shouldn’t be generally possible to do serial communication with the latest espressif32 platform.
Hi,
Thanks for your help.
I Use this code :
#include <Arduino.h>
#include <HardwareSerial.h>
#define SIMCOM_TX 27
#define SIMCOM_RX 26
HardwareSerial SIMCOM(1);
SIMCOM.begin(57600, SERIAL_8N1, SIMCOM_RX, SIMCOM_TX);
ATCommand="AT+CCLK?";
SIMCOM.println(ATCommand);
then i read the response from the modem with this function 
while (SIMCOM.available())
{
char c = SIMCOM.read();
if (c == '\r')
continue;
if (c == 0xA)
{
if (replyidx == 0) // the first 0x0A is ignored
continue;
if (!multiline)
{
timeout = 0; // the second 0x0A is the end of the line
break;
}
}
replybuffer[replyidx] = c;
ATresponse = ATresponse + char(replybuffer[replyidx]);
SerialOnMonitor(String(c),2,false);
replyidx++;
}
But when you send the command with
and then directly after check if there are bytes available for reading with
The processor might be too fast and checking the serial at a time when there aren’t any bytes sent back yet. You should try and insert a piece of code there to wait for at least one character with a timeout, e.g.g
//wait for data with 5 tries and 50ms delay in between (=>250ms max)
int tries = 5;
while(!SIMCOM.available() && tries != 0) {
delay(50);
tries--;
}
//original code
while(SIMCOM.available()) { /* ... */ }
HI,
Thanks for your help. I will try but i dont understand why everything works fine with version 3.0.0 and after upgrade problem occur ?
Internal optimizations of the Serial functions may have occurred making the execution of them faster and thus leading to this time-race to occurr.
OK thanks
I will try it tommorrow