Stupid problem with adl_simSubscribe

Hy all,

I’ve this stupid problem that make me crazy…

If my sim card have no PIN and if i pass NULL as second parameter of adl_simSubscribe my application doesn’t receive any event from the sim,while if I have the PIN and enter it correctly in adl_simSubscribe everything works fine.

Any ideas? Is NULL correct for NO Pin?

In the documention I found that if PIN is NULL or incorrect the application waits for it from external application.

So…Which value is correct for NO pin?? (I’ve already tried even with empty string but same behaviour)



Yes, NULL works fine for me on SIMs with no PIN:

// Subscribe to the SIM Service (no PIN)
    adl_simSubscribe( my_sim_handler, NULL );


I have the same problem in a few cases. I am using Q2686H with a lot of different SIMs and always I use SIMs with no PIN.
In the code, I have written:

adl_simSubscribe( sim_handler, "0000" );

It always works fine against twice. The first time I thought it was a SIM trouble, so I did a copy of the SIM and it worked fine; but now I start to be worried about it. Why it happens? Does it depend on the type of the SIM card?

Any ideas¿?

Thank you.

But no PIN is quite different from a PIN of 0000, isn’t it?

Thanks awneil for your replay.

Yes, it is, but I thought when it has no PIN, PinCode field of adl_simSubscribe doesn´t have influence; and it allways works fine.
Anyway, yesterday I changed it and I test with

adl_simSubscribe( sim_handler, NULL);

with the same result. My application didn´t receive any SIM event.


Are you executing in Debug (RTE) mode? Sometimes in Debug mode, the SIM FULL INIT is received before the Open AT application actually starts :exclamation: . So SIM events will be missed. But if you enable the PIN, the SIM initialization starts after the Open AT Application starts and so you don’t have any issues. In target mode, you will not face this problem…

Maybe this is the problem…

Thanks a lot,I will check it

Hi everyone

I am having the same problem with my adl_simSubscribe.

I have subscribed to adl_atCmdSubscribe to create my own at command which after it is sent to the modem, it must start up GPRS. Well, it does start up GPRS but does not get into the sim event function. May you please help me with my problem as i am running out of solutions.


gugulethu :frowning:


This is how I get around the startup timing issues when dealing with SIM initialization. gprs_openBearer is called from my 10 second start delay timer routine…

void gprs_openBearer()
    adl_simState_e mySimState;

    mySimState = adl_simGetState();

    TRACE (( MAIN_TRACE_GPRS, "(gprs_openBearer)SIM State = %d", mySimState ));

                                        // need to wait for SIM to initialize
                                        // and subscribe to SIM handler
                                        // test if SIM required in gprs_simHandler
    adl_simSubscribe( gprs_simHandler, (ascii *)NULL);

    if( mySimState == ADL_SIM_EVENT_FULL_INIT  )    // SIM already OK, go straight to AT+CREG?
        gprs_pollCreg( 0 ); /* argument 0 is dummy, see poll_reg() "Object" comment */

    if ( mySimState == ADL_SIM_EVENT_PIN_WAIT )     // waiting for SIM PIN


Note that this code is based upon the WIP sample code provided with the following mods:

  1. Check the state of the SIM first off. If it is already initialized, you will not get the ADL_SIM_EVENT_FULL_INIT event in the sim handler, so we need to deal with this state ourselves
  2. When subscribing to the SIM handler, DON’T set a PIN - even if the SIM card requires a PIN. This will ensure that we will get ALL SIM events for the duration of the subscription
  3. Check if the SIM state is ADL_SIM_EVENT_FULL_INIT - if it is, then a SIM PIN is not required so head off to check that the Network (AT+CREG?) is up and continue processing
  4. Check if the SIM state is ADL_SIM_EVENT_PIN_WAIT - if so, programmatically enter the PIN (using adl_simEnterPIN()), and then the ADL_SIM_EVENT_FULL_INIT will be caught by the sim handler subscribed earlier

This works fine for me - every time - if there is a SIM PIN required or not.

ciao, Dave