Watchdog feed best practices

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Watchdog feed best practices

跳至解决方案
1,567 次查看
diegobarile
Contributor II

Hello everybody.

The typical sequence for to feed the watchdog onto one LPC1768 is the follow:

LPC_WDT->WDFEED = 0xAA; LPC_WDT->WDFEED = 0x55;

My question: is It recommended to wrap the upper two lines inside a

taskENTER_CRITICAL() 
taskEXIT_CRITICAL()

section, when you enable the watchdog into a FreeRTOS environment?

I got very rare watchdog events and I start to believe that they could be caused because one task switch happens between the two rows above.

Thanks in advance.

Diego.

标签 (1)
标记 (1)
0 项奖励
1 解答
1,384 次查看
diegobarile
Contributor II

Hello.

After few days of extensive tests I can confirm (on my system) that taskENTER_CRITICAL / taskEXIT_CRITICAL are not enough.
I must wrapping the watchdog trigger code with __disable_irq() /__enable_irq() macros.
Doing so It seems to woks reliable.

My system has several interrupts, mostly comes from timers and UART.


Thank you so much for the suggestions.

Best regards.

Diego.

在原帖中查看解决方案

0 项奖励
2 回复数
1,384 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Diego Barile,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.

LPC_WDT->WDFEED = 0xAA; LPC_WDT->WDFEED = 0x55;

I agree with you, it'd better wrap the upper two lines inside ataskENTER_CRITICAL()
taskEXIT_CRITICAL()
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,385 次查看
diegobarile
Contributor II

Hello.

After few days of extensive tests I can confirm (on my system) that taskENTER_CRITICAL / taskEXIT_CRITICAL are not enough.
I must wrapping the watchdog trigger code with __disable_irq() /__enable_irq() macros.
Doing so It seems to woks reliable.

My system has several interrupts, mostly comes from timers and UART.


Thank you so much for the suggestions.

Best regards.

Diego.

0 项奖励