Skip to main content
Arduino

Timeline for atmega88 timer2 32.768KHz and Serial problem

Current License: CC BY-SA 4.0

8 events
when toggle format what by license comment
May 31, 2018 at 16:31 comment added Indraneel @Edgar_Bonet Problem is mostly during startup, like if I press the reset pin for too long (1-2 seconds, instead of small tap). But problem shows up only after 1st sleep cycle is complete (after 1st 8 seconds). No difference on adding 0.1uF capacitor to reset pin.
May 31, 2018 at 15:02 comment added Indraneel Thanks for the update. I'll see if that helps. I think, writing to the LED pin may also be causing an interrupt. It is helping to put a delay after the write. I have edited my question above with the updated code.
May 31, 2018 at 8:24 comment added Edgar Bonet @Indraneel: Re serial interrupts: see the edited answer. I don't know what you mean by "I put the timer2 interrupt in an ISR".
May 31, 2018 at 8:23 history edited Edgar Bonet CC BY-SA 4.0
+ info on serial interrupts.
May 30, 2018 at 23:53 vote accept Indraneel
May 30, 2018 at 23:29 comment added Indraneel I checked, and your instructions fixed the garbled messages of the serial line. Also, millis() does indeed only count the wake time. However, it seems serial uses interrupts, so it is still causing some problems. I put the timer2 interrupt in an ISR, and it is slightly better. It causes a problem only if the serial wires are connected during reset.
May 30, 2018 at 14:39 comment added Indraneel Thanks. I will check if that fixes the serial issues. I did not know that millis would be halted during sleep, inspite of keeping timer0 enabled. Maybe I'll be able to check that if I can get serial to work reliably. However, I'm only using millis() as a rough estimate as it's running from the internal oscillator, so not a dealbreaker if it is messed up.
May 30, 2018 at 11:17 history answered Edgar Bonet CC BY-SA 4.0

AltStyle によって変換されたページ (->オリジナル) /