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

Application timer in Secure bootloader.

Dear team,

Device - nRF52832
SDK - nRF_SDK_15.0.0
Softdevice - s132_nrf_6.0.0
IDE - Segger embedded studio

My application needs to toggle one gpio pin using app timer in secure bootloader code. I tried to create app timer in bootloader code but advertisement stops. I can't understand the reason behind that.

Here is my main function as below.

static void Min1_lowpower_event_timeout_handler(void * p_context) {
    ret_code_t err_code;
    UNUSED_PARAMETER(p_context);
    nrf_gpio_cfg_output(4);
    nrf_gpio_pin_set(4);
    nrf_delay_us(10)
    nrf_gpio_pin_clear(4);
    //Min1CompletionCheck = true;
}

/**@brief Function for application main entry. */
int main(void) {
    uint32_t ret_val;
    ret_code_t err_code;

    // Protect MBR and bootloader code from being overwritten.
    APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);

    //timers_init();

    err_code = app_timer_init();
    APP_ERROR_CHECK(err_code);
    err_code = app_timer_create( & m_1min_lowpower_event_timer_id, APP_TIMER_MODE_REPEATED, Min1_lowpower_event_timeout_handler);
    APP_ERROR_CHECK(err_code);
    err_code = app_timer_start(m_1min_lowpower_event_timer_id, INTERVAL_1SEC, NULL);
    APP_ERROR_CHECK(err_code);
    ret_val = nrf_bootloader_flash_protect(0, MBR_SIZE, false);
    APP_ERROR_CHECK(ret_val);
    ret_val = nrf_bootloader_flash_protect(BOOTLOADER_START_ADDR, BOOTLOADER_SIZE, false);
    APP_ERROR_CHECK(ret_val);

    (void) NRF_LOG_INIT(app_timer_cnt_get);
    NRF_LOG_DEFAULT_BACKENDS_INIT();

    NRF_LOG_INFO("Inside main");*/

    ret_val = nrf_bootloader_init(dfu_observer);
    APP_ERROR_CHECK(ret_val);

    //err_code = app_timer_start(m_battery_timer_id, APP_TIMER_TICKS(1000), NULL);
    //APP_ERROR_CHECK(err_code);
    // Either there was no DFU functionality enabled in this project or the DFU module detected
    // no ongoing DFU operation and found a valid main application.
    // Boot the main application.
    nrf_bootloader_app_start();

    // Should never be reached.
    NRF_LOG_INFO("After main");*/
}

Please give me some possible solutions on that.

Parents Reply Children
No Data
Related