1 引言
最近朋友把国内的设备拿到新加坡了,然后发现原本国内可以使用的设备无法在异国他乡联网,所以就叫我来看看,发现是附网返回状态、入网APN发生了改变导致的。另外,如果在境外使用国产4G模组拨号入网,也需要关注4G模组与本地基站是否能匹配上,如是否支持cat1以及当地基站是否支持模组支持的band(通过硬件手册可以查看到,如下图示)。
2 AT拨号实验
(1)在新加坡使用中国移动卡,AT拨号log如下:
[ Debug]: 1970-01-01 08:04:42, ML302_IO_Send:93: requests :: AT
[ Debug]: 1970-01-01 08:04:43, ML302_AsycnProcess:1501: >RCV:10:AT
OK[ Debug]: 1970-01-01 08:04:43, ML302_IO_Send:93: requests :: ATE0[ Debug]: 1970-01-01 08:04:43, ML302_AsycnProcess:1501: >RCV:12:ATE0
OK[ Info]: 1970-01-01 08:04:43, ML302_IsExist:618: find ml302 device
[ Debug]: 1970-01-01 08:04:46, ML302_IO_Send:93: requests :: AT+CGATT=0 //取消附着网络[ Debug]: 1970-01-01 08:04:47, ML302_AsycnProcess:1501: >RCV:6:
OK[ Debug]: 1970-01-01 08:04:47, ML302_IO_Send:93: requests :: AT+CGDCONT=1,"IP","cmnet" //设置apn[ Debug]: 1970-01-01 08:04:47, ML302_AsycnProcess:1501: >RCV:6:
OK[ Debug]: 1970-01-01 08:04:47, ML302_IO_Send:93: requests :: AT+CGATT=1 //附着网络[ Debug]: 1970-01-01 08:04:53, ML302_AsycnProcess:1501: >RCV:6:
OK[ Debug]: 1970-01-01 08:04:53, ML302_IO_Send:93: requests :: AT+CEREG? //查询网络注册状态[ Debug]: 1970-01-01 08:04:54, ML302_AsycnProcess:1501: >RCV:21:
+CEREG: 0,5 //注册成功5表示漫游
OK[ Debug]: 1970-01-01 08:04:54, ML302_IO_Send:93: requests :: AT+CEREG?[ Debug]: 1970-01-01 08:04:55, ML302_AsycnProcess:1501: >RCV:21:
+CEREG: 0,5
OK
上述发现,查看网络注册状态时,返回的是漫游状态,与境内的不一致。
所以,代码在判断返回值时需要注意。
(2)使用新加坡本地电信卡,AT拨号时需要注意
如果使用AT+CGDCONT=1,"IP","e-ideas" (电信的一个APN接入点),遇到了拨号不成功,
[ Debug]: 2024-07-06 15:42:05, ML302_IO_Send:93: requests :: AT
[ Debug]: 2024-07-06 15:42:06, ML302_AsycnProcess:1501: >RCV:10:AT
OK[ Debug]: 2024-07-06 15:42:06, ML302_IO_Send:93: requests :: ATE0[ Debug]: 2024-07-06 15:42:06, ML302_AsycnProcess:1501: >RCV:12:ATE0
OK[ Info]: 2024-07-06 15:42:06, ML302_IsExist:618: find ml302 device
[ Debug]: 2024-07-06 15:42:09, ML302_IO_Send:93: requests :: AT+CGATT=0[ Debug]: 2024-07-06 15:42:10, ML302_AsycnProcess:1501: >RCV:6:
OK[ Debug]: 2024-07-06 15:42:10, ML302_IO_Send:93: requests :: AT+CGDCONT=1,"IP","e-ideas" //怀疑是apn名字有-,导致模组设置失败[ Debug]: 2024-07-06 15:42:10, ML302_AsycnProcess:1501: >RCV:6:
OK[ Debug]: 2024-07-06 15:42:10, ML302_IO_Send:93: requests :: AT+CGATT=1[ Debug]: 2024-07-06 15:42:16, ML302_AsycnProcess:1501: >RCV:6:
OK[ Debug]: 2024-07-06 15:42:16, ML302_IO_Send:93: requests :: AT+CEREG?[ Debug]: 2024-07-06 15:42:17, ML302_AsycnProcess:1501: >RCV:21:
+CEREG: 0,1
OK[ Debug]: 2024-07-06 15:42:17, ML302_IO_Send:93: requests :: AT+CGACT=1,1[ Debug]: 2024-07-06 15:42:18, ML302_AsycnProcess:1501: >RCV:17:
+CME ERROR: 3 //返回OPERATION_NOT_ALLOWED错误[ Debug]: 2024-07-06 15:42:18, ML302_IO_Send:93: requests :: AT+CGACT=1,1[ Debug]: 2024-07-06 15:42:19, ML302_AsycnProcess:1501: >RCV:17:
+CME ERROR: 3 //返回OPERATION_NOT_ALLOWED错误
此时,更换另外一个电信的APN接入点,AT+CGDCONT=1,"IP","hicard" (电信另一个APN接入点)就可以了。
上图中,看就名字不同,其它信息一致。使用hicard后就成功了。
3 后记
最近工作忙,太久没来更新文章了,后期计划把这段时间工作的内容总结一下,主要是Lora无线通信技术入门的心得,希望通过总结让自己更系统的掌握Lora相关技术吧。
over!