watchdog test

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,430件の閲覧回数
Lily_31_amz
Contributor II

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.

0 件の賞賛
返信
1 解決策
2,412件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

According to the Application descriptionIf the FLASH configuration will be used, then the code will use the Reset Control Module to detect if the reset was caused by the Watchdog and will stop the execution of the program.

WDOG Interrupt Application description.png

After reset caused by the Watchdog(line 128), user can add a flag in it. And then you can add your own function in while loop according to flag.

wdog_interrupt.png

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
2,422件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi 

The test content you mentioned seems to be very similar to the example wdog_interrupt in the S32SDK_S32K1XX_RTM_4.0.2. Have you read the introduction to this example?(file:///C:/NXP/S32DS.3.4/S32DS/software/S32SDK_S32K1XX_RTM_4.0.2/doc/html_S32K144/wdog_interrupt_s32k144_group.html)

WDOG Interrupt.png

 

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信
2,415件の閲覧回数
Lily_31_amz
Contributor II

Hello Robin,

yes this example was taking from the SDK, the watchdog functionalities is correct, after 8 cycles the MCU reset and stopps.

is there a way after a reset happens, to restart the board automatically ? and eventually check in a register if the reset was done correctly ?

regards.

0 件の賞賛
返信
2,413件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

According to the Application descriptionIf the FLASH configuration will be used, then the code will use the Reset Control Module to detect if the reset was caused by the Watchdog and will stop the execution of the program.

WDOG Interrupt Application description.png

After reset caused by the Watchdog(line 128), user can add a flag in it. And then you can add your own function in while loop according to flag.

wdog_interrupt.png

0 件の賞賛
返信
2,408件の閲覧回数
Lily_31_amz
Contributor II

Thanks a lot Robin for you answer, i think we are close

im using freeRTOS, and once the reset is performed the applications stops and does not restart even if i turn the main power OFF-ON.  

Lily_31_amz_0-1654591417093.png

is it possible to implement a Reset_Handler ? if so please give me an example.

Thank you.

0 件の賞賛
返信