2

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

jeb
  • 78,592
  • 17
  • 171
  • 225
  • 1
    I would probably be able to help you... but it is difficult during Christmas holiday without a module in my desk. In the meanwhile: what's wrong with reset? It usually takes about 1s to complete it. – Roberto Caboni Dec 23 '19 at 17:56
  • @Cubo78 That would be great. Currenty I'm not at work, too. But your comment make me rethink of my reset. (I'm on a Linux system) Currently I reset the modem, that results into temporarily disappearing the device `/dev/ttyUSB2` and reappearing after some seconds, probably some service is involved there. But when I only reset the sim card that problem shouldn't occur – jeb Dec 24 '19 at 11:32
  • Hw resetting your sim card, if you have access to those pins (GPIOs?), will probably be enough. – Roberto Caboni Dec 24 '19 at 11:48

2 Answers2

2

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.

Roberto Caboni
  • 7,252
  • 10
  • 25
  • 39
  • 1
    Thanks for the suggestions. Currently I do a modem reset, but that is slow, as on my Ubuntu this results into a removal of the /dev/ttyUSBx and after some time the device is coming back. I hoped that there exists at least a general way to reset only the SIM, but Monday I will try your `AT+CFUN=4/1` tip. – jeb Jan 03 '20 at 18:57
  • Telit modules actually do have some way to reset the SIM, through custom commands. I omitted them because I was trying to provide a solution using only standard commands. – Roberto Caboni Jan 03 '20 at 19:47
  • 1
    Your solution `AT+CFUN=4` followed by `AT+CFUN=1` doesn't work with my modem. But you pointed me to the right direction. Thanks – jeb Jan 06 '20 at 09:41
0

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.

jeb
  • 78,592
  • 17
  • 171
  • 225
  • I understand. Anyway using custom commands (I was trying to use standard ones) there's a 100% working solution also for Telit devices, using #SIMDET comnand. I will update my answer tomorrow. – Roberto Caboni Jan 06 '20 at 10:27