中文
English
Español
한국어
日本語
Pусский

AT Command Network Debug

Before blaming the hardware, follow this systematic checklist.

In IoT development, module network failures are among the most frustrating issues. Often, we see the failure but can't pinpoint where the process stopped.

From power‑up to successful connection, there's a clear logical chain. Checking each step in order will pinpoint the issue. This article covers 6 key AT commands to help you systematically troubleshoot.


1. AT+CPIN? – SIM Card Status

Purpose: Checks if the SIM card is inserted, locked (PIN‑protected), or faulty. This is the first check before any network activity.

Send:

text
AT+CPIN?

Common returns & meanings:

Return CodeMeaningExplanation
READYReadySIM identified and unlocked – ideal state
SIM PINPIN requiredUse AT+CPIN="1234" to unlock
SIM PUKPUK requiredPIN entered incorrectly 3 times – use PUK to reset
SIM NOT INSERTEDNo SIM detectedCheck hardware contact, slot, or try another SIM
SIM WRONGSIM errorCard damaged or voltage mismatch (1.8V/3V)

Debug: If the return is READY, proceed to the next step.


2. AT+CSQ – Signal Strength

Purpose: Queries the Received Signal Strength Indicator (RSSI) and Bit Error Rate (BER) to check physical layer quality.

Send:

text
AT+CSQ

Example return:

text
+CSQ: 20,99

RSSI value conversion & meaning:

RSSISignal Strength (dBm)Explanation
0≤ -113Very weak, cannot register
10-93Average, usable
20-73Good
31≥ -51Excellent
99N/ANo signal

For 4G/NB‑IoT modules, BER (Bit Error Rate) usually returns 99 as not applicable.

Debug: RSSI should be above 10. If you see 99,99, check the antenna and location.


3. AT+CREG? / AT+CEREG? – Network Registration Status

Purpose: Checks if the module has successfully registered with the carrier's network. Use AT+CEREG? (4G/LTE/NB‑IoT) as the primary command, as AT+CREG? is for 2G/GSM.

Send (for 4G):

text
AT+CEREG?

Common returns & meanings:

Status CodeMeaningExplanation
0Not registeredSearching or no signal
1Registered (home)Normal, can communicate
2SearchingCheck again after a few seconds
3Registration deniedSIM invalid, overdue, or IMEI blacklisted
5Registered (roaming)Normal
6Emergency onlyCannot access data; check SIM or APN

Debug: Proceed only when status is 1 or 5. If 3, check SIM status; if 6, verify data services are enabled.


4. AT+CGATT? – GPRS/PS Domain Attachment

Purpose: Checks if the module has attached to the data core network. If CEREG is "connected to the tower," CGATT means "authorized for data."

Send:

text
AT+CGATT?

Return & meaning:

ValueMeaning
0Detached – cannot access data
1Attached – data channel can be established

Debug: If it returns 0, confirm CEREG status is 1 or 5. You can manually attach with AT+CGATT=1.


5. AT+CGACT? – PDP Context Activation

Purpose: Checks if a PDP context is active. This is the final step. Only when activated does the module obtain an IP address and enable TCP/UDP communication.

Send:

text
AT+CGACT?

Example return:

text
+CGACT: 1,1

The first number is the Context ID (usually 1), the second is the state.

State meaning:

StateMeaning
0Inactive – no IP address
1Active – ready to communicate

Debug: If status is 0, follow this sequence:

  1. Check attachment: Ensure AT+CGATT? returns 1.

  2. Set APN: AT+CGDCONT=1,"IP","cmnet" (example for China Mobile).

  3. Activate context: AT+CGACT=1,1.

  4. Verify: Run AT+CGACT? again. Use AT+CGPADDR=1 to see the assigned IP.


6. Complete Troubleshooting Sequence

Follow these commands in order. Each step is a prerequisite for the next:
 Rule of thumb: Follow this order: Card → Signal → Network → Attach → Session. Skip none.


7. Quick Reference Table for Common Issues

SymptomPossible CauseCheck Sequence
CPIN returns SIM NOT INSERTEDCard not inserted, bad contact, or damagedHardware check > Replace SIM
CSQ returns 99,99No signal, antenna not connectedCheck antenna > Change location
CEREG returns 0,3 or 0,6SIM invalid, overdue, or no data planCheck CPIN > Check APN > Contact operator
CGATT returns 0Not attached to data domainCheck CEREG > Manual CGATT=1
CGACT returns 0PDP context not activeCheck CGATT > Set APN > Activate context

Master these six AT commands, and you'll have a universal method for diagnosing cellular module connectivity issues, regardless of the module brand or model (4G/NB‑IoT). Next time your module won't connect, use this checklist!