This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF9160: How to recover when modem call lte_lc_connect() returns -116.

I'm using SDK 1.7.0. Here's how I have the modem code setup.

  • Init modem outside of thread loop
  • Set modem at+ comman CFUN=1 (start searching for a tower)
  • Once +CEREG returns data with a 1, I know I have connected to a tower (+CEREG: 5,1,"8404","02073301",7,,,"00001000","00100110").
  • I connect with lte_lc_connect()
  • Create a socket
  • Send some data
  • Close the socket
  • Disconnect the modem with lte_lc_offline()
  • Set modem at+ comman CFUN=4 (airplane mode)
  • Put thread asleep until it's time to send data again.

The above works well and can connect to a tower, send data and disconnect many times over. But once lte_lc_connect() returns -116, it will never connect again and I have to reboot the board. Any idea of how I can recover from this?

Parents
  • Hello,

    But once lte_lc_connect() returns -116, it will never connect again and I have to reboot the board. Any idea of how I can recover from this?

    Have you tried just calling lte_lc_connect_async() after receiving the -116 error? I'm not sure that's the best way to handle it, but I guess you can try that.

  • lte_lc_connect_async() calls the same function connect_lte() but without blocking.

    On line 668 of file lte_lc.c, it times out on the below line.
    err = k_sem_take(&link, K_SECONDS(CONFIG_LTE_NETWORK_TIMEOUT));

    This is where err = -116 is generated. Not sure why the semaphore is timing out. I even doubled it from 60 seconds to 120.

  • GameCodingNinja said:
    err = k_sem_take(&link, K_SECONDS(CONFIG_LTE_NETWORK_TIMEOUT));

    Maybe you can try changing it to k_sem_take(&link, K_FOREVER) to stop it from timing out.

Reply Children
No Data
Related