Closed binaryfields closed 6 years ago
I changed sleep_mode-enter function to have a delay right after call to sd_power_system_off:
err_code = sd_power_system_off(); nrf_delay_ms(5000); // <--- added
This in turn will cause a pause between reset that happens immediately after call to sd_power_system_off and in turn LED blinking will stop during that period. After the delay, the device resets and LED blinking along with adv starts again.
Also please note this behavior is observed in release mode (DEBUG flag in CFLAGS not set).
I also commented out low power accelerator configuration to make sure its not interfering with sleep.
In sleep_mode_enter:
// err_code = m_motion_sleep_prepare(true); ... // nrf_gpio_cfg_sense_input(LIS_INT1, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH);
Apparently the good old "did you try to power it off and on again" may be the culprit here. I think the issue I was running into was that upon disconnecting debugger, you have to power off and on the device. Resetting the device is not enough.
Nice to see that you found a solution. If you want to know the Thingy debug status, try checking the following flag: DWT->CYCCNT != 0 (Active debug session). There are seven different methods of resetting the nRF52832, and only some resets the device from debug. Consult the nRF52832 Product Specification chapter 18.8 for more information.
Upon BLE adv timeout, thingy_ble_evt_handler in main.c calls sleep_mode_enter function. This function in turn will call:
err_code = sd_power_system_off();
The problem is that this will return without putting device into sleep. This is without debugger attached to the device.
Repro steps:
Expected:
Actual: