This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

The ltc_lc_init_and_connect() blocks all threads

I am trying to build an application on the nrf9160dk dev board. It it supposed to collect data from a sensor, and send updates via MQTT when there is an NB-IoT connection available.

My problem is that when I call lte_lc_init_and_connect(), everything stops until the connection is up. This is not the desired behaviour, since I need to keep collecting sensor data, even when I am waiting for a connection.

I am using the mqtt_simple sample project as a base, which sets CONFIG_LTE_AUTO_INIT_AND_CONNECT=n in the kernel config. I am then starting a separate thread which calls lte_lc_init_and_connect(), while the main thread sleeps for 10 seconds and calls printk() in a loop, so I can see if it runs.
The end result is that the output from the main thread is not shown until lte_lc_init_and_connect() returns. I have very bad connectivity at the office, so the LTE connection can sometimes take minutes, so I should see several printouts while waiting for the connection.

Regards,

Linus

Parents Reply Children
No Data
Related