AT Commands
01.03.2023

AT+CGREG: Modes, parameters, and examples

Peter Bornerup
Peter Bornerup

Developer

AT+CGREG is an AT command for the GPRS registration status of the device. This article is a practical overview of how to use the command.

Overview

 CommandExample response(s)Info
AT+CGREG=?+CGREG: <n>
OK 

+CGREG: (0-2)
OK
Checks supported configurations.

<n> = list of supported configurations.
AT+CGREG?+CGREG: <n>,<stat>
OK 

+CGREG: <n>,5
OK 

+CGREG: <n>,1
OK
Get the current registration status.

<n> = current configuration value.

<stat> = network registration status.

<stat> is 1 = registered to the home network, and 5 = registered to a roaming network.
AT+CGREG=0OKDisables Unsolicited Result Codes.
AT+CGREG=1OKEnables Unsolicited Result Codes (receive automatic updates on registration status).
AT+CGREG=2OKEnables network registration and location information Unsolicited Result Codes.

AT+CGREG=?

AT+CGREG=? is a test command that returns the list of supported network configurations.

AT+CGREG?

AT+CGREG? Is a read command for the GPRS registration status of the device. Receiving “registered” status from AT+CGREG? indicates that the device can access the internet.

Expected responses include +CGREG: <n>,5 and +CGREG: <n>,1.

  • The n indicates the Unsolicited Result Code (URC) status,
  • “5” indicates that the modem is registered to a network and is roaming, and
  • “1” means the device is registered to the home network.

AT+CGREG=0

AT+CGREG=0 is a set command that disables the return of Unsolicited Response Codes (URCs) when network registration occurs.

In other words, there is no automated update on network registration.

AT+CGREG=1

AT+CGREG=1 is a set command that enables Unsolicited Response Codes (URCs) for the packet-switched network status.

Basically, this command tells the modem to respond when the network status changes, without having to manually check connectivity using AT+CGREG?.

AT+CGREG=2

AT+CGREG=2 is a set command that enables network registration and location information Unsolicited Result Codes (URCs).

+CREG vs +CGREG vs +CEREG

What are the differences between +CREG, +CGREG, and +CEREG?

  • +CREG queries the registration to the circuit switched network, aka GSM networks.
  • +CGREG and +CEREG query registration to the packet switched networks, aka networks which allow access to the internet.
  • +CGREG queries the registration to GPRS network.
  • +CEREG queries the registration to LTE or newer network technologies.

If you’re using modems with both GPRS and LTE technologies, use both AT+CGREG? and AT+CEREG?. The modem will report <n>,4 to the technology that is currently not active.

Defined values

<n> = Network registration unsolicited result code mode.

  • 0 = Disable network registration unsolicited result code.
  • 1 = Enable network registration unsolicited result code +CGREG: <stat>.
  • 2 = Enable network registration and location information unsolicited result code +CGREG: <stat>[,<lac>,<ci>,<AcT>,<rac>].

<stat> = Current network registration status.

  • 0 = Not registered and the modem is not currently searching for an operator to register to.
  • 1 = Registered to the home network.
  • 2 = Not registered, but the modem is currently trying to attach or is searching for an operator to register to.
  • 3 = Registration denied.
  • 4 = Unknown.
  • 5 = Registered to a roaming network.
  • 6 = Registered for “SMS only”, home network (applicable only when <Act> indicates E-UTRAN)
  • 7 = Registered for “SMS only”, roaming (applicable only when <Act> indicates E-UTRAN) <lac> String type; two byte location area code in hexadecimal format (e.g. “00C3” equals 195 in decimal).

<lac> = Location area code.

String type; two byte location area code in hexadecimal format (e.g. “00C3” equals 195 in decimal).

<ci> = Cell ID

String type; four byte UTRAN/GERAN/E-UTRAN cell ID in hexadecimal format.

<AcT> = Access technology of the registered network.

  • 0 = GSM
  • 1 = GSM Compact
  • 2 = UTRAN
  • 3 = GSM w/EGPRS
  • 4 = UTRAN w/HSDPA
  • 5 = UTRAN w/HSUPA
  • 6 = UTRAN w/HSDPA and HSUPA
  • 7 = E-UTRAN
  • 8 = 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.

We have the largest global coverage of NB-IoT and LTE-M technologies on the market and are ready to help you future-proof your devices. See our LTE-M global coverage and NB-IoT global coverage.

<rac> = Routing area code.

String type; one byte routing area code in hexadecimal format.

Notes

The information in this article is predominantly based on the SIMCOM 7020 series.

Build your
own network

Enhance signal quality and network control with non-steered SIM cards. Connect all your devices securely to a global network with Onomondo IoT SIMs.

Start testing Onomondo for free

Ready to experience next-generation IoT connectivity? Create an account, explore the platform, and start testing Onomondo’s IoT SIM cards for free.

Related articles

Read more about the topic

Test Connectivity with AT Commands
Articles
How to test connectivity with AT commands
AT Commands Developer blog
By using the AT command sequence in this blog, you can establish a data connection to your cellular IoT connectivity provider to test modem connectivity.
at cpol for adding network preference lists
Articles
How to add a Network Preference List (PLMN) to a SIM
Developer blog AT Commands
Network preference lists (PLMNs) are a way to prioritize specific networks over other available networks. Here’s how to set the PLMN using AT commands.
Ping your modem with AT commands
Articles
How to ping your modem using AT commands
AT Commands Developer blog
Checking your modem’s data connection by performing a ping after a successful network attachment can help debug connectivity issues. This blog shows you how.