Cyclic writes to WDTLOAD REG-1 fail in a semaphore interrupt reload context of PWM0 zero interrupt for switch cases processed in 1 millisecond count downs of that semaphore. Otherwise the WDTLOAD succeeds in the same 1 millisecond semaphore interrupt without switch case calls being present.
The Watchdog WDTLOAD value (333ms) then incorrectly times out exceeding switch case 1 UserParameter.Count but only during semaphore interrupts of exact cyclic 1 millisecond periods. Setting the UseParameter.Count value above WDTLOAD value of 333ms and the dog times out when it should be reloading in cyclic 1ms periods of (case 1:) processed in the semaphore 1ms interrupt.
Other words the dog appears to be dead locked in this scenario and refuses to eat his food.
switch(Newcase)
{
case 0;
{
/* Various C code processed in the millisecond context of
PWM0 GEN0 software interrupt */
/* Load users milliseconds count value */
Count = UserParameter.Count;
/* Unlock the Watchdodgs registers for write access */
HWREG(WATCHDOG0_BASE + WDT_O_LOCK) = WDT_LOCK_UNLOCK;
}
case 1:
{
/* Wdog0 for 1ms intervals of user hold count x 120k.
* Note: Count should default to milliseconds but does not */
HWREG(WATCHDOG0_BASE + WDT_O_LOAD) = (Count * 120000);
/* Various C code processed in the millisecond context of
PWM0 GEN1 software interrupt */
/* Enable PWM selected (enabled) pin mux outputs for gating PWM. */
HWREG(PWM0_BASE + PWM_O_ENABLE) |= (ulPWMOutBits & 0x3F);
Count--;
If (Count == 0)
{
Newcase = 2;
Count = UserParameter.Count;
/* Lock the Watchdodg other registers blocking write access. */
HWREG(WATCHDOG0_BASE + WDT_O_LOCK) = WDT_LOCK_LOCKED;
break;
}
//break; doubles 1ms SW semaphore interrupt into case 1
}
}