Read ICCID Not Working



  • We have just finished our design and PCB layout using the GPy. Everything was working great. I decided to upgrade the modem firmware to 41065. We're running release candidate v1.20.0.rc9. Now the lte.iccid() command is no longer working after a modem reset and init. If you attach to the cell network, the iccid() command then works. In our design we use the ICCID returned value to determine the proper APN to use in the attach command. Now we can't read the ICCID until we properly attach. Below is the sequence that doesn't work. I've also tried just querying the modem with the AT+SQNCCID? command, but that returns a null string until the modem is attached.

    Does anyone have any ideas how to read the SIM's ICCID value before attaching? This used to work.

    from network import LTE
    lte = LTE()
    lte.reset()
    LTE.reconnect_uart()    #in the past this command would fix problem, now it doesn't
    lte.init()
    lte.iccid()    # does not work!
    lte.send_at_cmd('AT+SQNCCID?')   # this returns null string for ICCID
    lte.attach(apn='10569.mcs')
    lte.iccid()    # now it works!
    


  • Below is the revised code that now works. I'm going to repost this in a more appropriate location on forum in hopes that the problem may be seen by someone who can fix it.

    from network import LTE
    lte = LTE()
    lte.reset()
    lte.init()
    sleep_ms(1500)
    iccid = lte.iccid()    # does not work
    lte.attach(apn='unknown')    # attempt attach so iccid() will work
    sleep_ms(1500)
    iccid = lte.iccid()    # iccid() now works
    lte.detach(reset=False)
    # compute apn from iccid
    lte.attach(apn=computed_apn)    # attach  with correct apn
    


  • Regrettably, I see I've posted the message to the wrong section of the forum.

    I have discovered a workaround to the problem.

    By adding a dummy call to the attach function, I can resolve my problem.

    Revised code below:

    from network import LTE
    lte = LTE()
    lte.reset()
    lte.init()
    sleep_ms(1500)    # not sure why delay is needed
    lte.attach(apn='unknown')    # this will fail since apn is invalid
    sleep_ms(1500)    # not sure why delay is needed
    iccid = lte.iccid()    # iccid now works
    # compute apn from iccid
    lte.attach(apn=computed_apn)    # attach now works

Log in to reply
 

Pycom on Twitter