Greetings,
we have a custom pcb with nrf9160 and are using nrf-sdk v1.3.0 and mfw v1.2.0
Sometimes when connecting to lte the code crashes:
[00:00:12.755,737] [0m<inf> main: Init and Connecting to LTE network.This may take several minutes.[0m [00:00:12.765,167] [0m<dbg> lte_lc.lte_lc_system_mode_set: Sending AT command to set system mode: AT%XSYSTEMMODE=0,1,0,0[0m [00:00:12.788,085] [0m<inf> lte_lc: Using legacy LTE PCO mode...[0m [00:00:12.800,964] [0m<dbg> lte_lc.lte_lc_system_mode_set: Sending AT command to set system mode: AT%XSYSTEMMODE=0,1,0,0[0m *** Booting Zephyr OS build v2.3.0-rc1-ncs1 ***
The code in question is as follows:
LOG_INF("Init and Connecting to LTE network.This may take several minutes."); err = lte_lc_init(); // if error is EALREADY, lte lc was already initialized if (err && err != -EALREADY) { LOG_ERR("lte_lc_init error: %d", err); goto exit; } err = lte_lc_connect(); if (err) { LOG_ERR("lte_lc_connect error: %d", err); goto exit; }
So, presumably, the crash happens after this line in w_lte_lc_connect.
Other AT commands before connecting work, so communication with the modem is not an issue.
The code then resets and keeps crashing forever.
To fix, we had to do a power cycle (remove and add batteries).
Preferably, we would like to be able to catch this kind of error, and proceed with the device functioning, but not connecting. This way it would still collect data and retry sending maybe once a week, to see if the issue has fixed itself.
So, my questions are:
- is there some kind of "crash error handler", that would be able to run before the system reset? This would allow us to, for example, set some variables in flash and read them on startup.
- is there a way to hard reset the modem from code?
Regards,
Tjaž