AT+CREG? showing in serial monitor and not connected to network

I am using SIM800L with xiao esp32 c3 dev board and I write a code for same its working properly and connect to network without a single error but I replace xiao esp32 c3 dev board by esp32 s3 dev board and try to upload same code with small changes of pins .in this condition program uploaded successfully but there is an issue to connect to network .

serial monitor showing AT+CREG? ,when it try to connect and after connection failed it showing

AT+CIPSTATUS=0
AT+CIPRXGET=4,0
AT+CIPSTATUS=0
AT+CIPSTATUS=0
AT+CIPRXGET=4,0
AT+CIPSTATUS=0

again and again . anyone can help me ?

Is it possible the V3 changes to UART are affecting this?
https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides/2.x_to_3.0.html#introduction
If so, drop the esp32 boards back to the last 2.x ver.

I think it's not a version problem because it compiled and uploaded successfully but sim800L module not connect to network .
serial monitor showing AT+CREG? ,when it try to connect and after connection failed it showing

AT+CIPSTATUS=0
AT+CIPRXGET=4,0
AT+CIPSTATUS=0
AT+CIPSTATUS=0
AT+CIPRXGET=4,0
AT+CIPSTATUS=0

again and again.

my Arduino code is following please check it ,if there is any mistake let me know,

#include "Arduino.h"
#include <HardwareSerial.h>


//*************************************************** Beginning UART Communications

#define SerialMon Serial //      For Serial Monitor 
HardwareSerial SerialAT(0); //   For SIM800 Module
HardwareSerial Serial_MP3(1); // For MP3 Module


//*************************************************** SIM800 Config
#define TINY_GSM_MODEM_SIM800
#define TINY_GSM_USE_HEX
#define TINY_GSM_RX_BUFFER 730


// Necesarry Libraries
#include <TinyGsmClient.h>        // https://github.com/vshymanskyy/TinyGSM (0.11.5)
#include <PubSubClient.h>         // https://pubsubclient.knolleary.net (2.8.0)
#include "DFRobotDFPlayerMini.h"  // https://github.com/DFRobot/DFRobotDFPlayerMini (1.0.5)

DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value);


//setting all required global variables.
char* lower = "";
char* response = "";
String res = "";
String Prev_payload = "";
String final_amount = "";
uint32_t lastReconnectAttempt = 0;

// LED Indicators
const int Blue_Light = 8;
const int Green_Light = 9;
const int Red_Light = 10;

// Previous Amount Button
const int Prev_Button = 3;
const int delivery = 2;

//*************************************************** GPRS Credentials
const char apn[] = "airtelgprs.com";    // Your APN
const char gprsUser[] = "";  // User
const char gprsPass[] = "";  // Password
const char simPIN[] = "";    // SIM card PIN code, if any



//*************************************************** Adafruit MQTT Credentials
const char* broker =         "io.adafruit.com";
const char* amount_topic =   "iyansind/feeds/alert";
const char* mqtt_username =  "iyansind";
const char* mqtt_password  = "aio_SWui84sAjZSqkkEVQrfFTCp3od6N";


TinyGsm modem(SerialAT);
TinyGsmClient clientMQTT(modem, 0);
PubSubClient mqtt(clientMQTT);



// MQTT Callback Fuction

void mqttCallback(char* topic, byte* payload, unsigned int len)
{
  SerialMon.print("Message arrived [");
  SerialMon.print("ping");
  SerialMon.print("]: ");
  SerialMon.write(payload, len);

  String final_payment;
  String topicStr = topic;
  payload[len] = 0;
  String recv_payload = String((char*)payload);

  Serial.println("mqtt_callback - message arrived - topic [" + topicStr + "] payload [" + recv_payload + "]");

  // Converting Data recevied in Actual Amount Value ( For Eg. Converting 100 to 1.00 )

   Serial.print("final_payment = ");
  Serial.print(final_payment);


}

void turnOffNetlight()
{
  SerialMon.println("Turning off SIM800 Red LED...");
  modem.sendAT("+CNETLIGHT=0");
}

