WatchDog Interrupt CPUSleep

Discussion specific to the 24-pin ZX microcontrollers, e.g. ZX-24r, ZX-24s and ZX-24t.
integrator
Posts: 10
Joined: 05 February 2015, 4:52 AM

Post by integrator »

Never mind. That may have helped, but did not fix the problem.
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

integrator wrote:I emailed you my code.
I observed the issue that you described. I found that disabling the Timer0 and Timer2 interrupts before entering sleep mode, and then re-enabling them afterward, seemed to solve the problem.

I tried this on a hunch because of this statement in the datasheet section on sleep modes:
mega1284P datasheet wrote:If an enabled interrupt occurs while the MCU is in a sleep mode, the MCU wakes up.
In your app, the only interrupts enabled are the watchdog interrupt, Timer0 and Timer2 compare match A interrupt, and the three USART0 interrupts. It didn't seem necessary to disable/re-enable the USART interrupts in my test but in the actual application it might be necessary to disable at least the "data received" interrupt.
- Don Kinzer
Post Reply