Search code examples
at-commandmodemumtspin-code

How to block a PIN on sim/uicc


I try to automate some tests, and the tests shall verify the unblocking of the pin, but to repeat the test, the pin should be blocked again.

I can't find a way (except reset) to block the pin again.
Even the specs like ETSI TS 102 221, mentions only how to unblock,enable, disable the pin.

Why the hell something simple as block/logout isn't described anywhere?

Reset works (a modem reset, by AT!RESET), but it's very slow and seems to be a nasty solution (Nowadays, it's even possible to logout from windows without restarting the PC).

Additional informations: I hoped for a general solution with a standard modem command or at least with a standard SIM command like AT+CSIM=....
But it seems there aren't any, so the solution depends on the modem/manufacturer.

In my case I'm using a Sierra EM7565


Solution

  • Unfortunately you are right when you say that the specification never describes a standard way to set PIN pending status again in the SIM used by a cellular modem

    The recommended solution is a reset of the modem. When you write

    Reset works, but it's very slow and seems to be a nasty solution (Nowadays, it's even possible to logout from windows without restarting the PC).

    you probably refer to the host PC reset, and I agree that it might bee to slow. But you are not required to reset the host as long as you can reboot the modem.

    You could either

    • Remove its power supply, and this for sure will remove SIM's power supply as well. This depends of course on the way your device is connected to the host.
    • Provide an AT command for the device reboot. Usually all vendors have a custom command performing this action. For example Telit modules support command AT+REBOOT that reboot both modem and SIM status.

    A creative solution: +CFUN=4/+CFUN=1

    I tried to find another solution on two of my Telit modems, belonging to GE910 and LE910 families. Only for the first one it worked. For this reason I cannot guarantee it will work for every cellular modem in the world.

    As explained in the title, the solution consists in providing in sequence

    AT+CFUN=4
    AT+CFUN=1
    

    +CFUN command sets the phone functionality. The first command switches off RF, the second one restores full functionality mode.

    But +CFUN=4 command is commonly used as some sort of power saving mode, so that powering off the SIM provides a further power consumption reduction. This is what happens in my GE910-QUAD module.

    For this reason it might work also for the uspecified device you are using.