If you are using cellular communication for your project, chances are that you are working with a GSM module, and you may have come across AT+CREG and AT+CGREG commands. It is recommended in network-related application notes that you send these read commands and verify that you are registered, either to the home network (status 1), or the roaming network (status 5), before proceeding forward.
But if both indicate network registration, then why are the two needed? The answer is that one (AT+CREG?) gives you information about the cellular network. If you get the ‘registered’ status for AT+CREG?, it means that you can make phone calls and send or receive SMS. AT+CGREG? indicates GPRS registration. It refers to internet connectivity. If you get AT+CGREG? status as ‘registered’, it means that you can use the mobile data to access the internet.
If you recharge the SIM card with a pack that doesn’t include internet, you will get ‘registered’ status for AT+CREG? but ‘registration denied’ (status 3) for AT+CGREG?. If your SIM Card hasn’t been recharged/activated, you will get ‘registration denied’ for AT+CREG? itself.
- AT+CREG: https://m2msupport.net/m2msupport/atcreg-network-registration/
- AT+CGREG: https://m2msupport.net/m2msupport/atcgreg-gprs-network-registration-status/
- SIM800 Series Datasheet
Check out other articles on firmware on iotespresso.com