Watchdog feed best practices

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Watchdog feed best practices

Jump to solution
1,565 Views
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.

Labels (1)
Tags (1)
0 Kudos
1 Solution
1,382 Views
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.

View solution in original post

0 Kudos
2 Replies
1,382 Views
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,383 Views
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 Kudos