This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Module requires 3 power cycles to initialize FDS Manager.

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 

fds_evt_handler. And if so why it works fine on the 3rd power cycle. Or if there is any other problem? 

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();
}

Parents Reply
  • I am seeing the same on SDK16.0.0

    My application is operating with FreeRTOS, so I need to search out a solution here.

    fds_init() occurs after FreeRTOS is running ...

    Not clear the path to solve this problem. I surely don't want a customer to powercycle the product 3 times to force resets ...


    Found a solution ... replaced nrf_delay_ms(50) inside the while() loop, with FreeRTOS friendly vTaskDelay(50)

    This way the FDS_EVT_INIT is able to be returned to the fds_evt_handler()

    This issue only occured on a 'virgin' FDS setup.

Children
No Data
Related