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

nrf9160 lte_lc_init_and_connect() blocks even when running on Zephyr workqueue.

When my app starts up, I call "lte_lc_init_and_connect()" by using the Zephyr system workqueue. With it running on a separate thread, my main thread is still blocked. I have tried using the CONFIG_LTE_AUTO_INIT_AND_CONNECT, but that is just as annoying because then my application blocks during startup, and I also don't want to connect every time I start up.

Is there anyway to initiate the LTE connection without blocking my whole program?

- Jack

Parents Reply
  • Hi again. Maybe I'm not understanding things properly (I am new to Zephyr). 

    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, si 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

Children
No Data
Related