AT+COPS
is an AT command for operator selection.
Overview
Command | Example response(s) | Info |
|
| Returns the current selection mode, operator format, operator, and radio access technology. |
|
| Returns the available networks, including information on network status |
|
| Sets the automatic operator selection mode. |
|
| Sets manual network selection for the selected PLMN. |
|
| Deregister from network and place on FPLMN. |
|
| Sets read command |
|
| Manual operator selection with automatic fallback. |
AT+COPS?
The read command AT COPS?
returns the current mode, the registered operator, and radio access technology.
The response will have this syntax:
+COPS: [selection mode],[operator format],[operator],[radio access technology]
OK
An example response is:
+COPS: 0,0,”T-Mobile USA”,7
OK
The selection mode is 0
, which means automatic, and the radio access technology is 7
, which means E-UTRAN, the identifier for LTE.
AT+COPS=?
To get the list of available operators, use the test command AT+COPS=?
.
The response format:
+COPS: [(<stat>,long alphanumeric <oper>,short alphanumeric <oper>,numeric <oper>[,<AcT>])]
Here’s an example response:
+COPS: (1,"Telia DK","Telia","23820",9),(2,"TDC","TDC","23801",0),(1,"Telia-Telenor DK","TT DK","23866",0)
OK
If you get a result that looks like this: +COPS: ,,(0,1,2,3,4),(0,1,2)
, then unfortunately your device has no available networks to connect to. Check which bands/technologies the device can connect to and a coverage map, if available. GSMA is a good starting point. Local base station databases or coverage maps from local providers are, however, usually better.
AT+COPS=0
The command AT+COPS=0
sets the modem to choose a network operator automatically.
Some modems are set to automatic network selection by default and don’t need to be set manually, and some modules have their own automatic selection mode. Consult your specific modem’s documentation for more information.
AT+COPS=1[,<format>[,<oper>]]
Manually select the network with the AT+COPS=1
command.
The command format should look like this:
AT+COPS=[<mode>[,<format>[,<oper>]]]
An example command is:
AT+COPS=1,2,"24407"
AT+COPS=2
AT+COPS=2
is the standard AT command to de-register a modem from a registered network.
Be aware that this will put the network on the FPLMN (forbidden network) list.
AT+COPS=3,<format>
The set command AT+COPS=3,<format>
sets read command +COPS?
to return only the selected <format>
. This is not shown in the +COPS?
read command response.
AT+COPS=4,<format>,<oper>
The set command AT+COPS=4,<format>,<oper>
is manual mode with automatic fallback.
If manual selection of <oper>
fails, automatic mode (=0)
is entered.
Beware of AT+COPS=0 and AT+COPS=2
Beware of manually using AT+COPS=0
and AT+COPS=2
. These commands can lead to unforeseen consequences.
Read all about the potential issues with manual attach and detach in this article: Why you shouldn’t tell IoT modems to detach/attach.
Defined values
<stat>
= Network status.
0
= Unknown1
= Available2
= Current3
= Forbidden
<mode>
= Selection mode.
0
= automatic selection1
= manual selection2
= deregister from network
<format>
= Operator format.
0
= long alphanumeric – e.g “T-Mobile USA”1
= short alphanumeric e.g “TMO”2
= numeric aka the MCC + MNC e.g. “310260”
<oper>
= Operator identifier.
String of digits returning the operator identifier(s) in the above listed <format>.
<AcT>
= Radio access technology.
0
= GSM1
= GSM Compact2
= UTRAN3
= GSM w/EGPRS4
= UTRAN w/HSDPA5
= UTRAN w/HSUPA6
= UTRAN w/HSDPA and HSUPA7
= E-UTRAN8
= EC-GSM-IoT (A/Gb mode)9
= E-UTRAN (NB-S1 mode)
Interpreting this, 0
would typically be 2G connectivity, 7
is typically LTE (including LTE-M), and 9
is typically NB-IoT.
Notes
The command parameters and their defined values were mostly taken from the Nordic Semiconductor nRF9160 series.