wip_bearerStart()... and then I break the WIP stack


#1

Hi

I sometimes get the condition where wip_bearerStart() returns -27 (in progress), but I never get any call-back to indicate success or failure. After 1 minute I grow tired of waiting and try to re-connect; I call wip_bearerStop(), which also returns -27 and no further call-backs.

Calling wip_bearerOpen() after this returns -21 (already open) and then wip_bearerStart() returns -28 (bad state). Still wip_bearerStop() returns -27.

If I call wip_bearerClose() it returns 0 (OK). wip_bearerOpen() now again returns 0, and wip_bearerStart() returns -29 (Error from link layer initialization).

Herewhit some debug (not the standard traces I see on this forum, but betetr than nothing)

(09:30:29.0) gsmctl: mx_gsmcontrolApnAttach wip_netInit() returns 0
(09:30:29.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerOpen() returns 0
(09:30:29.0) gsmctl: mx_gsmcontrolApnAttach "ci.co.za", "", ""
(09:30:29.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerSetOpts() returns 0
(09:30:29.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerStart() returns -27
                                                              // in progress
[ADL_CALL_EVENT_NO_CARRIER]
...
(09:31:37.0) gsmctl: mx_gsmcontrolApnAttach TIMEOUT
(09:31:37.0) gsmctl: GSMTriggerCommand GCMD_CLOSE_APN
(09:31:38.0) gsmctl: GSMControl : CmdAct=1 CmdId=2 EngMode=1
(09:31:38.0) gsmctl: mx_gsmcontrolSocketClose socket already closed
(09:31:38.0) gsmctl: mx_gsmcontrolApnClose wip_bearerStop() returns -27
                                                            // in progress
...
(09:32:37.0) gsmctl: GSMTriggerCommand GCMD_APN_ATTACH
(09:32:38.0) gsmctl: GSMControl : CmdAct=1 CmdId=7 EngMode=1
(09:32:38.0) gsmctl: mx_gsmcontrolApnAttach wip_netInit() returns 0
(09:32:38.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerOpen() returns -21
                                                             // already open
(09:32:38.0) gsmctl: mx_gsmcontrolApnAttach "ci.co.za", "", ""
(09:32:38.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerSetOpts() returns 0
(09:32:38.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerStart() returns -28
                                                              // bad state
(09:32:38.0) gsmctl: GSMTriggerCommand GCMD_CLOSE_APN
(09:32:39.0) gsmctl: GSMControl : CmdAct=1 CmdId=2 EngMode=1
(09:32:39.0) gsmctl: mx_gsmcontrolSocketClose socket already closed
(09:32:39.0) gsmctl: mx_gsmcontrolApnClose wip_bearerStop() returns -27
                                                            // in progress
...
(09:39:53.2) testAt: wip_bearerClose() returns 0
...
(09:40:45.0) gsmctl: GSMTriggerCommand GCMD_APN_ATTACH
(09:40:46.0) gsmctl: GSMControl : CmdAct=1 CmdId=7 EngMode=1
(09:40:46.0) gsmctl: mx_gsmcontrolApnAttach wip_netInit() returns 0
(09:40:46.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerOpen() returns 0
(09:40:46.0) gsmctl: mx_gsmcontrolApnAttach "ci.co.za", "", ""
(09:40:46.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerSetOpts() returns 0
(09:40:46.0) gsmctl: mx_gsmcontrolApnAttach wip_bearerStart() returns -29
                                                              // Error from link layer initialization
(09:40:46.0) gsmctl: GSMTriggerCommand GCMD_CLOSE_APN
(09:40:47.0) gsmctl: GSMControl : CmdAct=1 CmdId=2 EngMode=1
(09:40:47.0) gsmctl: mx_gsmcontrolSocketClose socket already closed
(09:40:47.0) gsmctl: mx_gsmcontrolApnClose wip_bearerStop() returns 0

My call back function prints debug upon entry, which I never receive, so I know I’m not missing the success/fail call-back.

This behaviour is only observed when the planets allign, and solar activity flares up (i.e. not very often, but enough to be problematic). The only way I can recover the WIP stack when this happes is to restart the module using AT+CFUN=1.

Has anybody seen this before? Is there any way to recover from this? Is there something I’m doing wrong, or something I can do to prevent this? Can the ADL_CALL_EVENT_NO_CARRIER call-back be any indication of what is happening?

Thanks


#2

https://forum.sierrawireless.com/t/start-and-stop-gprs-bearer-connection/4923/1


#3

Thanks for the quick reply. I read through the supplied thread and a few others as well. The issue in the above case was more related to not closing the bearer before trying to open it again. In my case, I simply never receive any call-backs after trying to start the bearer.

As mentioned, this behaviour only occurs occasionally; I cannot re-create it in a reliable fashion.

I suspect that I may be trying to start the bearer before the radio is ready. I wait for the SIM INIT FULL call-back before the rest of my state-machine is allowed to execute. I also do not attempt to start the GPRS bearer if I am not currently registered on either the Home network or a Roaming network.

Can you maybe suggest anything else I need to check before starting the bearer?


#4

But it does point out that there are cases where the only recovery after a bearer loss/failure is to reboot.

Home/Roaming registration should be sufficient.


#5

:frowning: I was hoping to avoid restarting the module.

This is not the thread to discuss this, but I have found that the module keeps reporting that it is registered on the Home network, even after I know that it has dropped off. (Tests involved a GSM jamming device :smiling_imp:) So it might still be the case that, at the time I try to start the bearer and break the WIP stack, I am in fact not registered.

For now I will restart the module when this happens.

Thanks for the help.


#6

Maybe the jamming device was not totally effective, so the unit was able to remain registered - even though unable to do anything useful?

Much like a phone will claim to be registered in a very poor signal location, but will fail as soon as you try to make a call…

These do seem to be the kinds of situations in which WIP is prone to get itself into a mess that needs a restart to resolve…