Go Down

Topic: Which external interrupt to wake 328P? (Read 13186 times) previous topic - next topic

oric_dan

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: [Select]
    EIMSK = _BV(INT1);             //enable INT1

JChristensen


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: [Select]
    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...

oric_dan

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

JChristensen

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!

oric_dan

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.

JChristensen

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

SirNickity


nickgammon


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. :)

Well at least we aren't going mad.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

JChristensen


Well at least we aren't going mad.


I know! That's what I always think in these situations!  :D

JChristensen

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

nickgammon


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.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

JChristensen



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


SirNickity

Ticket Status:  Confirmed Bug Feature

JChristensen


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." ??

ari_jasberg

I have been searching this forum / other forums for an explanation to my findings on m328p, and finally I see this thread. Thanx Jack!

I can confirm wake-up of m328p from power-down on rising/falling edge on INT0 pin. I used a minimalist setup running with 8Mhz internal oscillator on a breadboard, and the triggering edge was generated by a master m328p. After the wake-up, the slave m328p sent a digital signal back to the master that measured the start-up delay to be max  90 microseconds (BOD was disabled on power-down, and according to atmel's documentation this creates a start-up delay of 60us)

I also measured the supply current to the slave m328. In active mode current was 6-7mA, and on entering sleep the current drop to 0.2uA, which confirms that m328p entered power-down mode.


Go Up