Network Registration fails post disconnection

I’m using EC200UCN_AA with the opencpu SDK.
In a network management module, I use the ql_network_register_wait API to perform a data call, and have had thew following observations:

  1. Upon module reset, the API returns success and code execution subsequently performs a data call.
  2. If the system is then moved to a place with poor signal strength, nw registration is forced to fail by removal of the SIM card:
    NW registration API call fails perpetually (with exit code: 2) even if carrier strength (happy flow) is restored.

Need to understand if there are runtime configurations/ calls i need to perform here to be able to perform network registration post disconnection.

@barry.ding-Q
@Victor.W

Hi @Punit_Rajwani,
There’s a feature called SIM hot plug that allows you to remove and re-insert the SIM card correctly.
You can see the demo at components\ql-application\sim\ql_sim_demo.c.
Combined with components\ql-application\nw\datacall_demo.c, it’s how you normally handle network stuffs.

Hey @Victor.W
Unfortunately, the part we’re currently using lacks the SIM card detect sw/ pin and hence there is no hotplug pin to configure.
Trying to understand why the same behavior can(not?) be realized by some kernel thread de/re-init ?

After a SIM card removal, the ql_network_register_wait API fails to re-establish network registration even when signal strength is restored. You may need to investigate if there are specific runtime configurations or reinitialization steps required to handle reconnection after a disconnection event.

Hi @Punit_Rajwani
This logic happens at the chipset level, meaning that we cannot change it ourselves. Without the SIM detection pin, the module would have no way of knowing if a SIM is connected or not. That detection pin acts like an interrupt that signals the chipset the SIM has been removed or inserted.

@Victor.W
Understand the fact that an interrupt/ event driven recovery isn’t possible. Trying to understand why a periodic check that looks something like this wouldn’t work ?

			if( ql_nw_get_reg_status(nSim, &sNeRegStatus) == QL_SUCCESS )
			{
				if ( (sNeRegStatus.data_reg.state == QL_NW_REG_STATE_HOME_NETWORK )
					|| (sNeRegStatus.data_reg.state == QL_NW_REG_STATE_ROAMING) )
					{
						//NW reg with the operator, continue
					}
				else
				{
					//Attempt to reconnect
					ql_network_register_wait(nSim, 120);
				}

In this case, if you remove and reinsert the SIM card, the code always gets halted and times out on ql_network_register_wait

Because this network register logic happens at the chipset level. Without that interruption it will not reset the status and do re-register. We are not able to control this behavior.

Understood, seems like a module reset is the only option here.

@Punit_Rajwani You can also do CFUN0->CFUN1 to restart the entire “network stack” but it’s not recommended. Frequent use of it will lead to shorter lifespan of SIM card.

I’m seeing 2 ways to restart the module though a soft reset.

  1. Requesting an immediate WDT rest
  2. Changing the Network mode to ‘Full Functionality’ with a Reboot request.

I’m assuming you’re suggesting 2. here. Also unsure of how this causes reduction of the lifecycle of the SIM card.

Hi @Punit_Rajwani
Restarting network stack (and rebooting) includes R/W operation of the SIM card and it’s not very good to do that frequently.

Did you solve this issue?

Hey @anand_resolute
We ended up running a check on SIM card status to reset the module whenever a SIM isn’t detected, this is because our part didn’t have a detection switch. looks something like:

//Comms failed, check SIM card
if(ql_sim_get_card_status_phy(nSim, &eSimStaus) != QL_SIM_SUCCESS)
{
	//Unable to get status, hard fault
}
else if(eSimStaus == QL_SIM_STATUS_NOSIM)
{
	//No SIM found, this can be due to removel/ bounce. Perform a reset
	ql_rtos_task_sleep_s(10);
	ql_dev_set_modem_fun(QL_DEV_CFUN_FULL,1,0);
}