void setup()
{
  delay(1000);
  Serial_MP3.begin(9600, SERIAL_8N1, 4, 1); // For MP3 Module
  Serial.begin(115200);                       // For Serial Monitor
  SerialAT.begin(115200, SERIAL_8N1, 44, 43); // For SIM800 Module

 pinMode(delivery, OUTPUT);
  pinMode(Blue_Light, OUTPUT);
  pinMode(Green_Light, OUTPUT);
  pinMode(Red_Light, OUTPUT);
  pinMode(Prev_Button, INPUT_PULLUP);

  digitalWrite(Blue_Light, LOW);
  digitalWrite(Green_Light, LOW);
  digitalWrite(Red_Light, LOW);
  delay(500);

  // Initialising MP3 module

  if (!myDFPlayer.begin(Serial_MP3, /*isACK = */ true, /*doReset = */ true)) {  //Use serial to communicate with mp3.
    Serial.println(F("Unable to begin:"));
    Serial.println(F("1.Please recheck the connection!"));
    Serial.println(F("2.Please insert the SD card!"));
    while (true)
     {
      delay(0);  // Code to compatible with ESP8266 watch dog.
    }
  }
  Serial.println(F("DFPlayer Mini online."));
  delay(500);

  myDFPlayer.volume(10);
  myDFPlayer.play(1);

  digitalWrite(Red_Light, HIGH);
  delay(50);
  digitalWrite(Red_Light, LOW);
  delay(200);
  digitalWrite(Red_Light, HIGH);
  delay(50);
  digitalWrite(Red_Light, LOW);
  delay(200);

  SerialMon.println("Initializing modem...");
  // Restarting Modem (Generally it takes some time)
  modem.restart();

  // Turn off network status lights to reduce current consumption
 

  SerialMon.print("Waiting for network...");
  if (!modem.waitForNetwork()) {
    SerialMon.println(" fail");
    myDFPlayer.play(7);
    delay(10000);
    return;
  }
  SerialMon.println(" success");
  if (modem.isNetworkConnected())
  {
    SerialMon.println("Network connected");
    myDFPlayer.play(2);

  }

  digitalWrite(Blue_Light, HIGH);
  delay(50);
  digitalWrite(Blue_Light, LOW);
  delay(200);
  digitalWrite(Blue_Light, HIGH);
  delay(50);
  digitalWrite(Blue_Light, LOW);

  // GPRS connection parameters are usually set after network registration
  SerialMon.print(F("Connecting to "));
  SerialMon.print(apn);
  if (!modem.gprsConnect(apn, gprsUser, gprsPass)) {
    SerialMon.println(" fail");
    myDFPlayer.play(7);
    delay(10000);
    return;
  }
  SerialMon.println(" success");

  if (modem.isGprsConnected()) {
    SerialMon.println("GPRS connected");
  }

  // MQTT Broker setup
  mqtt.setServer(broker, 1883);
  mqtt.setCallback(mqttCallback);
  mqtt.setKeepAlive(60);

  const uint32_t t = millis();

  if (!modem.isNetworkConnected()) {
    SerialMon.println("Network disconnected");
    if (!modem.waitForNetwork(180000L, true)) {
      SerialMon.println(" fail");
      delay(10000);
      return;
    }
    if (modem.isNetworkConnected()) {
      SerialMon.println("Network re-connected");
    }
  }

  if (!mqtt.connected())
  {
    SerialMon.println("=== MQTT CONNECTED ===");
    // Reconnect every 10 seconds
    uint32_t t = millis();
    if (t - lastReconnectAttempt > 10000L) {
      lastReconnectAttempt = t;
      if (mqttConnect()) {
        lastReconnectAttempt = 0;
      }
    }
    delay(100);
    return;
  }

}


uint32_t lastNetworkCheck;
uint32_t lastMqttCheck;

void loop()
{

  mqtt.loop();
  button_Check();

}

