main
init_watchdog from drivers/init/init.c > watchdog_init(watchdog_default_handler); //which just returns!
> watchdog_enable
config is defaulted from sdk_config or sdk_application_config
WDT_CONFIG_RELOAD_VALUE 360000 (6 minutes!)
worry about DFU finishing
ruuvi/firmware/*/drivers/nrf_nordic_watchdog
nrf_drv_wdt_channel_id m_channel_id; //define a channel
ret_code_t
watchdog_init(watchdog_event_handler_t handler)
nrf_drv_wdt_init(&config, handler);
nrf_drv_wdt_channel_alloc(&m_channel_id);
void watchdog_feed(void) { nrf_drv_wdt_channel_feed(m_channel_id); // called in main_timer_handler
watchdog_enable(void) { nrf_drv_wdt_enable();
void watchdog_default_handler(void) // just returns! reset will be in 30ms
nRF5_SDK_12.3.0_d7731ad/components/drivers_nrf/wdt
ret_code_t
nrf_drv_wdt_init (nrf_drv_wdt_config_t const *p_config, nrf_wdt_event_handler_t wdt_event_handler)
NRF_DRV_WDT_DEAFULT_CONFIG
Value:
{ .behaviour = (nrf_wdt_behaviour_t)WDT_CONFIG_BEHAVIOUR, \ // runs in sleep|haltedByDebugger or (paused if 0)
.reload_value = WDT_CONFIG_RELOAD_VALUE, \ // from sdk_ config
.interrupt_priority = WDT_CONFIG_IRQ_PRIORITY, \
}
void nrf_drv_wdt_enable (void)
void nrf_drv_wdt_feed (void)
nrf_wdt_reload_request_set((nrf_wdt_rr_register_t)(NRF_WDT_RR0 + i));
void nrf_drv_wdt_channel_feed (nrf_drv_wdt_channel_id channel_id)
nrf_drv_wdt_ppi_task_addr (nrf_wdt_task_t task)
nrf_drv_wdt_ppi_event_addr (nrf_wdt_event_t event)
ret_code_t nrf_drv_wdt_channel_alloc ( nrf_drv_wdt_channel_id * p_channel_id )
nRF5_SDK_12.3.0_d7731ad/components/drivers_nrf/hal/
NRF_WDT_CHANNEL_NUMBER 0x8UL
WDT_IRQHandler(void)
{
if (nrf_wdt_int_enable_check(NRF_WDT_INT_TIMEOUT_MASK) == true) {
nrf_wdt_event_clear(NRF_WDT_EVENT_TIMEOUT); m_wdt_event_handler();}
Section 40
mem32 40010400,1 RUNSTATUS running := 1
mem32 40010504,1 CRV Counter reload value in tics ( 00B40000 after reset by j-link i.e. before)
mem32 4001050C,1 CONFIG behavior: runs while sleep :=1 ; runs when halted by debugger :=8 (1 after reset by j-link i.e paused with debugger)
nRF5 SDK v12.3.0: example shows only feed to prevent reset: \examples\peripheral\wdt