I am trying to implement the WWDT1 on RT685. I was successful implementing the WWDT0, and I initialized the WWDT1 the exact same way:
const wwdt_config_t WWDT0_config = {
.enableWwdt = true,
.enableWatchdogReset = true,
.enableWatchdogProtect = false,
.enableLockOscillator = false,
.windowValue = WWDT0_WINDOW,
.timeoutValue = WWDT0_TIMEOUT,
.warningValue = WWDT0_WARNING,
.clockFreq_Hz = 1500
};
static void WWDT0_init(void) {
/* WWDT0 initiation */
WWDT_Init(WWDT0_PERIPHERAL, &WWDT0_config);
/* Enable interrupt WDT0_IRQn request in the NVIC. */
EnableIRQ(WWDT0_IRQN);
}
/***********************************************************************************************************************
* WWDT1 initialization code
/* clang-format on */
const wwdt_config_t WWDT1_config = {
.enableWwdt = true,
.enableWatchdogReset = true,
.enableWatchdogProtect = false,
.enableLockOscillator = false,
.windowValue = WWDT1_WINDOW,
.timeoutValue = WWDT1_TIMEOUT,
.warningValue = WWDT1_WARNING,
.clockFreq_Hz = 1500
};
static void WWDT1_init(void) {
/* WWDT1 initiation */
WWDT_Init(WWDT1_PERIPHERAL, &WWDT1_config);
/* Enable interrupt WDT1_IRQn request in the NVIC. */
EnableIRQ(WWDT1_IRQN);
}
/***********************************************************************************************************************
* Initialization functions
**********************************************************************************************************************/
void BOARD_InitPeripherals(void)
{
/* Initialize components */
//WWDT0_init();
WWDT1_init();
}
On the Hifi4 I have this code:
//Watchdog Timer defines
#define WWDT1_FEED_ADDR (0x4002E008)
#define WWDT1_TV_ADDR (0x4002E00C)
#define WWDT1_FEED_VAL_1 (0xAAU)
#define WWDT1_FEED_VAL_2 (0x55U)
#define WWDT1_WINDOW (1048576UL)
In the idle loop is this code:
if (g_bBlinkBlueLEDForBoardAlive)
{
nCount = (nCount + 1) % 10000;
if (nCount == 0)
{
if ( *((uint32_t *)WWDT1_TV_ADDR) < WWDT1_WINDOW )
{
*((uint32_t *)WWDT1_FEED_ADDR) = WWDT1_FEED_VAL_1;
*((uint32_t *)WWDT1_FEED_ADDR) = WWDT1_FEED_VAL_2;
LED_BLUE_TOGGLE();
}
}
}
When the feed value is written to the feed register, the Hifi4 resets. Why? The WWDT1 registers are not accessed anywhere else in the code, so I do not understand why the Hifi4 core is resetting.
Thanks.