Asset Tracker V2 - Crashes trying to read non-existent config

ncs2.1.0

I have one unit, that somehow works, and when I loaded the code into any other blank devices it crashes. 

The kernel panic provides hardly any info, but I'm pretty sure it is related to reading the config from storage and there is nothing there. 

At settings_load_subtree, everything pauses for a couple of seconds, and then crashes. 

data_module.c

static int setup(void)
{
	int err;
	err = settings_subsys_init();
	if (err) {
		LOG_ERR("settings_subsys_init, error: %d", err);
		return err;
	}

    /*----------------!!!!!!-----------*/
    /* on a blank device this disappears and causes a panic*/
	err = settings_load_subtree(DEVICE_SETTINGS_KEY);
	if (err) {
		LOG_ERR("settings_load_subtree, error: %d", err);
		return err;
	}

	/* Wait up to 1 seconds for the settings API to load the device configuration stored
	 * to flash, if any.
	 */
	if (k_sem_take(&config_load_sem, K_SECONDS(1)) != 0) {
		LOG_DBG("Failed retrieveing the device configuration from flash in time");
	}

	err = cloud_codec_init(&current_cfg, cloud_codec_event_handler);
	if (err) {
		LOG_ERR("cloud_codec_init, error: %d", err);
		return err;
	}

	date_time_register_handler(date_time_event_handler);
	return 0;
}

[00:00:03.447,814] <dbg> modem_module: state_set: State transition STATE_DISCONNECTED --> STATE_CONNECTING
ASSERTION FAIL [handler != ((void *)0)] @ WEST_TOPDIR/zephyr/kernel/work.c:666
[00:00:03.765,930] <err> os: r0/a1:  0x00000004  r1/a2:  0x0000029a  r2/a3:  0x00000001
[00:00:03.765,960] <err> os: r3/a4:  0x00037485 r12/ip:  0x00000000 r14/lr:  0x0004ee0f
[00:00:03.765,960] <err> os:  xpsr:  0x41000000
[00:00:03.765,991] <err> os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
[00:00:03.766,021] <err> os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
[00:00:03.766,052] <err> os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
[00:00:03.766,052] <err> os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0x00000000
[00:00:03.766,082] <err> os: fpscr:  0x00000000
[00:00:03.766,082] <err> os: Faulting instruction address (r15/pc): 0x00055204
[00:00:03.766,113] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
[00:00:03.766,143] <err> os: Current thread: 0x200134a0 (sysworkq)
[00:04:08.808,868] <err> fatal_error: Resetting system

for completeness - here's the faulting instruction address. 

arm-zephyr-eabi-addr2line.exe -e build_opito_nrf9160\zephyr\zephyr.elf 0x00055204
C:/ncs/v2.1.0/zephyr/lib/os/assert.c:44

Any ideas? 

Thanks 

Marshall

Related