Use of nrf_modem_lib_shutdown() when using lte_lc?

void main(void){
    char date[21];
    lte_lc_init_and_connect();
    
    k_sleep(K_MSEC(10));
	nrf_modem_at_scanf("AT+CCLK?", "+CCLK: \"%s\"", &date);
    printf("%s", date);
    
    nrf_modem_lib_shutdown();
    lte_lc_power_off();
}

Hi,

I just go a question about when to use the nrf_moden_lib_shutdown(). Is it necessary to use in this code case? Since I've used lte_lc_power_off().

Regards,

Elias

  • Hi,

     

    lte_lc_power_off is essentially calling AT+CFUN=0, which turns the modem off.

    nrf_modem_lib_shutdown() shuts down the nrf_modem library, which acts as a bridge between the application and modem.

     

    Since you're first shutting down the library that handles all communication towards the modem, the next call to AT+CFUN will fail.

    Is it necessary to use in this code case?

    No, not really. Issuing AT+CFUN to any mode (off, flight mode, etc) should be sufficient for most use-cases.

    The only reason to shut down the nrf_modem library is if you're updating the modem or similar.

     

    Kind regards,

    Håkon

Related