Ensuring reliable cell connection and retrying?


Hey team,

We have been quite successful with our project so far and we are encountering another hurdle we are getting over. Our system will run for about 24 hours connected to the network, but will mysteriously go offline and not re-connect. We are looking for suggestions on how we should be handling our data connections, here is our proposed flow:

le_avdata_AddSessionStateHandler to manage the session with Air Vantage.
PollForConnection to see if we’re online (sometimes it says we’re online when we actually aren’t)
If our publish fails we are considering using le_mrc_interface (modem radio control) and power cycling the radio. Is this a good idea? Or will this just cause us pain?

We have been looking at the RedSensorToCloud repo, but it doesn’t seem to have any way of connecting and disconnecting from the network and retrying if it cannot connect.

Thanks for the help!


@dclark75 can you see if some of the patches you have can help here?

@coastalbrandon Maybe you can see if these patches help your issue


What legato version is using?
I had the same problem with legato 17.06.
Now with legato 17.11 all work fine (4 mangos without problem). I push data every 15mn with heartbeat set to 1h.


Have you checked why the network operator has thrown you out? some networks deny the radio resources to make sure that the connected device isn’t just stuck and deny radio resources. You may want to check the cause from le_mrc_NetworkRejectHandlerRef_t. if you don’t get immediate re-registration, you could scan the PLMN and attempt to register to the next available network and loop through the list. Once you are able to get onto an alternative network, your original network network should unblock you so that you can go back to it at a later date.


Thanks, all!

So, just so I’m clear - does legato automatically try to handle the connection through the session handler? If it loses connection does it try to re-connect? Or would it normally not try unless you’ve implemented a state machine that’s manually checking whether it has a connection?

We are running Legato 17.07.2… I’ll have to talk to @nick, but I believe there may be some breaking changes that we need to account for in an upgrade to 17.11.


Sierra support confirm 17.11 fixe issue with AirVantage push. My application just open a session at startup and push every xx minut.

In 17.06/17.07 I was not choice to close and restart session every 06h…

With 17.11 all work fine


Awesome, that’s good news Francis.

We just upgraded to 17.11 and that was very smooth. We have added a retry timer if our AVSession returns failed, the retry timer power cycles the radio after waiting 2 minutes, 4 mins, 8 mins, or 16 mins depending on how many retries it’s attempted. When we turn off the radio we release the session, which probably doesn’t matter, and when we turn on the radio again we force the state to ‘no connection’ again in order for our loop to validate our connection.

Hoping to test this over the next 24 hours or so on 4 MangOH red units.

A side note - we confirmed that our connections had all died after 12 hours in the past… which doesn’t seem like a coincidence. The way to get them back was to power cycle the radios on the units.


One question : what code do you use to turn on off the radio ?


I confirm for the 12 hours


@Francis.duhaut Use the le_mrc API as specified here: http://legato.io/legato-docs/latest/le__mrc__interface_8h.html


Please have a look on this topic it’s very important
It work fine for me


Legato 17.11 is not enough to solve completely your problem, modify the model app as indicate on my previous message.


@Francis.duhaut Which problem are you referring to? Keeping the device online (this topic) and getting AirVantage updates to work (the other topic you posted a link to) are completely separate concerns.


With my small experience the legato 17.11 and a modification of model app have solve all my connection problem.

With legato 17.06 and old model app I lost connection every 12h and the heartbeat was not working good.

Now all is perfect with same app.


To keep alive the connection I use the heartbeat with a small value (30mn)


Just as a heads up, we ran into a new problem overnight on one of our units… Not sure if it will appear on our other units or not, but the avPublisher claims that it ran out of memory. It may be us causing a memory leak somewhere, but this is new after our latest update to 17.11 legato.


One further thing that’s new today after upgrading to 17.11 is one of our units is succesfully publishing, but AirVantage is showing ‘no communication available’. We can see that we have the right number of data points that have been received by AV, but we just don’t see the data on the platform.


Can you copy the code used to push your data?


Hey @Francis.duhaut,

Our publishing app is derivative of this repository: https://github.com/mangOH/RedSensorToCloud. The only change we made is some retries in the AvSessionStateHandler callback.


Try to remove your retry in the Handler
How is set the hearbeat on the system (frequency) ? Try with a Hearbeat set to 01H without retry