How to block a PIN on sim/uicc

463 Views Asked by At

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

2

There are 2 best solutions below

3
On BEST ANSWER

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.

1
On

I found a solution for the Sierra EMEM7565 modem.
Selecting the secondary SIM interface disables the power for the first interface.
This is effectivly a reset for the SIM card.

AT!UIMS=1   -- Select active SIM interface 1
... wait 1 second
AT!UIMS=0   -- Select active SIM interface 0

It can also achieved by

AT+CFUN=0   -- Power Down Sim
AT+CFUN=1   -- Power Up Sim

but this only works, when the SIM power state during Low Power Mode is configured to 2 = Power down SIM with AT+CFUN=0;.
That can be done by AT!CUSTOM="SIMLPM",2 but requires also that the access to password-protected commands was enabled before with at!entercnd="<pwd>".

Therefore, the solution with AT!UIMS=1 followed by AT!UIMS=0 seems the better one.