[q2686] app. crashes on SIM removal


#1

Hello, I’m developing an app. that runs on
q2686h, firmware 663g00_full_q2686h.dwl , OpenAT 4.29.
Sometimes the app. crashes when the SIM is removed.
By the look of the backtrace it seems OAT is trying to communicate to the SIM which is absent and trips the watchdog.
Maybe I’m wrong? This dosn’t happen when the app. is not running. Maybe its me, not the OAT?

ADS Bckt -------> ADS BACK TRACE <-------
Trace CUS3 1 [Task 0] opec_cusTaskParser
Trace CUS3 1 [Task 0] pAppliMsgRec->Length : 1
Trace CUS3 1 [Task 0] pAppliMsgRec->MsgTyp : 0
Trace CUS3 1 [Task 0] pAppliMsgRec->Body.OSTimer.Ident : 19
Trace CUS3 1 Watch dog reset. Tsk 2
Trace CUS3 1 Watch dog reset. Tsk 2
Trace SYS 1 OAT Task index : 0
Trace SYS 1 Watch dog reset. Tsk 27
Trace HAC 1 Watch dog reset. Tsk 26
Trace SYS 1 Current OAT Task index : 0
Trace CUS4 1 ARM Data Abort at 002942D6, Current Task 0x1B
Trace SYS 1 Current OAT Task index : 0
Trace SIM 1 ! SIM_HAND_MBX guard timer expiry


#2

Is your app doing something that relies upon the SIM, without checking first that the SIM is available?


#3

The app. subscribes to SIM on startup,
every minute at+cimi is issued, and resp. handler is watching for cme: 10, cme 13. The app. reboots if SIM dosn’t respond to at+cimi propperly for 5 min.
to watch GSM events
adl_atUnSoSubscribe("+CREG:",(adl_atUnSoHandler_t)CREGhndlr);
adl_atCmdCreate(“AT+CREG=1”,FALSE,(adl_atRspHandler_t)CREGhndlr,"*",NULL);
subscribes to GPRS events(adl_gprsSubscribe)
waits for ADL_SIM_EVENT_FULL_INIT
attaches GPRS(at+cgatt=1)
waits for ADL_GPRS_EVENT_ME_ATTACH in the GPRS event handler
starts WIP GPRS bearer
waits for WIP_BEV_IP_CONNECTED
opens a client socket, waits for WIP_CEV_WRITE, sends data to a server every 2 sec.
The app. trys to keep the socket always opened.
On any bad events in GSM, GPRS, WIP bearer, at+cgatt response handler
the app. closes the socket, stops bearer, closes bearer, wip_netExit(), at+cgatt=0
starts over with GPRS attach(at+cgatt=1)
Thats it for actions concerning SIM.
There are other parts: GPS, SPI, AD storage where data is stored when connection to the server is not avaliable, but I don’t see how they can affect SIM.


#4

Hiya,

Sounds like you are getting into a busy-wait loop somewhere and tripping the internal watchdog.

You need to subscribe to SIM events (adl_simXXX()) as well, and check for SIM events that indicate the SIM card has gone missing, and wait for the SIM CARD to come back before restarting your WIP reconnection sequence.

ciao, Dave


#5

That’s a Bad Idea - Please read the section, “Inner AT Commands Configuration” in the ADL User Guide:

“these commands” in the above includes AT+CREG


#6

Hi awneil, sorry not answering for so long. Was rewriting GPRS managenet from chain of handles to state machine to make clear what happens when.

Right! There were busy waits I used for testing and forgot to remove! Funny they crashed the app so infrequently.


#7

Than kyou for pointing this out!