void voice_commands(String amount)
{

  Serial.println("paymant capture");

  myDFPlayer.play(4);  // Amount Received Voice note
  digitalWrite(Red_Light, HIGH);
  digitalWrite(Blue_Light, HIGH);
  digitalWrite(Green_Light, HIGH);
  delay(200);
  digitalWrite(Red_Light, LOW);
  digitalWrite(Blue_Light, LOW);
  digitalWrite(Green_Light, LOW);
  delay(50);
  digitalWrite(Red_Light, HIGH);
  digitalWrite(Blue_Light, HIGH);
  digitalWrite(Green_Light, HIGH);
  delay(200);
  digitalWrite(Red_Light, LOW);
  digitalWrite(Blue_Light, LOW);
  digitalWrite(Green_Light, LOW);
  delay(50);

   delay(300);
  int amount_int = amount.toInt();
  if (amount_int <= 20) {

    myDFPlayer.playMp3Folder(amount_int);  //play specific mp3 in SD:/MP3/amount_int.mp3; File Name(0~65535)
    delay(700);
    Serial.println(amount_int);

  
      myDFPlayer.playMp3Folder(20);  //play specific mp3 in SD:/MP3/100.mp3; File Name(0~65535)
      delay(700);
  }
digitalWrite(delivery, HIGH);
delay(500);
  digitalWrite(delivery, LOW);
  delay(500);
      
  //    //end command placed at 61000.
  //    myDFPlayer.playMp3Folder(61000); //play specific mp3 in SD:/MP3/amount_int.mp3; File Name(0~65535)
  //    delay(2000);
}


void printDetail(uint8_t type, int value) {
  switch (type) {
    case TimeOut:
      Serial.println(F("Time Out!"));
      break;
    case WrongStack:
      Serial.println(F("Stack Wrong!"));
      break;
    case DFPlayerCardInserted:
      Serial.println(F("Card Inserted!"));
      break;
    case DFPlayerCardRemoved:
      Serial.println(F("Card Removed!"));
      break;
    case DFPlayerCardOnline:
      Serial.println(F("Card Online!"));
      break;
    case DFPlayerUSBInserted:
      Serial.println("USB Inserted!");
      break;
    case DFPlayerUSBRemoved:
      Serial.println("USB Removed!");
      break;
    case DFPlayerPlayFinished:
      Serial.print(F("Number:"));
      Serial.print(value);
      Serial.println(F(" Play Finished!"));
      break;
    case DFPlayerError:
      Serial.print(F("DFPlayerError:"));
      switch (value) {
        case Busy:
          Serial.println(F("Card not found"));
          break;
        case Sleeping:
          Serial.println(F("Sleeping"));
          break;
        case SerialWrongStack:
          Serial.println(F("Get Wrong Stack"));
          break;
        case CheckSumNotMatch:
          Serial.println(F("Check Sum Not Match"));
          break;
        case FileIndexOut:
          Serial.println(F("File Index Out of Bound"));
          break;
        case FileMismatch:
          Serial.println(F("Cannot Find File"));
          break;
        case Advertise:
          Serial.println(F("In Advertise"));
          break;
        default:
          break;
      }
      break;
    default:
      break;
  }
}


bool mqttConnect()
{
  SerialMon.print("Connecting to ");
  SerialMon.print(broker);

  // Connect to MQTT Broker
  //bool status = mqtt.connect("GsmClientTest");

  // Or, if you want to authenticate MQTT:
  bool status = mqtt.connect("abcxyz", mqtt_username , mqtt_password);

  if (status == false) {

    digitalWrite(Green_Light, HIGH);
    myDFPlayer.play(7);
    delay(2000);
    SerialMon.println(" fail");
    return false;
  }
  SerialMon.println(" OK");


  myDFPlayer.play(3);

  digitalWrite(Green_Light, HIGH);
  delay(50);
  digitalWrite(Green_Light, LOW);
  delay(200);
  digitalWrite(Green_Light, HIGH);
  delay(50);
  digitalWrite(Green_Light, LOW);
  delay(200);
  digitalWrite(Green_Light, LOW);

  mqtt.subscribe(amount_topic);
  return mqtt.connected();
}

void button_Check()
{
  int test = digitalRead(Prev_Button);
  if (test == LOW) {
    delay(100);
    voice_commands(Prev_payload);
  }
}

Did you back the boards off to a 2.x.x? It only takes a minute, if no different, re-install 3.x.x

thanks for reply. I have done so. but it is was connecting to network.

Sorry, but I don't understand your reply re 'but it was connecting to network'. Did you back off the BOARDS level, NOT library, BOARDS.

sorry I want to say that it was not connecting in v 2.x.x also.

If post#3 is all that is seen on the serial log then I have no clue. If it shows more maybe you should post it. The more information we have the easier to solve.

Yes it is still showing like post#3 in serial log. and I am still facing the same problem .please take a look in program which I have shared in post#4 .if any correction let me know.

The problem is your code in post #4 has too mutch going on. You need to start cutting parts out, for instance mqtt, mp3, dfrobot until you have the smallest code that demonstrates the problem. My suspicion is it will be the GSM part.