Hardware Description:
MKBN02A00 module based on nRF52832 SOC
Software Description
nRF SDK 15.2.0 , SoftDevice S112
Observation:
When power_manager_init() is called before fds_manager_init(). It requires 3 power cycles to initialize FDS module. For the first 2 power cycle applications stays in wait_for_fds_ready() loop.
When power_manager_init() is called after fds_manager_init(), FDS module initializes on 1st power cycle without any problem.
Question:
What could be the possible reason for such behavior? Does power_management (sleep mode) affects the "fds module initialization" status events being generated/captured for
Application Code:
Below is the sequence of initialization in the main function.
APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);
// power_management_init();
ble_stack_init();
timers_init();
buttons_leds_init();
rtc_start();
fds_manager_init();
load_device_config();
power_management_init();
fds_manager_init(void) function
void fds_manager_init(void)
{
ret_code_t ret;
ret = fds_register(fds_evt_handler);
if (ret != FDS_SUCCESS)
{
// Registering of the FDS event handler has failed.
}
ret = fds_init();
if (ret != FDS_SUCCESS)
{
// Handle error.
}
wait_for_fds_ready();
fds_stat_t stat = {0};
ret = fds_stat(&stat);
APP_ERROR_CHECK(ret);
fds_gc();
}
wait_for_fds_ready() function
static void wait_for_fds_ready(void)
{
while (!m_fds_initialized)
{
(void) sd_app_evt_wait();
}
}
power_management_init() calls nrf_pwr_mgmt_int()
ret_code_t nrf_pwr_mgmt_init(void)
{
m_shutdown_started = false;
nrf_mtx_init(&m_sysoff_mtx);
nrf_section_iter_init(&m_handlers_iter, &pwr_mgmt_data);
PWR_MGMT_SLEEP_INIT();
PWR_MGMT_DEBUG_PINS_INIT();
PWR_MGMT_STANDBY_TIMEOUT_INIT();
PWR_MGMT_CPU_USAGE_MONITOR_INIT();
return PWR_MGMT_TIMER_CREATE();
}