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

If I enable watchdog in main applicatio it cause bootloader to reboot

When I enable watchdog in main application by:

nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG;
err_code = nrf_drv_wdt_init(&config, wdt_event_handler);
APP_ERROR_CHECK(err_code);
err_code = nrf_drv_wdt_channel_alloc(&m_channel_id);
APP_ERROR_CHECK(err_code);
nrf_drv_wdt_enable();

it cause bootloader to reboot, so I can't enter to dfu mode.

How to make it possible - to enter dfu while in maonn app WDT is enabled?

Parents
  • I found a solution:

    static void timer_init(void)
    {
    static bool m_timer_initialized;

    if (!m_timer_initialized)
    {
    /*if (!nrf_clock_lf_is_running())
    {
    lfclk_config(); //VG 20200211 for init of LFCLK with external Oscillator
    }*/

    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; //20200511 Modified as per Nordic's suggestions. Solves the RTC2 Starting issue
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) {}
    NRF_RTC0->TASKS_STOP = 0;

    nrf_rtc_event_clear(RTC_STRUCT, NRF_RTC_EVENT_TICK);
    nrf_rtc_event_clear(RTC_STRUCT, NRF_RTC_EVENT_COMPARE_0);
    nrf_rtc_event_clear(RTC_STRUCT, NRF_RTC_EVENT_COMPARE_1);
    NRFX_IRQ_PRIORITY_SET(RTC_IRQn, 5);
    NRFX_IRQ_ENABLE(RTC_IRQn);
    nrf_rtc_prescaler_set(RTC_STRUCT, RTC_PRESCALER);
    nrf_rtc_task_trigger(RTC_STRUCT, NRF_RTC_TASK_CLEAR);
    nrf_rtc_task_trigger(RTC_STRUCT, NRF_RTC_TASK_START);
    nrf_rtc_int_enable(RTC_STRUCT, RTC_INTENSET_OVRFLW_Msk);

    m_timer_initialized = true;
    }
    }

    The problem is in timer that is working from RTC2.

Reply
  • I found a solution:

    static void timer_init(void)
    {
    static bool m_timer_initialized;

    if (!m_timer_initialized)
    {
    /*if (!nrf_clock_lf_is_running())
    {
    lfclk_config(); //VG 20200211 for init of LFCLK with external Oscillator
    }*/

    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; //20200511 Modified as per Nordic's suggestions. Solves the RTC2 Starting issue
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) {}
    NRF_RTC0->TASKS_STOP = 0;

    nrf_rtc_event_clear(RTC_STRUCT, NRF_RTC_EVENT_TICK);
    nrf_rtc_event_clear(RTC_STRUCT, NRF_RTC_EVENT_COMPARE_0);
    nrf_rtc_event_clear(RTC_STRUCT, NRF_RTC_EVENT_COMPARE_1);
    NRFX_IRQ_PRIORITY_SET(RTC_IRQn, 5);
    NRFX_IRQ_ENABLE(RTC_IRQn);
    nrf_rtc_prescaler_set(RTC_STRUCT, RTC_PRESCALER);
    nrf_rtc_task_trigger(RTC_STRUCT, NRF_RTC_TASK_CLEAR);
    nrf_rtc_task_trigger(RTC_STRUCT, NRF_RTC_TASK_START);
    nrf_rtc_int_enable(RTC_STRUCT, RTC_INTENSET_OVRFLW_Msk);

    m_timer_initialized = true;
    }
    }

    The problem is in timer that is working from RTC2.

Children
Related