Go Down

Topic: [Solved] ATMEGA8L with External Interrupts won't wake from sleep (Read 2729 times) previous topic - next topic

rohinkumar

Jun 28, 2014, 03:43 pm Last Edit: Jun 29, 2014, 06:58 pm by rohinkumar Reason: 1
I noticed that external interrupts coded on Atmega8L do not work as expected.

I am using "attachInterrupt(0,WakeUp,CHANGE)" compiled with Arduino NG or older w/ Atmega8.

Does anyone know what could be the problem? I tried coding the interrupts using registers also. It doesn't work except for external Interrupt on "LOW" to wake from POWER_DOWN mode.

This is very urgent... some plz help shed some light on this problem...


rohinkumar

I tried the exact same code... It didn't work for me when I am trying to do an interrupt on "CHANGE"...

It only works when interrupt is attached to "LOW"... There must be something wrong I am doing... Anyone can check and confirm this problem???

I am breaking my head over this for weeks. Tried all the sleep interrupt examples available...

rohinkumar

Datasheet says GICR of atmega8 has INT0 & INT1 as 6th and 7th bits respectively... (Atmega168/328 have them in 0th and 1st position... Does it change anything???

tf68

#4
Jun 29, 2014, 05:20 am Last Edit: Jun 29, 2014, 05:33 am by tf68 Reason: 1
http://playground.arduino.cc/Learning/ArduinoSleepCode

You missed this:

115.  *In all but the IDLE sleep modes only LOW can be used.

Atmel data sheet:

Low level interrupts on INT0/INT1 are detected asynchronously. This implies that these interrupts can be used for waking the part also from sleep modes other than Idle mode. The I/O clock is halted in all sleep modes except Idle mode.

rohinkumar

@tf68 that is strange because on arduino with atmega328 CHANGE interrupt works great in POWER_DOWN mode! You can verify it right away with the same code with CHANGE interrupt!

I understand that i/o clock is halted in power down mode... But as mentioned on page 66 of atmega8L datasheet the i/o clock is only required for rising/falling interrupts... It says"if a level triggered interrupt is used to wake up from power-down mode, the changed level must be held for some time to wake up the MCU"...

May be the problem is that the watchdog oscillator is disabled in my fuse bits... ??? Let me explore this possibility... What do you think?

tf68

1) The data sheet could be more clearly worded.
2) The data sheet implies that only low will work without a clock.
3) The fellow who wrote the tutorial thinks only low works without a clock.
4) Your experience (with the 8L) suggests that the data sheet is correct.

Not much help, but all I can offer.

rohinkumar


1) The data sheet could be more clearly worded.
2) The data sheet implies that only low will work without a clock.
3) The fellow who wrote the tutorial thinks only low works without a clock.
4) Your experience (with the 8L) suggests that the data sheet is correct.

Not much help, but all I can offer.



Yes! I agree with you about the datasheet. It is very vague to say the least. But Atmega328p seems to work to which I might shift my project to...

Thanks for clarifying about interrupts w/o i/o clocks... :)

westfw

Note that ATmega8 and ATmega328 are different "families" of chips, not just members of the same family with different amounts of memory (like m168 vs m328)  The m8 is quite  a bit older, and is probably "primitive" in various ways.

Go Up