Other Parts Discussed in Thread: MOTORWARE
Hey all. A potential problem with the WDOG_clearCounter function in "sw/drivers/wdog/src/32b/f28x/f2806x/wdog.h" is that it's definition is;
void WDOG_clearCounter(WDOG_Handle wdogHandle)
{
WDOG_Obj *wdog = (WDOG_Obj *)wdogHandle;
ENABLE_PROTECTED_REGISTER_WRITE_MODE;
// write first sequence
wdog->WDKEY = 0x55;
// write second sequence
wdog->WDKEY = 0xAA;
DISABLE_PROTECTED_REGISTER_WRITE_MODE;
return;
} // end of WDOG_clearCounter() function
When compiler optimizations are enabled the first write to WDKEY (0x55) can be removed, causing the WDT to trigger a reset. A potential way to solve this (that results in as little overhead as possible) is to change the definition to
void WDOG_clearCounter(WDOG_Handle wdogHandle)
{
volatile WDOG_Obj *wdog = (WDOG_Obj *)wdogHandle;
ENABLE_PROTECTED_REGISTER_WRITE_MODE;
// write first sequence
wdog->WDKEY = 0x55;
// write second sequence
wdog->WDKEY = 0xAA;
DISABLE_PROTECTED_REGISTER_WRITE_MODE;
return;
} // end of WDOG_clearCounter() function
Which ensures both writes are performed. Can someone verify/update this?