feed wdt in bootloader if enabled. Since it is impossible to disable wdt

This commit is contained in:
hathach 2018-11-19 17:01:45 +07:00
parent 37690823ac
commit 94e23a928c
10 changed files with 6385 additions and 6375 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,7 @@
#include "app_scheduler.h"
#include "nrfx.h"
#include "nrf_wdt.h"
#include "app_timer.h"
#include "boards.h"
@ -116,6 +117,13 @@ static void wait_for_events(void)
// uint32_t err_code = sd_app_evt_wait();
// APP_ERROR_CHECK(err_code);
// Feed all Watchdog just in case application enable it
// WDT cannot be disabled once started. It even last through soft reset (NVIC Reset)
if ( nrf_wdt_started() )
{
for (uint8_t i=0; i<8; i++) nrf_wdt_reload_request_set(i);
}
// Event received. Process it from the scheduler.
app_sched_execute();

View File

@ -68,12 +68,6 @@ void board_init(void)
NRF_CLOCK->LFCLKSRC = CLOCK_LFCLKSRC_SRC_RC;
NRF_CLOCK->TASKS_LFCLKSTART = 1UL;
// stop WDT if started by application, when jumping from application using BLE DFU
if ( NRF_WDT->RUNSTATUS )
{
NRF_WDT->TASKS_START = 0;
}
button_init(BUTTON_DFU);
button_init(BUTTON_FRESET);
NRFX_DELAY_US(100); // wait for the pin state is stable