Pages: 1 [2]   Go Down
Author Topic: Which external interrupt to wake 328P?  (Read 2336 times)
0 Members and 1 Guest are viewing this topic.
the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 158
Posts: 2879
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
explicitly state that edge-triggered interrupts are detected asynchronously without the I/O clock, and so will wake the MCU from power-down.
I believe this is usually done using an edge-triggered flip-flop that does not have a connection from the system clock, so it will trigger at any time at all, and hold its output until reset - usually by the ISR clearing it in s.w.

Jack, I like your code [will try it myself since I am setting up some battery-operated nodes], but FWIW, I don't think this would work properly with Mega chips, for reasons brought out on other threads recently [ie, interrupts being remapped on those chips],
Code:
    EIMSK = _BV(INT1);             //enable INT1
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3942
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Jack, I like your code [will try it myself since I am setting up some battery-operated nodes], but FWIW, I don't think this would work properly with Mega chips, for reasons brought out on other threads recently [ie, interrupts being remapped on those chips],
Code:
    EIMSK = _BV(INT1);             //enable INT1

@oric_dan, give me a little more on that please, or maybe links to some of those other threads, I'm not following...
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 158
Posts: 2879
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Check reply #2, etc,
http://forum.arduino.cc/index.php?topic=187600.0

See also the final note on Nick's page,
http://www.gammon.com.au/forum/?id=11488
Quote
Reply #8 on Sat 27 Jul 2013 12:41 AM (UTC)
Interrupt names to pin mappings
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3942
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah OK, thanks. I wasn't concerned with portability between MCUs or pin mapping. I'm strictly working with the 328P. For whatever reason, I never much got into using Arduino's interrupt functions, I prefer to just code the ISRs and set the registers as needed.

I you do try that code, I'd be very interested in your results. Nick was able to duplicate my results, and I have informed Atmel that my results were independently verified by one person, but the more the merrier. Thanks!
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 158
Posts: 2879
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, I just thought I'd mention it. If I saw your sketch, and I were using a Mega board, I'd immediately try it of course, since Arduino code is reputed to be so "transportable" across processors, lol. Now, back to work.
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3942
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Atmel has reproduced the behavior, and has escalated the issue. I asked whether it might just be a documentation error (reply #12 above).
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good catch there Jack.  :-)
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Atmel has reproduced the behavior, and has escalated the issue. I asked whether it might just be a documentation error (reply #12 above).

So that's Jack, myself, and Atmel. smiley

Well at least we aren't going mad.
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3942
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well at least we aren't going mad.

I know! That's what I always think in these situations!  smiley-grin
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3942
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The final word from Atmel:

Quote
From: <avr@atmel.com>
Date: Fri, Oct 11, 2013 at 1:04 AM
Subject: (ATTicket:751590) External interrupt to wake ATmega328P from power-down
To: jack.christensen

Dear Jack,
 
You are correct, both edge and level based interrupt are waking up the device and the issue have verified with the internal resource. As you mention this has to be updated in the document and this will be updated in the upcoming release.
Thanks for your valuable inputs.
Sorry for the delay in response and Kevin is on leave so the ticket has assinged to me

Best Regards,
Vincent Christopher
Atmel Technical Support Team
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You are correct, both edge and level based interrupt are waking up the device and the issue have verified with the internal resource.

It's strangely vague about whether this is by design, or just happens on the chips that are tested.

It would be nice if they had said it is designed to do it.
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3942
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You are correct, both edge and level based interrupt are waking up the device and the issue have verified with the internal resource.

It's strangely vague about whether this is by design, or just happens on the chips that are tested.

It would be nice if they had said it is designed to do it.

I thought the same thing which is why I asked one final question, that was not answered (below).  Assuming they were diligent about the whole thing, and also assuming that the update to the datasheet will make it read like the other ATmega datasheets, then I can only conclude that the observed behavior is by design.

Quote
From: Jack Christensen
Date: Fri, Oct 11, 2013 at 7:54 AM
Subject: Re: (ATTicket:751590) External interrupt to wake ATmega328P from power-down
To: avr@atmel.com

Hello Vincent,

No problem, thanks for the update.  Just to be clear, the device is operating as designed, and the issue was with the documentation, correct?

Best regards,
Jack Christensen
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ticket Status:  Confirmed Bug Feature
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3942
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ticket Status:  Confirmed Bug Feature

I really do think the chip is working as designed, and it was just a documentation error.

What was that old saying?  Something like "A bug is a problem with the code, an error is a problem with the documentation." ??
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Pages: 1 [2]   Go Up
Jump to: