conn_mgr persistence for MQTT over LTE

We are using zephyr's conn_mgr to manage the network connection. From what I can tell, if I have set CONFIG_NRF_MODEM_NET_IF=y and NRF_MODEM_LIB_NET_IF_CONNECTION__PERSISTENCE=y, conn_mgr (or the nrf_modem_lib_net_if implementation) should automatically handle reconnecting to LTE when the connection fails. On top of this, we have implemented a thread to reconnect mqtt_helper when the network comes back up. However, during testing devices would sometimes disconnect while travelling around, and never regain their connection to the broker (assumption this is due to LTE connection). Is there a possibility that conn_mgr doesn't reconnect properly? What is the best way for me to simulate a "network disconnection" without having to travel around? Is conn_mgr handling LTE via nrf_modem_lib_net_if OK, or is it recommended to handle the LTE connection entirely myself? (I can see that the Asset Tracker Template does not use conn_mgr, for example)

Parents
  • Hello,

    I would start by setting CONFIG_NRF_MODEM_LIB_NET_IF_CONNECT_TIMEOUT_SECONDS, because I believe the default value is 0. So then when the modem tries to reconnect it does not immediately timeout and never try again.

    What is the best way for me to simulate a "network disconnection" without having to travel around?

    Simulating this in software would maybe be the simplest option. Like calling  conn_mgr_if_disconnect() and then reconnecting. You can also use an RF chamber or if you don't have it any sealed metal container probably also works (in theory at least). 

  • Hi Hakon,

    thank you for your reply! I had (incorrectly) assumed that CONFIG_NRF_MODEM_LIB_NET_IF_CONNECT_TIMEOUT_SECONDS was a setting to let the nrf modem net interface library decide that a current connection attempt is "just not working" once the timeout expires, and it would give up trying to connect entirely (regardless of the persistence flag).
    Is it correct to say that if the _LIB_NET_IF_CONNECT_TIMEMOUT_SECONDS timer expires, the nrf modem net interface lib will tell the modem to either give up, or force it to start over (depending on the persistence flag)?

Reply
  • Hi Hakon,

    thank you for your reply! I had (incorrectly) assumed that CONFIG_NRF_MODEM_LIB_NET_IF_CONNECT_TIMEOUT_SECONDS was a setting to let the nrf modem net interface library decide that a current connection attempt is "just not working" once the timeout expires, and it would give up trying to connect entirely (regardless of the persistence flag).
    Is it correct to say that if the _LIB_NET_IF_CONNECT_TIMEMOUT_SECONDS timer expires, the nrf modem net interface lib will tell the modem to either give up, or force it to start over (depending on the persistence flag)?

Children
Related