Data connection not re-established after SIM forced off network

Hi, I am running fx30_Cat1_2.00 image on FX30 LTE Cat 1 modem… i.e. Legato 19.11.5

I am legato application that runs well. Is able to connect etc. There is one scenario that it does not handle. But looking at the docs and code I think legato should be handing it…

I use the le_data_Request command to setup up a data connection to use in my application. Occasionally I need to force a “Update location” on the SIM, which forced it off the network to apply updates and the idea is that the device then reconnects. However legato never recovers until I restart the modem.

In the code, I have event handlers set up for le_data_AddConnectionStateHandler and le_mrc_AddNetRegStateEventHandler…

When forcing the SIM off the network, only the ConnectionStateHandler fires with a “not connected” event.

My understanding is that legato should automatically try and restart the connection but it does not. No network event is fired… My app never goes back online because the connection is never re-established.

Running cm data shows “Connected: no”…

So it seems legato just does not try to re-connect. Am I supposed to le_data_Release when the connection event is triggered and then try call le_data_Request again?

What am I missing…

Thanks,

then why don’t you enter “cm data connect” when you need it to go back to online?

Did you also check “cm radio” to see if it has register to network?

Also see if this helps

Thanks for the reply @jyijyi

These are modems that run in the field. i.e. it needs to manage all situations itself… they are often days away from someone that can do anything to them. So really the legato application must deal with these scenarios… hence why I am trying to get to the bottom of how the modem/legato manage this situation internally so that I can get the app to respond accordingly.

Typing “cm data connect” will not do I am afraid…

Is this a detail more relevant to the forum.sierrawireless.com boards?

I just ran “cm radio” and interestingly it says

Power: ON
Current Network Operator: vodafone UK
Current RAT: UMTS network (LE_MRC_RAT_UMTS)
Status: Registered to a roaming network (LE_MRC_REG_ROAMING)
Signal: Good signal strength (3)
PS: Packet Switched Not registered (LE_MRC_REG_NONE)

see if this helps

i.e. do data offline sequence when you receive the disconnect callback

BTW, did you contact distributor?

Do you mean call le_data_Release()?

From the ConnectionStateHandler?

you can see the offline code in the sample :

Yes I saw this in the previous link… But this code does not actually deal with my scenario… i.e. the connection state event fires with isConnected = false… and no other event fires…

Are you suggesting I call GoOffline() from line 1020? And then call GoOnline straight after?

i.e. here

static void ConnectionStateHandler
(
    const char *intfName,
    bool   isConnected,
    void*  contextPtr
)
{
    LE_INFO("Connection State Event: '%s' %s",
            intfName,
            (isConnected) ? "connected" : "not connected");

    if(!DestNumValid)
    {
        return;
    }

    if (!isConnected)
    {
        SendMessage(DestNum, "Data connection: not connected.");  <------- HERE
    }
    else
    {
        SendMessage(DestNum, "Data connection: connected.");
    }
}

you can have a try

BTW, does “cm data connect” work for you when problem happens?

No it does not… I get

root@fx30:~# cm data connect
Setting up profile 1
Connecting … failed
Mon Feb 13 17:37:53 GMT 2023 - Connection Failure: LE_FAULT
root@fx30:~#

how about connect data session after restart of radio like the followings?

cm radio off
cm radio on
cm data connect &

BTW, do you have any reproducible step?

  1. cm data connect &
  2. cm data connect -1 &
  3. “cm data” shows not connected
  4. force a “Update location” on the SIM → how to do so?
  5. “cm data” shows not connected
  6. “cm data connect” shows conection error

Hi, my reproducible steps are

  1. to connect the bearer
  2. create a socket connection
  3. Force the SIM off the network (use Update Location on SIM provision portal… which clear the data in HLR and requires a full re-connect from the SIM etc)

Then at this point, the modem sits in its offline state and is not able to reconnect.

I will try with the cm commands to see if I can re-create it there…

OK, so I can re-produce the problem as follows…

radio is off… then

  1. cm radio on
  2. cm data connect
  3. Push SIM off network using “Update location” in SIM portal
  4. “cm data” now shows off network
  5. “cm data connect” shows error “LE_FAULT”

