Reliably setting up new modems with network info

When assembling new devices here on my production line and installing fresh BG96’s, I’m finding that some of the fresh BG96’s will not register on my local network. When I plug those BG96’s into my PC and connect with QNavigator, they still do not register when the Automatic Initilization runs (they return +CREG: 0,5
and +CGREG: 0,4). But then if I manually run AT+COPS=? the module will register and begin working normally.

Can someone please explain what’s going on here? And most importantly, how can I modify my device firmware (ESP32) to ensure that one of these BG96’s never gets stuck in this offline state? I am beginning to ship these devices overseas and I am concerned that this issue will happen when the device arrives in a new country and needs to register on a new network.

I’m doing this testing in Australia on the Telstra network, and am using Hologram sims on a global plan. When I manually run AT+COPS=? the command takes about 30-60sec to return, and it returns with: +COPS: (2,“Telstra Mobile”,“Telstra”,“50501”,8),(0,1,2,3,4),(0,1,2)

Here’s the response to my original post that I got from ChatGPT. Can anyone spot any faults in this response?

The issue you’re facing with BG96 not registering on the network could be due to the delay in the module acquiring the necessary information from the network to complete the registration process. Running AT+COPS=? manually forces the module to search for available networks and register with the desired network, thus resolving the issue.

To ensure that the module never gets stuck in an offline state, you can modify your device firmware (ESP32) to run the AT+COPS=? command automatically upon startup, or you can increase the frequency of network registration requests. This way, if the module fails to register, it will continue to search for and register with the network.

It’s also recommended to test the devices in different network environments and countries to verify the reliability and stability of the registration process.

That looks like sound advice.

It may be instructive to look at the contents of two SIM files which are important for initial network registration.

One is Operator controlled PLMN selector with Access Technology at SIM address 0x6F61.

It can be read using AT+CRSM=176,28513,0,0,0

The other is User controlled PLMN selector with Access Technology at SIM address 0x6F60.

It can be read using AT+CRSM=176,28512,0,0,0

The second of these is user-editable - you can write your own values for network preference.

First connection to a RAT can take a while, I’ve seen 5 minutes. How are you setting up the RATs?

For example:

AT+QCFG=“iotopmode”,0 // enable LTEM only
AT+QCFG=“nwscanmode”,3
AT+QCFG=“iotopmode”,0 // enable LTE
M + EGPRS
AT+QCFG=“nwscanmode”,0
AT+QCFG=“band”,F,80084,80084 // Check your local bands, they are likely different.
AT+QCFG=“iotopmode”,2
AT+QCFG=“nwscanseq”,020301
AT+QCFG=“nwscanmode”,3

Quectel have a “How to address low power app implementation in NB IoT and LTE M” Masterclass that has a of useful info. I’d share but I’m not sure if its under NDA. Perhaps someone from Quectel can confirm?