To fix roaming situations on a GSM device, I'm trying to retrieve the available networks with AT+COPS=?
and compare the SIM's IMSI to the networks' numeric codes.
Often, instead of a response, there is the echo, followed by device reset after a couple of seconds (roughly 10-20).
Occasionally, the invocation returns with CME ERROR: 22
, which typically refers to "IMEI not found" or "phone book entry not found". It occurs in context of COPS test, too, but the only discussion I've found about that so far was in Polish, which I sadly don't understand.
HW resets don't mend the issue.
About once a day, I receive a list of networks, (the correct) one of them tagged as "current network" despite AT+CREG?
returning status 0.
+CREG?
returns +CREG: 0,0
, then +COPS=0
causes CME error 3 (operation not allowed). AT+CREG=2
before the +COPS
test, later it was AT+CREG=1
. Right now, I'm doing that after the call to +COPS
. Neither setting is more successful than the others.What could be happening here? Is there some specific HW fault or user misbehavior that this "reaction" occurs for?
What is "not found" on CME ERROR 22?
If I'm doing the wrong thing, how can I get the information required from that situation?
The error turned out to be a mixture of things.
CME ERROR: 22
within +COPS=?
context means that no networks were found.AT+COPS=?
was accidentally invoked while the device was searching (i.e., AT+CREG?
would return +CREG: ?,2
with ? being a random URC enable state). If you wish to search, either wait until CREG returns some static state (meaning, something other than UNKNOWN or NOT REGISTERED AND SEARCHING) or force that situation using AT+COPS=2
.