I have some troubles with Wake-Up Timer.
I use WutLib as in example Timers.
WutCfg(T2CON_MOD_PERIODIC, T2CON_WUEN_DIS, T2CON_PRE_DIV16, T2CON_CLK_PCLK); // T2 config, PCLK/16, periodic mode,
WutCfgInt(T2IEN_WUFD, 1); // Interrupt on compare to D register
WutLdWr(3,1000); // Set the timeout period as 1mS
WutGo(T2CON_ENABLE_EN); // Start wake-up timer
NVIC_EnableIRQ(WUT_IRQn); // Enable Timer2 IRQ
I Get the interrupt and try to clear T2WUFD interrupt flag in T2STA.
But the flag remain active and I get new interrupt immediately after return from interrupt handler (I see it in IAR IDE in Register window).
Can you explain where is the mistake?
The same situation with example Timers. Bit WUFD in T2STA always set and WutClrInt can’t clear it.