modem_info_string_get MODEM_INFO_ICCID returns -5 = EIO with new SDK if called before modem is connected

I'm seeing inconsistency in reading the ICCID from the nRF9160 modem with modem_info_string_get(MODEM_INFO_ICCID, mystr,strlen(mystr));.  All other modem_info calls work except this one. 

I call it early in my program to get the ICCID in order to activate the virtual SIMM at my cellular provider but have had issues with it coming up blank in the past. I had it working in Golioth SDK 0.12.0 w/Nordic SDK 2.5.2 and am porting my code to Golioth SDK 0.15.0 w/Nordic SDK 2.7 and it never returns any data.

This code will run forever returning code -5 = EIO = I/O error
If I call the code later in the program after the modem connects it will return a valid ICCID, but I need it earlier than that and it shouldn't be dependent on modem connection.


while((err = modem_info_string_get(MODEM_INFO_ICCID, mystr, STRLEN - 1)) <= 0) {
     LOG_ERR("Cannot read modem ICCID. err:%i line %i", err, __LINE__);
     k_msleep(500);
}

I've copied in the old 2.5.2 network_info.c&h files and it didn't make a difference so it's not an issue with the helper library.

  • Hi John,

    The acctually AT commands used for ICCID fatch is located here:

    https://github.com/nrfconnect/sdk-nrf/blob/5cb85570ca43bc344d3145c2338128eacf4b48ec/lib/modem_info/modem_info.c#L42

    I did a quick test with NCS 2.7.0+MFW 1.3.6, and it does require enable modem funcationalities to make this command work and this should not be affected by modem library on NCS side.

    Could you confirm which MFW are you using and it was not changed on your comparison?

    Ready
    > AT+CRSM=176,12258,0,0,10
    
    ERROR
    > AT+CRSM=176,12258,0,0,10
    
    ERROR
    > AT+CFUN?
    
    +CFUN: 0
    
    OK
    > AT+CFUN=1
    
    OK
    > AT+CRSM=176,12258,0,0,10
    
    +CRSM: 144,0,"98740006229082208xxx"
    
    OK
    > AT+CFUN=4
    
    OK
    > AT+CFUN?
    
    +CFUN: 4
    
    OK
    > AT+CRSM=176,12258,0,0,10
    
    ERROR

    Best regards,

    Charli

  • I'm also using modem firmware version: mfw_nrf9160_1.3.6 and have been for the last few months.

    The failure does follow the NCS firmware version so there must be some internal command or timing difference.  I have had issues with it in the past so it's some subtle change that I haven't been able to identify.

    What command do I need to run to get it to report the ICCID?  Shouldn't this be documented somewhere?

    It may or may not be related, but I also can not get the modem lib to initialized. It works in the sample code but fails in my source tree. Any ideas what might cause this to fail?

    nrf_modem_lib_init()

    [00:00:00.504,455] <err> nrf_modem: Modem library initialization failed, err -1
    [00:00:00.504,486] <err> lte_lc: Modem library init error: -1, lte_lc not initialized 

  • Hi John,

    jstuewe said:
    What command do I need to run to get it to report the ICCID?  Shouldn't this be documented somewhere?

    Restricted SIM access +CRSM is the standard 3GPP AT Commands for SIM related opeartion. You can check the specification at Specification # 51.011. For example, 12258= '2FE2' which point to the ICCID identifier in SIM.

    jstuewe said:
    It may or may not be related, but I also can not get the modem lib to initialized. It works in the sample code but fails in my source tree. Any ideas what might cause this to fail?

    No easy to identify just from the log.

    If SDK sample works but not your custom code, maybe you can do a side by side comparsion between them to check the difference. Pay attention to the modem related configurations in prj.conf file of smaple project. 

    Best regards,

    Charlie

Related