AT+CLCK=SC,2: answer changes after reboot

14 thoughts on “AT+CLCK=SC,2: answer changes after reboot

  1. Hello everyone,


     AT+CLCK=SC,2 command is supposed to let us know if the sim card is protected by a pin code. (at least this is what I understood…)


    After a cold start: +CLCK: 1, meaning the card IS protected, as expected, because it is actually protected.


    Then, command AT+CPIN+XXXX, (XXXX is the pin code) makes the sim card ready: AT+CPIN? command returns+CPIN: READY.

    And of course,  AT+CLCK=SC,2 still answers +CLCK:1, which is true.



    After a hot start is performed (eg using at#reboot), the AT+CLCK=SC,2 command returns +CLCK:0.



    Thank you in advance for your help,




      1. Hello Cosmin,


        Thank you for your reply. Firmware version is 10.00.004, module is GE865 Quad.


        Our sim cards provider provides us with unprotected cards.

        What I would like to achieve is to have a simple test at every startup:


         if +CCLK=SC,2 returns CLCK: 0:

        activate sim protection with AT+CLCK=SC,1,XXXX


         if +CCLK=SC,2 returns CLCK: 1:

        enter pin code using AT+CPIN=XXXX


        I cannot use +CPIN instead of +CLCK because after a hot reboot, CPIN will answer “READY”, as if there was no pin protection, which would be false, and thus trying to setup the pin protection using +CLCK=SC,1,XXXX would return an error.

        Of course I could ignore this error, and analyze it as the result of a hot reboot situation, but I wondered it there could be a better solution for this.


        Any idea?





        1. I would suggest to not use the AT#REBOOT in this case since it reboots just part of the software but for example not the SIM.

          An HW reset with the RESET line or an AT#SHDN and ON/OFF to power cycle the module, it would be better.


          Also the sequence AT#SIMDET=0, 5s pause, AT#SIMDET=1/2 should do the job since it deactivates and activates again the SIM,

          1. Hello,


            I’m back with a new issue related to pin code protection.

            As already said, the idea is to automatically protect sim cards at first module boot. (theses cards are delivered unprotected, with pin code set to 0000).


            So the idea is:

            1- check the sim card protection:



            then, if the card is not protected (if answer is +CLCK=0):


            2- Activate SC protection with current pin code:



            3- Change pin code to the secret one:



            Unfortunately, this last command makes the GE865 reboot.

            Any idea of where am I wrong?




          2. Hello,


            1- No I did not try a more recent firmware. Should iI?


            2- I can say the module reboots because I have logs on my screen. I even tried to disable watch dog, with no result.





          3. Is always better to use the latest firmware if possible, 10.00.005 being the latest production one.


            Is still not clear how you conclude the reset occurs. Do you monitor a certain line, a certain settings?

          4. I’m not sure to understand your question about how I know it reboots:


            Say I run a python script, at the begin of this script there is a instruction to send a string like ‘Starting…’  to the serial port. This serial port is connected to a pc running a terminal program, so I can see this string, among others, on my screen.


            I guess I’m not the only one to do this way???

          5. Ah Python, you should mention this in the first place. Can you show the relevant part of the code maybe?


          6. if "AT+CLCK=SC,2" replies "+CLCK=0":



            #until here everything is ok…


             #but the script never arrives here


            (f3.mdm_send(a,b,c,d)       sends "a" to MDM and waits "b" to be answered. Result is waited "d" times, everytime "c" 1/10s.)



          7. Just verified again with the command sequence:







            No reboot occurs, firmware version 10.00. 005.


            Maybe is something in your code, BTW AT commands must be terminated only by r not rn.


          8. Hello Cosmin,


            I finaly rewrited this part and could make it work (with 10.00.004 firmware) , but I still did not understand the previous code behaviour…I’ve been working for some time with python on GE865 and never faced that before!


            Thank you for r instead of rn.


            (Beside this, I found code pin management a little bit touchy! )


            Have a nice day, Cosmin, thank you again.