Pycom GPy fails to attach with Things Mobile SIM
-
System info:
os.uname()
(sysname='GPy', nodename='GPy', release='1.20.2.r4', version='v1.11-ffb0e1c on 2021-01-12', machine='GPy with ESP32', pybytes='1.6.1')
Modem firmware version
sqnsupgrade.info()
:<<< Welcome to the SQN3330 firmware updater [1.2.6] >>> >>> GPy with firmware version 1.20.2.r4 Your modem is in application mode. Here is the current version: UE5.2.0.3 LR5.2.1.0-48829 +CEREG: 80
I have been trying to attach a Pycom GPY to the network with a Things Mobile SIM card. The code that I am using is based on the tutorial found here.
My code:
from network import LTE import time import socket # bands # GPy supports: 3, 4, 12, 13, 20, 28 lte = LTE(debug=True) print(lte.send_at_cmd('AT^RESET')) print(lte.send_at_cmd('AT+CFUN=0')) print(lte.send_at_cmd('AT!="clearscanconfig"')) print(lte.send_at_cmd('AT!="RRC::addScanBand band=20"')) print(lte.send_at_cmd('AT+CGDCONT=1,"IP","TM"')) print(lte.send_at_cmd('AT+CFUN=1')) #lte.attach(apn="TM", band=20) print("imei: " + str(lte.imei())) print("iccid: " + str(lte.iccid())) print("attaching..",end='') lte.init(debug=False) rsrpq = None fsm = None while not lte.isattached(): rsrpq2 = lte.send_at_cmd('AT+CESQ').strip() if rsrpq2 != rsrpq: rsrpq = rsrpq2 print(time.time(), rsrpq) fsm2 = lte.send_at_cmd('AT!="fsm"').strip() if fsm != fsm2: fsm=fsm2 print(time.time(), fsm) time.sleep(0.1) print(time.time(), "attached")
When trying to attach the FSM log shows that
RCC TOP FSM
goes fromSCANNING
toSYNCING
toCAMPING
and finallyCAMPED
. This cycle runs endlessly.One full cycle log:
416 SYSTEM FSM ========== +--------------------------+--------------------+ | FSM | STATE | +--------------------------+--------------------+ | RRC TOP FSM |SCANNING | | RRC SEARCH FSM |WAIT_RSSI | | RRC ACTIVE FSM |NULL | | PMM PLMN FSM |NORM_WAITCELL | | EMM MAIN FSM |NULL | | EMM AUTH FSM |NULL | | EMM CONN FSM |NULL | | EMM TAU FSM |NULL | | EMM TEST FSM |NULL | | ESM BEARER FSM |BEARER_NULL | | SMS MT FSM |IDLE | | SMS MO FSM |IDLE | | LPP FSM |IDLE | | HP MAIN FSM |IDLE | | HP USIM FSM |READY | | HP SMS MO FSM |IDLE | | HP SMS MT FSM |IDLE | | HP CAT FSM |IDLE | +--------------------------+--------------------+ OK 421 SYSTEM FSM ========== +--------------------------+--------------------+ | FSM | STATE | +--------------------------+--------------------+ | RRC TOP FSM |SCANNING | | RRC SEARCH FSM |WAIT_CELL_ID | | RRC ACTIVE FSM |NULL | | PMM PLMN FSM |NORM_WAITCELL | | EMM MAIN FSM |NULL | | EMM AUTH FSM |NULL | | EMM CONN FSM |NULL | | EMM TAU FSM |NULL | | EMM TEST FSM |NULL | | ESM BEARER FSM |BEARER_NULL | | SMS MT FSM |IDLE | | SMS MO FSM |IDLE | | LPP FSM |IDLE | | HP MAIN FSM |IDLE | | HP USIM FSM |READY | | HP SMS MO FSM |IDLE | | HP SMS MT FSM |IDLE | | HP CAT FSM |IDLE | +--------------------------+--------------------+ OK 433 SYSTEM FSM ========== +--------------------------+--------------------+ | FSM | STATE | +--------------------------+--------------------+ | RRC TOP FSM |SYNCING | | RRC SEARCH FSM |WAIT_SYNC | | RRC ACTIVE FSM |NULL | | PMM PLMN FSM |NORM_WAITCELL | | EMM MAIN FSM |NULL | | EMM AUTH FSM |NULL | | EMM CONN FSM |NULL | | EMM TAU FSM |NULL | | EMM TEST FSM |NULL | | ESM BEARER FSM |BEARER_NULL | | SMS MT FSM |IDLE | | SMS MO FSM |IDLE | | LPP FSM |IDLE | | HP MAIN FSM |IDLE | | HP USIM FSM |READY | | HP SMS MO FSM |IDLE | | HP SMS MT FSM |IDLE | | HP CAT FSM |IDLE | +--------------------------+--------------------+ OK 433 SYSTEM FSM ========== +--------------------------+--------------------+ | FSM | STATE | +--------------------------+--------------------+ | RRC TOP FSM |CAMPING | | RRC SEARCH FSM |WAIT_SIB1 | | RRC ACTIVE FSM |NULL | | PMM PLMN FSM |ANY_WAITCELL | | EMM MAIN FSM |NULL | | EMM AUTH FSM |NULL | | EMM CONN FSM |NULL | | EMM TAU FSM |NULL | | EMM TEST FSM |NULL | | ESM BEARER FSM |BEARER_NULL | | SMS MT FSM |IDLE | | SMS MO FSM |IDLE | | LPP FSM |IDLE | | HP MAIN FSM |IDLE | | HP USIM FSM |READY | | HP SMS MO FSM |IDLE | | HP SMS MT FSM |IDLE | | HP CAT FSM |IDLE | +--------------------------+--------------------+ OK 434 +CESQ: 99,99,255,255,8,57 OK 434 SYSTEM FSM ========== +--------------------------+--------------------+ | FSM | STATE | +--------------------------+--------------------+ | RRC TOP FSM |CAMPED | | RRC SEARCH FSM |CAMPED_ANY | | RRC ACTIVE FSM |IDLE | | PMM PLMN FSM |ANY_CAMPED | | EMM MAIN FSM |NULL | | EMM AUTH FSM |NULL | | EMM CONN FSM |NULL | | EMM TAU FSM |NULL | | EMM TEST FSM |NULL | | ESM BEARER FSM |BEARER_NULL | | SMS MT FSM |IDLE | | SMS MO FSM |IDLE | | LPP FSM |IDLE | | HP MAIN FSM |IDLE | | HP USIM FSM |READY | | HP SMS MO FSM |IDLE | | HP SMS MT FSM |IDLE | | HP CAT FSM |IDLE | +--------------------------+--------------------+
I have also tried another SIM card from a different operator (and changed APN setting). With both SIM cards I tried using different bands with the same result.
I know that the first time attaching it might take a long while (Pycom guides say ~30m). But in some occasions it has been running for ~1h 30m with no luck.