-
Notifications
You must be signed in to change notification settings - Fork 165
Sequans modem won't attach and reports unusual AT command response - EXIT: File: rfcChar.c@107 #308
Description
(sysname='GPy', nodename='GPy', release='1.20.0.rc11', version='v1.9.4-0a38f88 on 2019-05-14', machine='GPy with ESP32')
Using the connection code below I am able to connect using an older sequans firmware (40343) but not with the latest one (41019) I saw this with a single G01 based board and reported problem in #303 but then was able to get a some fipys and another g01 based board working so put it down to hardware. Now I have a second G01 based board with the same problem.
The COPS AT command often times out but with the older firmware I eventually get a connection. With the newer firmware I get '^EXIT: File: rfcChar.c@107' and the modem stops trying to attach
Here's a sample output with the older firmware:
ccid = 898823900xxxxxxxxxxxxxx
'\r\nOK\r\n\r\n+SHUTDOWN\r\n'
'\r\n+SYSSTART\r\n'
'\r\nOK\r\n\r\n\r\nOK\r\n'
'\r\n\r\nOK\r\n'
'\r\nOK\r\n'
'\r\nOK\r\n'
'+CEREG: 2,0OK'
'ERROR'
'+CEREG: 2,0OK'
''
''
''
''
''
''
' 2,5,"2332","05834820",9OK+CFUN: 1OKOK+CEREG: 2,5,"2332","05834820",9OK+COPS: 1,2,"27201",9OKERRORERROR'
attached 5
connected 0
32
172.217.19.196
Here's the same board/firmware/code/simcard with the later sequans firmware:
ccid = None
ccid = 8988239xxxxxxxxxxxxxx
'\r\nOK\r\n\r\n+SHUTDOWN\r\n'
'\r\n+SYSSTART\r\n'
'\r\nOK\r\n\r\n\r\nOK\r\n'
'\r\n\r\nOK\r\n'
'\r\nOK\r\n'
'\r\nOK\r\n'
'OKERROR+CEREG: 2,0OK+CFUN: 1OKOK+CEREG: 2,0OK'
'ERROR'
'+CEREG: 2,2OK'
''
''
'^EXIT: File: rfcChar.c@107'
'+SYSSTART'
'ERROR'
'OKERROR+CEREG: 2,0OK+CFUN: 1OKOK+CEREG: 2,0OK'
'ERROR'
'+CEREG: 2,0OK'
the code (which contains some unnecessary/redundant AT commands) looks like this. This code works on some fipys and G01 based boards with the latest firmware.
from network import LTE
from machine import WDT
import time
import socket
wdt=WDT(timeout=20000000)
lte = LTE()
for i in range(3):
ccid=lte.iccid()
print ("ccid = " + str(ccid))
if ccid:
break
time.sleep(1)
lte.pppsuspend() # can't send AT commands while in data mode
lte.send_at_cmd('AT^RESET')
lte.send_at_cmd('AT+CFUN=0')
lte.send_at_cmd('AT!="RRC::addScanBand band=20"')
lte.send_at_cmd('AT!="disablelog 1"')
lte.send_at_cmd('AT+CGDCONT=1,"IP","nb.inetd.gdsp"')
lte.send_at_cmd('AT+CFUN=1')
lte.attach(band=20,apn="nb.inetd.gdsp")
for j in range(10):
time.sleep(1)
if lte.isattached():
print("attached "+str(j))
break
lte.send_at_cmd('AT+CEREG?').replace('\r\n','')
outstr=lte.send_at_cmd('AT+COPS?').replace('\r\n','')
if not "27201" in outstr:
outstr=lte.send_at_cmd('AT+COPS=1,2,"27201"').replace('\r\n','')
lte.send_at_cmd('AT+COPS=1,2,"27201"').replace('\r\n','')
else:
print("COPS OK")
lte.connect()
for i in range(10):
if lte.isconnected():
print("connected "+str(i))
break
packet = b'$\x1a\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x03www\x06google\x03com\x00\x00\x01\x00\x01'
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.settimeout(20)
s.connect(("8.8.8.8", 53))
s.send(packet)
resp=s.recv(100)
result=False
if (len(resp)>34):
ip=resp[-4:]
result=str(ip[0])+'.'+str(ip[1])+'.'+str(ip[2])+'.'+str(ip[3])
print(str(result))