nRF91 AT%XICCID Command Caching & Parsing

The custom AT command "AT%XICCID" was added in modem firmware v1.1.3 for the nRF9160 and was available from the first release for the nRF91x1.

This command provides a processed (digits correctly ordered) and cached copy of the SIM's ICCID making it available even if the SIM is powered off (e.g. in CFUN=0 state).

However, there might be an issue with the cached copy when querying this command after changing the active UICC slot using the AT%CSUS command.

In my testing when I switched between a virtual UICC (AT%CSUS=2) to the physical SIM slot 1 (AT%CSUS=0), the reported ICCID (using %XICCID) was not updated until I powered the physical SIM again by entering a CFUN=1 or similar state. Perhaps the cached XICCID value should be invalidated, or updated, when a %CSUS operation switches between UICCs.

The second issue I have encountered is with trying to parse the output of the AT%XICCID command.

Specifically, it cannot be handled using the 'at_parser' library. Previously it was possible to use the 'at_param_list' library, but that was deprecated / removed from v2.8.0. The issue is that the 'at_parser' library will not allow for a token which starts with a numeric digit to be processed as a string, unless the token is wrapped in double quotes. Additionally, the numeric value of the ICCID is too large to fit in the largest INT64 type and so cannot be parsed as number. Right now, I have to treat parsing of this result as a special case using sscanf().

The 'at_parser' library could be modified to allow AT_TOKEN_TYPE_INT to be parsed as a string, however, this might introduce other issues.

Alternatively, the %XICCID output could wrap the result in double quotes. Perhaps for compatibility the command should take a parameter in a similar way that the AT+CGSN command does, i.e. AT%XICCID=1 would provide the result with the double quotes, allowing for backwards compatibility, resulting in:

AT%XICCID
%XICCID: 8901234567012345678F
OK

AT%XICCID=1
%XICCID: "8901234567012345678F"
OK

Parents Reply Children
  • Hi,

    In my testing when I switched between a virtual UICC (AT%CSUS=2) to the physical SIM slot 1 (AT%CSUS=0), the reported ICCID (using %XICCID) was not updated until I powered the physical SIM again by entering a CFUN=1 or similar state. Perhaps the cached XICCID value should be invalidated, or updated, when a %CSUS operation switches between UICCs.

    AT does not have SIM slot related control. It just assumes that data comes from correct SIM/cache.
    This is what documentation states about %CSUS:

    All Universal Subscriber Identity Module (USIM) and UICC activity is directed to the selected slot the next time the modem or UICC is activated. The slot covers also Soft SIM solutions, such as virtual iUICC, in addition to physical UICC slot.

    After CSUS change, XICCID returns the initial SIM card's data until new SIM is activated. Cache value is expected to be updated when card is activated. We will have further internal discussion related to possible XICCID value invalidation or update.

    Due to vacations, delayed replies should be expected. I expect to get back to you at the end of July or at the beginning of August. Thank you for your patience and understanding.

    Best regards,
    Dejan

Related