Atmel has reproduced the behavior, and has escalated the issue. I asked whether it might just be a documentation error (reply #12 above).
Commented by Manoraj Gnanadhas (Atmel)2015-01-08 11:27:32 GMT[Recipients: Nick Gammon]Hello Nick,Thank you for contacting Atmel Technical Support.It looks like a mistake in the datasheet. We tested here and also able to reproduce the same behavior here. If you refer "Section - 13. External Interrupts (Page-70)", you can read the following information."Low level interrupts and the edge interrupt on INT2:0 are detected asynchronously. This implies that these interrupts can be used for waking the part also from sleep modes other than Idle mode."This is contradicting with the 'Note-3' mentioned under Table 10-1. Therefore I need to confirm this with the concerned team. I will get back to you once I receive any valid update from the design team.Best Regards,Manoraj Gnanadhas
Commented by Manoraj Gnanadhas (Atmel)2015-01-20 06:23:36 GMT(Recipients: Nick Gammon)Hello Nick,Our design team has confirmed that "Note-3 mentioned under Table 10-1" is a datasheet bug. So you can use any type of interrupt (Rising edge/ Falling edge / Low level / Any logical change) to wake up from sleep mode. Sorry for the inconvenience caused.Best Regards,Manoraj Gnanadhas
// blah blah configure IRQ that could wake us (in my case INT0 and a Pin change)volatile uint8_t counter = 0;// we don't want to be waked by the watchdog, so be // sure to disable it by changing the configWDTCSR = _BV(WDCE) | _BV(WDE);WDTCSR = 0; set_sleep_mode(SLEEP_MODE_PWR_DOWN);sleep_enable(); // turn off BOD (sequenced order see datasheet)// Don't change anything before we're wakedMCUCR = _BV(BODS) | _BV(BODSE);MCUCR = _BV(BODS); sei(); sleep_cpu(); // ...........// ZZZZZZZZZZZ// ........... // Waked !!!counter++;nop(); // be sure to avoid compiler optimization changing 3*+1 counter increment to 1*3counter++;nop(); // be sure to avoid compiler optimization changing 3*+1 counter increment to 1*3counter++;
So my question is : what is the 1st instruction executed after wake up ?