terminal output below…

root@fx30:~# cm radio
Power:                         OFF
Current Network Operator:
Current RAT:                   Module not registered on network, RAT not available
Status:                        Not registered and not currently searching for new operator (LE_MRC_REG_NONE)
Signal:                        No signal strength (0)
PS:                            Packet Switched Not registered (LE_MRC_REG_NONE)

root@fx30:~# cm radio on
root@fx30:~# cm radio
Power:                         ON
Current Network Operator:      vodafone UK
Current RAT:                   UMTS network (LE_MRC_RAT_UMTS)
Status:                        Registered to a roaming network (LE_MRC_REG_ROAMING)
Signal:                        Weak signal strength (2)
PS:                            Packet Switched Not registered (LE_MRC_REG_NONE)

root@fx30:~# cm data
Index:                         1
APN:                           *******
PDP Type:                      IPV4
Connected:                     no
root@fx30:~# cm data connect
Setting up profile 1
Connecting ... ok
Checking if device 'rmnet_data0' is up ... ok
Routing inet ... ok
Updating /etc/resolv.conf ... ok
Updating /etc/resolv.conf ... ok
root@fx30:~# cm data
Index:                         1
APN:                           ********
PDP Type:                      IPV4
Connected:                     yes
Interface:                     rmnet_data0
Family[IPv4]:                  inet
IP[IPv4]:                      10.178.194.159
Gateway[IPv4]:                 10.178.194.160
Dns1[IPv4]:                    8.8.8.8
Dns2[IPv4]:                    212.9.0.136
root@fx30:~# cm radio
Power:                         ON
Current Network Operator:      vodafone UK
Current RAT:                   UMTS network (LE_MRC_RAT_UMTS)
Status:                        Registered to a roaming network (LE_MRC_REG_ROAMING)
Signal:                        Weak signal strength (2)
PS:                            Packet Switched Registered to a roaming network (LE_MRC_REG_ROAMING)

root@fx30:~# cm data connect
Checking if device 'rmnet_data0' is up ... ok
Routing inet ... ok
Updating /etc/resolv.conf ... ok
Updating /etc/resolv.conf ... ok
root@fx30:~# cm data
Index:                         1
APN:                           ********
PDP Type:                      IPV4
Connected:                     no
root@fx30:~# cm data connect
Setting up profile 1
Connecting ... failed
Wed Feb 15 07:11:33 GMT 2023 - Connection Failure: LE_FAULT
root@fx30:~#

Below are the logread traces. The first file below is the cm radio on and cm data connect sequence which connect successfully…

Radio on and first data connect.txt (32.9 KB)

This is then where I push the SIM off the network and send the “cm data” command to check status

Push SIM off network.txt (8.9 KB)

And finally I send the “cm data connect” command to try and re-connect

Failed - cm data connect.txt (9.1 KB)

how about connect data session after restart of radio like the followings?

cm radio off
cm radio on
cm data connect &

You might also need to try with another host Ubuntu PC and see if it only happens to legato data connection.

The only way to re-establish a connection seems to be to turn the radio power off and on again…

However that seems rather heavy handed and I don’t actually know for sure what state I am in as all I get in my application is a ConnectionState event saying the connection is closed… that could be for various reasons… so powering down and up the modem at this point seems like bad practise.

OK, at least there is a workaround…

BTW, I don’t see you enter “cm data connect -1 &” to go offline after pushing SIM off network using “Update location” in SIM portal, not sure if it helps…

You might also need to try with another host Ubuntu PC and see if it only happens to legato data connection.
I wonder if this is a modem FW problem instead of legato problem.

Unfortunately I can’t really use this as a work around… as I don’t know how to detect this is the problem the system is having. I can’t just power down the radio everytime I have a disconnect on the data channel…

how often do you Push SIM off network using “Update location” in SIM portal?

Or you can consider to restart the radio when data connection cannot be established.

BTW, did you contact distributor?

This happens when setting/config needs to change on the SIM or when diagnosing network / modem issues. i.e. it should force a full re-registration process with the network… I’ll try the destributor as well

you can consider to restart the radio whenever data connection cannot be established as workaround