Other Parts Discussed in Thread: MSP-FET
Hi everybody!
For a low-power-application I utilize RTC_A as interrupt source to wake up the MCU; ACLK=XT1=32768Hz.
The initial code is as follows (MCLK=DCO=12MHz - fast enough):
mov #RT0PSHOLD,&RTCPS0CTL
mov #RT1PSHOLD,&RTCPS1CTL // Both prescalers are on hold - internal dividers should hopefully be reset (no description about that topic available, by the way)
mov #RT0PSDIV_7,&RTCPS0CTL // CLK-source=ACLK, IRQ not enabled.
mov #RT1SSEL_2+RT1IP_7+RT1PSIE,&RTCPS1CTL
nop
bis #GIE+CPUOFF+SCG0+SCG1,SR // put MCU into LPM3 and wait for interrupt
The point is, that when I set RTCPS1CTL also the IFG is set immediately. This does not only occur in debug mode (IAR Workbench together with latest MSP-FET debugger) but also during runtime. Of cource, under that condition the LPM3 mode is useless and a proper timing is never possible.
The only possibility to override this is to manually reset the IFG before putting the MCU to LPM3, e.g. "bic #RT1PSIFG,&RTCPS1CTL". The crazy thing is that at another code position that problem with a pre-set IFG does not occur.
So, what's the problem with the IFG-flag? And also important: When setting the prescalers on Hold, is its divider also reset?