I am trying to access/print new incoming messages on serial monitor. I interfaced EC200U with ESP32 and using UART. I am not able to access messages, sometimes it gets updated in storage but giving cms error 304 while reading it.
This is my code below. Please tell some solution.
const int RX_PIN = 16;
const int TX_PIN = 17;
void setup() {
// Initialize Serial Monitor
Serial.begin(115200);
// Initialize Serial2 for EC200U communication
Serial2.begin(115200, SERIAL_8N1, RX_PIN, TX_PIN);
// Set SMS text mode
Serial2.println("AT+CMGF=0");
// Set the module to notify the MCU of incoming messages
Serial2.println("AT+CNMI=1,2,0,1,0");
}
void loop() {
// Check and print new incoming messages
if (Serial2.available()) {
String message = Serial2.readString();
Serial.print("Received message: ");
Serial.println(message);
}
void setup() {
// Initialize Serial Monitor
Serial.begin(115200);
// Initialize Serial2 for EC200U communication
Serial2.begin(115200, SERIAL_8N1, RX_PIN, TX_PIN);
// Set SMS text mode
Serial2.println("AT+CMGF=1");
Serial2.println("AT+CSCS=\"GSM\"");
// Set the module to notify the MCU of incoming messages
Serial2.println("AT+CNMI=2,2,0,0,0");
}
void loop() {
// Check and print new incoming messages
if (Serial2.available()) {
String message = Serial2.readString();
Serial.print("Received message: ");
Serial.println(message);
}
}
I checked the module with QNavigator software, I am getting new incoming messages with AT+CNMI=1,2,0,1,0. But on serial I am not getting. I am not getting where is the fault. The same configuration is used in code as in QNavigator. If anyone has done then please help out.