AT指令调试
一. 网址参考
二. 实践与截图
AT指令推荐顺序:
1) 初始化:检测GPRS模块、SIM卡信息和网络注册状态
AT--->ATV1--->ATE0--->AT+CGSN--->ATI--->AT+CREG?--->AT+CGREG?--->AT+CPIN?---->AT+QCCID--->AT+CIMI--->AT+CSQ
2)设置APN和拨号
AT+QICLOSE--->AT+QIDEACT--->AT+QICSGP--->AT+CFUN=0---->AT+CFUN=1--->AT+COPS--->AT+CGREG?--->AT+QENG="servingcell--->AT+CSQ--->AT+QIACT=1--->AT+QIACT?
3)连接服务器及查询连接网络
AT+QIOPEN--->AT+QISTATE--->AT+QNWINFO
1. 检测GPRS模块、SIM卡信息和网络注册状态
1)AT指令测试
write:AT ec20 read[6]: OK
2)设置TA(Terminal Adapter)响应格式
TA Response Format
write:ATV1 //Long result code format ec20 read[6]: OK
3)关闭回显
Set Command Echo Mode
write:ATE0 ec20 read[6]: OK
4) 查询设备IMEI
Request Product Serial Number Identification
write:AT+CGSN ec20 read[25]: 869492051359031 OK
5) 查询模块版本信息
Display Product Identification Information
write:ATI ec20 read[52]: Quectel EC25 Revision: EC25ECGAR06A07M1G OK
6) 查询网络注册状态
AT+CREG :returns the network registration status
AT+CGREG: Network Registration Status
write:AT+CREG? ec20 read[20]: +CREG: 0,1 OK write:AT+CGREG? ec20 read[21]: +CGREG: 0,1 OK
7)查询SIM卡状态
AT+CPIN is used to enter a password or query whether or not the module requires a password which is
necessary before it can be operated (SIM PIN, SIM PUK, PH-SIM PIN, etc.).
write:AT+CPIN? ec20 read[22]: +CPIN: READY OK
8) 查询ICCID
returns the ICCID (Integrated Circuit Card Identifier) number of the SIM card.
write:AT+QCCID ec20 read[38]: +QCCID: 89966060990139233923 OK
9) 查询IMSI
Request International Mobile Subscriber Identity (IMSI)
write:AT+CIMI ec20 read[25]: 420060013923392 OK McGetImsi:code param is 420060013923392 OK
10) 查询信号质量
AT+CSQ: Signal Quality Report
write:AT+CSQ ec20 read[21]: +CSQ: 31,99 OK
2. 断开sockeet服务和Deactivate PDP Context
AT+QICLOSE: Close Socket Service
AT+QIDEACT: Deactivate PDP Context
write:AT+QICLOSE=0 ec20 read[6]: OK 000 0d 0a 4f 4b 0d 0a write:AT+QIDEACT=1 ec20 read[6]: OK
3. AT+QICSGP配置APN
Configure the <APN>, <username>, <password> and other contexts by AT+QICSGP
write:AT+QICSGP=1,1,"lebara","","",1 ec20 read[6]: OK
4. CFUN切换
AT+CFUN controls the functionality level. It can also be used to reset the UE(User Equipment
)
)
5. CFUN切换之后,查询当前网络状态:
AT+COPS?, AT+CGREG?, AT+QENG="servingcell
AT+COPS: returns the current operators and their status and allows to set automatic or manual network
selection.
AT+QENG:Switch on/off Engineering Mode
6. AT+QIACT=1 拨号,AT+QIACT? 查询拨号结果
AT+QIACT:Activate PDP Context
write:AT+QIACT=1 ec20 read[6]: OK write:AT+QIACT? ec20 read[39]: +QIACT: 1,1,1,"10.203.75.182" OK
7. AT+QIOPEN:连接TCP服务器及查询连接状态
AT+QIOPEN:Start Socket Service
write:AT+QIOPEN=1,0,"TCP","46.251.153.210",8900,0,1 ec20 read[6]: OK write:AT+QISTATE=1,0 ec20 read[67]: +QISTATE: 0,"TCP","46.251.153.210",8900,0,1,1,0,1,"uart1" OK
+QIOPEN: 0,0
8. AT+QNWINFO: 查询连接的网络信息
AT+QNWINFO:Query Network Information
write:AT+QNWINFO
ec20 read[72]: +QNWINFO: "FDD LTE","42003","LTE BAND 20",1850 OK