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

WDT/OTA Bootloader

Hi,

I´m using a watchdog in my Application. Furthermore I need the ability to use the ota/dfu functionality. I trigger the bootloader with a simple beacon.

if((memcmp(addr.addr, &adv_data.p_data[9], 6)) == 0)

sd_power_gpregret_clr(0xff);

sd_power_gpregret_set(1);

err_code = sd_power_gpregret_get(&gprepret_value);

sd_nvic_SystemReset();

This is my init for the watchdog:

// Configure WDT.

nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG;

nrf_drv_wdt_init(&config, 0);

nrf_drv_wdt_channel_alloc(&m_channel_id);

nrf_drv_wdt_enable();

this is the feed:

nrf_drv_wdt_channel_feed(m_channel_id);

Probably you know which issue I´m facing. I can´t feed the watchdog while my device is in the bootloader. I was able to debug, so I can say the Watchdog is running while am device is in the bootloader.

I tried to feed the wdt in wait_for_events:

static void wait_for_events(void)

{

for (;;)

{

nrf_drv_wdt_feed();

    // Wait in low power state for any events.

    uint32_t err_code = sd_app_evt_wait();

    APP_ERROR_CHECK(err_code);

    // Event received. Process it from the scheduler.

    app_sched_execute();

nrf_drv_wdt_feed();

    if ((m_update_status == BOOTLOADER_COMPLETE) ||
        (m_update_status == BOOTLOADER_TIMEOUT)  ||
        (m_update_status == BOOTLOADER_RESET))

    {

        // When update has completed or a timeout/reset occured we will return.

        return;

    }

}

}

Perhaps someone has a solution for me. I read this post, but it doesn´t helped me.

devzone.nordicsemi.com/.../

Parents
  • Hi SKo,

    Can you make sure that your application does not go into sleep in function sd_app_evt_wait(). I mean if there is no any event from SD up to Watch Dog Timeout then your chip will cause a Watch Dog Reset. What you can try is, create and add a dummy timer which is in repeated mode and keep expiring every second or so, which will help your bootloader in exiting from sd_app_evt_wait() function and reloading a watchdog timer and then again go into sleep if no activity is there.

    I hope this helps you.

    Regards, Maulik Patel

Reply
  • Hi SKo,

    Can you make sure that your application does not go into sleep in function sd_app_evt_wait(). I mean if there is no any event from SD up to Watch Dog Timeout then your chip will cause a Watch Dog Reset. What you can try is, create and add a dummy timer which is in repeated mode and keep expiring every second or so, which will help your bootloader in exiting from sd_app_evt_wait() function and reloading a watchdog timer and then again go into sleep if no activity is there.

    I hope this helps you.

    Regards, Maulik Patel

Children
No Data
Related