BG95x0A-GL: CME Error: 31

When sending the AT command AT+CGATT?, I sometimes receive the response:

+CME ERROR: 31

According to Quectel_BG77xA-GL & BG95xA-GL AT Commands Manual v1.1, error code 31 means “Network timeout.”

What is the correct way to handle this error?

  • Is this a transient condition that should be handled by retrying the command?
  • Should the device wait and retry later?
  • Under what circumstances, if any, is a modem restart recommended?

I would like to understand the expected behavior of the BG950A-GL when this error occurs and the best practice for handling it in production firmware.

pls run the AT

AT+QENG=“servingcell”

Perhaps the modem has completely entered the OOS state.

After receiving +CME ERROR: 31, I run the command AT+QENG="servingcell" and receive the following output:

... Other AT commands
08:41:20:291 -> DBG (UART NB 200): REQ: AT+CFUN=1
08:41:20:307 -> DBG (NB CONN 1117): RES: OK
08:41:20:365 -> DBG (CHATSCRIPT 89): 16 -> 17
08:41:20:365 -> DBG (NB CONN 802): Modem state: CONFIG
08:41:20:365 -> DBG (UART NB 200): REQ: AT+COPS?
08:41:20:365 -> DBG (NB CONN 1117): RES: +CEREG: 2
08:41:20:365 -> DBG (CHATSCRIPT 89): 17 -> 18
08:41:20:365 -> DBG (NB CONN 802): Modem state: CONFIG
08:41:20:365 -> DBG (UART NB 200): REQ: AT+COPS=0
08:41:20:365 -> DBG (NB CONN 1117): RES: +COPS: 0
08:41:20:400 -> DBG (NB CONN 1117): RES: OK
08:41:20:400 -> DBG (CHATSCRIPT 89): 18 -> 19
08:41:20:400 -> DBG (NB CONN 802): Modem state: CONFIG
08:41:20:400 -> DBG (UART NB 200): REQ: AT+CGATT?
08:41:36:831 -> DBG (NB CONN 1117): RES: +CME ERROR: 31
08:41:36:831 -> ERR (NB CONN 1088): Network timeout
08:41:36:831 -> DBG (UART NB 200): REQ: AT+QENG="servingcell"
08:41:36:831 -> DBG (NB CONN 1117): RES: +CEREG: 0
08:41:36:831 -> DBG (NB CONN 1117): RES: +CEREG: 2
08:41:36:874 -> DBG (NB CONN 1117): RES: +CEREG: 2
08:41:36:874 -> DBG (NB CONN 1117): RES: +CEREG: 0
08:41:36:874 -> DBG (NB CONN 1117): RES: +CEREG: 2
08:41:36:874 -> DBG (NB CONN 1117): RES: +CEREG: 0
08:41:36:960 -> DBG (NB CONN 1117): RES: +CEREG: 0
08:41:36:960 -> DBG (NB CONN 1117): RES: +QENG: "servingcell","SEARCH"
08:41:36:960 -> DBG (NB CONN 1117): RES: OK
08:41:36:960 -> DBG (CHATSCRIPT 89): 19 -> 20
08:41:36:960 -> DBG (NB CONN 808): Modem state: ATTACH
08:41:36:960 -> DBG (UART NB 200): REQ: AT+CGATT?
08:41:36:960 -> DBG (NB CONN 1117): RES: +CGATT: 0
08:41:36:960 -> DBG (NB CONN 1117): RES: OK

It might be that the modem has just started up and initialized.

Yes, it has just started up, but what is the recommended procedure when receiving this type of error? Should the modem simply be restarted, or is there a preferred handling method?

No, I suggest you use AT+CEREG or AT+QENG=“servingcell” to check the registration network status.