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)
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?
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 . 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…
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.
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
{
gprs_inputSimPin();
}
}
Note that this code is based upon the WIP sample code provided with the following mods:
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
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
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
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.