Hello NXP team,
i need to perfrom a simple watch dog test, to check if it reset the MCU.
i come with the following concept, could be wrong !
Configure the watchdog and configure the systick
void Start_Wd_Test()
{
s_refreshNumber = 0;
/* Install IRQ handlers for WDOG and SysTick interrupts */
INT_SYS_InstallHandler(WDOG_EWM_IRQn, WDOG_ISR, (isr_t *)0);
INT_SYS_InstallHandler(SysTick_IRQn, SysTick_Handler_wd, (isr_t *)0);
/* Enable Watchdog IRQ */
INT_SYS_EnableIRQ(WDOG_EWM_IRQn);
/* Configure and enable SysTick */
SysTick_Init();
SysTick_Enable();
/* Initialize WDOG */
WDOG_DRV_Init(INST_WATCHDOG1, &watchdog1_Config0);
}
start counting and feeding the watchdog for 8 cycles, once elapsed the MCU should reset.
/* Initialize SysTick counter */
void SysTick_Init(void)
{
S32_SysTick->RVR = 0xFFFFFFul;
S32_SysTick->CVR = 0ul;
S32_SysTick->CSR = 0u;
}
/* Enable SysTick counter and interrupt */
void SysTick_Enable(void)
{
S32_SysTick->CSR = S32_SysTick_CSR_TICKINT(1u) | S32_SysTick_CSR_ENABLE(1);
}
/* Disable SysTick */
void SysTick_Disable(void)
{
S32_SysTick->CSR = 0ul;
}
/* SysTick IRQ handler */
void SysTick_Handler_wd(void)
{
/* Variable that stores the number of Watchdog triggers */
/* After 8 watchdog refreshes, the interrupt will no longer reset the wdog counter */
if(s_refreshNumber < 8)
{
/* Reset Watchdog counter */
WDOG_DRV_Trigger(INST_WATCHDOG1);
//printf("watch dog reseted \r\n");
/* Increment refresh number */
s_refreshNumber++;
}
}
The mcu throw an error "Stoped at vector catch" , and i can no longer comunicate with it.
any suggestion on how to do this correctly ? i mean once the MCU reseted, it should print the status to serial consol saying that the reset was perfromed correctly and the MCU should start working.
Thank you.