Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Mega48V pwerdown troubles?

Mega48V pwerdown troubles?

2007-07-22 by Richard Cooke

Hi Folks,

How do you set up the external interrupt on change to get the chip to
come out of powerdown mode?

I'm having trouble with getting my Mega48V to come out of powerdown. 
I need to read/debounce 4 tactile switches, power up a nRF905 chip,
send the command and then go back to sleep.

I've sucessfully run the program if I don't go into sleep mode but now
that I need to test the power consumption I've enabled the powerdown
section.

Here is the external pin change ISR:

// Pin change 8-14 interrupt service routine
interrupt [PCINT1] void pin_change_isr1(void)
{
EXT_PIN_INTR_DISABLE;         // Disable any more external pin change
interrupts
PWR_UP = 1;                   // Power up the nRF905 chip
Switch_State = (PINC & 0x0f); // PC0, PC1, PC2, PC3 connected to the
switches
}

Here is where I set up the external pin change interrupt enable:

// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// Interrupt on any change on pins PCINT0-7: Off
// Interrupt on any change on pins PCINT8-14: On
// Interrupt on any change on pins PCINT16-23: Off
EICRA = 0x00;
EIMSK = 0x00;
PCICR = 0x02;
PCMSK1 = 0x0f;
PCIFR=0x02;


What else do I have to do?

Thanks,

Richard Cooke
Lake Forest, CA USA

Re: Mega48V pwerdown troubles?

2007-07-22 by Richard Cooke

Jim,

Your post was empty.  I'm desperate and I'm out of ideas.

Thanks,

Richard 

--- In AVR-Chat@yahoogroups.com, "Jim Wagner" <jim_d_wagner@...> wrote:
Show quoted textHide quoted text
>
> On Sun, 22 Jul 2007 20:28:47 -0000
>  "Richard Cooke" <rcooke@...> wrote:
> > Hi Folks,
> > 
> > How do you set up the external interrupt on change to get
> > the chip to
> > come out of powerdown mode?
> > 
> > I'm having trouble with getting my Mega48V to come out of
> > powerdown. 
> > I need to read/debounce 4 tactile switches, power up a
> > nRF905 chip,
> > send the command and then go back to sleep.
> > 
> > I've sucessfully run the program if I don't go into sleep
> > mode but now
> > that I need to test the power consumption I've enabled
> > the powerdown
> > section.
> > 
> > Here is the external pin change ISR:
> > 
> > // Pin change 8-14 interrupt service routine
> > interrupt [PCINT1] void pin_change_isr1(void)
> > {
> > EXT_PIN_INTR_DISABLE;         // Disable any more
> > external pin change
> > interrupts
> > PWR_UP = 1;                   // Power up the nRF905 chip
> > Switch_State = (PINC & 0x0f); // PC0, PC1, PC2, PC3
> > connected to the
> > switches
> > }
> > 
> > Here is where I set up the external pin change interrupt
> > enable:
> > 
> > // External Interrupt(s) initialization
> > // INT0: Off
> > // INT1: Off
> > // Interrupt on any change on pins PCINT0-7: Off
> > // Interrupt on any change on pins PCINT8-14: On
> > // Interrupt on any change on pins PCINT16-23: Off
> > EICRA = 0x00;
> > EIMSK = 0x00;
> > PCICR = 0x02;
> > PCMSK1 = 0x0f;
> > PCIFR=0x02;
> > 
> > 
> > What else do I have to do?
> > 
> > Thanks,
> > 
> > Richard Cooke
> > Lake Forest, CA USA
> > 
> > 
> 
> ---------------------------------------------------------------
> The Think Different Store
> http://www.thinkdifferentstore.com/
> For All Your Mac Gear
> ---------------------------------------------------------------
>

Re: Mega48V pwerdown troubles?

2007-07-22 by Richard Cooke

Hi John,

According to the Mega48 manual (page 40) the following conditions will
wake the chip from power-down mode:

"Only an External Reset, a Watchdog System Reset, a Watchdog
Interrupt, a Brown-out Reset, a 2-wire Serial Interface address match,
an external level interrupt on INT0 or INT1, or a pin change
interrupt can wake up the MCU."

So, I hope I'm reading this correctly.  My device needs to operate on
a CR3025 coin cell so I need to spend most of the time in power-down mode.

Thanks,

Richard Cooke

--- In AVR-Chat@yahoogroups.com, John Samperi <samperi@...> wrote:
>
> At 06:28 AM 23/07/2007, you wrote:
> >Here is the external pin change ISR:
> 
> Are you sure that you can wake up from sleep mode with PCINT?
> I haven't used it but perhaps that's not possible. SORRY :-(
> 
> 
> Regards
> 
> John Samperi
> 
> ********************************************************
> Ampertronics Pty. Ltd.
> 11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
> Tel. (02) 9674-6495       Fax (02) 9674-8745
> Email: john@...
> Website  http://www.ampertronics.com.au
> *Electronic Design * Custom Products * Contract Assembly
> ********************************************************
> 
> 
> -- 
> No virus found in this outgoing message.
> Checked by AVG Free Edition. 
> Version: 7.5.476 / Virus Database: 269.10.12/910 - Release Date:
21/07/2007 3:52 PM
>

Re: [AVR-Chat] Mega48V pwerdown troubles?

2007-07-22 by Jim Wagner

On Sun, 22 Jul 2007 20:28:47 -0000
 "Richard Cooke" <rcooke@digitalwavelength.com> wrote:
> Hi Folks,
> 
> How do you set up the external interrupt on change to get
> the chip to
> come out of powerdown mode?
> 
> I'm having trouble with getting my Mega48V to come out of
> powerdown. 
> I need to read/debounce 4 tactile switches, power up a
> nRF905 chip,
> send the command and then go back to sleep.
> 
> I've sucessfully run the program if I don't go into sleep
> mode but now
> that I need to test the power consumption I've enabled
> the powerdown
> section.
> 
> Here is the external pin change ISR:
> 
> // Pin change 8-14 interrupt service routine
> interrupt [PCINT1] void pin_change_isr1(void)
> {
> EXT_PIN_INTR_DISABLE;         // Disable any more
> external pin change
> interrupts
> PWR_UP = 1;                   // Power up the nRF905 chip
> Switch_State = (PINC & 0x0f); // PC0, PC1, PC2, PC3
> connected to the
> switches
> }
> 
> Here is where I set up the external pin change interrupt
> enable:
> 
> // External Interrupt(s) initialization
> // INT0: Off
> // INT1: Off
> // Interrupt on any change on pins PCINT0-7: Off
> // Interrupt on any change on pins PCINT8-14: On
> // Interrupt on any change on pins PCINT16-23: Off
> EICRA = 0x00;
> EIMSK = 0x00;
> PCICR = 0x02;
> PCMSK1 = 0x0f;
> PCIFR=0x02;
> 
> 
> What else do I have to do?
> 
> Thanks,
> 
> Richard Cooke
> Lake Forest, CA USA
> 
> 

---------------------------------------------------------------
The Think Different Store
http://www.thinkdifferentstore.com/
For All Your Mac Gear
---------------------------------------------------------------

Re: [AVR-Chat] Mega48V pwerdown troubles?

2007-07-22 by John Samperi

At 06:28 AM 23/07/2007, you wrote:
>Here is the external pin change ISR:

Are you sure that you can wake up from sleep mode with PCINT?
I haven't used it but perhaps that's not possible. SORRY :-(


Regards

John Samperi

********************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495       Fax (02) 9674-8745
Email: john@ampertronics.com.au
Website  http://www.ampertronics.com.au
*Electronic Design * Custom Products * Contract Assembly
********************************************************


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.10.12/910 - Release Date: 21/07/2007 3:52 PM

Re: [AVR-Chat] Re: Mega48V pwerdown troubles?

2007-07-22 by enkitec@gmail.com

On 22 Jul 2007 at 22:08, Richard Cooke wrote:

> // Interrupt on any change on pins PCINT0-7: Off
> // Interrupt on any change on pins PCINT8-14: On
> // Interrupt on any change on pins PCINT16-23: Off
> EICRA = 0x00;
> EIMSK = 0x00;
> PCICR = 0x02;
> PCMSK1 = 0x0f;
> PCIFR=0x02;
> 
> 
> What else do I have to do?
> 


	SMCR = ???

	Have you enable INT before going to SLEEP?

	Mark Jordan

Re: [AVR-Chat] Re: Mega48V pwerdown troubles?

2007-07-22 by Jim Wagner

Richard -

This does not address your immediate question but is the
next step after you solve that. Its tht nasty business of
switch debounce. 

If it wakes up on a pin change, then does it start
executing when the timers are fully up and operating? I've
never dealt with this situation but I would be uneasy
whether or not I could reliably use a timer as part of
switch debounce. I think what I would otherwise try to do
is start a timer (say 100ms or so) within the interrupt. If
a second edge inturrupt happens while the timer is running,
then I would reset the timer but ignore the edge. Question
is whether or not the timer is fully available during that
initial interrupt on wakeup. Guess if code is executing, it
must be?

Jim


On Sun, 22 Jul 2007 22:08:51 -0000
 "Richard Cooke" <rcooke@digitalwavelength.com> wrote:
> Jim,
> 
> Your post was empty.  I'm desperate and I'm out of ideas.
> 
> Thanks,
> 
> Richard 
> 
> --- In AVR-Chat@yahoogroups.com, "Jim Wagner"
> <jim_d_wagner@...> wrote:
> >
> > On Sun, 22 Jul 2007 20:28:47 -0000
> >  "Richard Cooke" <rcooke@...> wrote:
> > > Hi Folks,
> > > 
> > > How do you set up the external interrupt on change to
> get
> > > the chip to
> > > come out of powerdown mode?
> > > 
> > > I'm having trouble with getting my Mega48V to come
> out of
> > > powerdown. 
> > > I need to read/debounce 4 tactile switches, power up
> a
> > > nRF905 chip,
> > > send the command and then go back to sleep.
> > > 
> > > I've sucessfully run the program if I don't go into
> sleep
> > > mode but now
> > > that I need to test the power consumption I've
> enabled
> > > the powerdown
> > > section.
> > > 
> > > Here is the external pin change ISR:
> > > 
> > > // Pin change 8-14 interrupt service routine
> > > interrupt [PCINT1] void pin_change_isr1(void)
> > > {
> > > EXT_PIN_INTR_DISABLE;         // Disable any more
> > > external pin change
> > > interrupts
> > > PWR_UP = 1;                   // Power up the nRF905
> chip
> > > Switch_State = (PINC & 0x0f); // PC0, PC1, PC2, PC3
> > > connected to the
> > > switches
> > > }
> > > 
> > > Here is where I set up the external pin change
> interrupt
> > > enable:
> > > 
> > > // External Interrupt(s) initialization
> > > // INT0: Off
> > > // INT1: Off
> > > // Interrupt on any change on pins PCINT0-7: Off
> > > // Interrupt on any change on pins PCINT8-14: On
> > > // Interrupt on any change on pins PCINT16-23: Off
> > > EICRA = 0x00;
> > > EIMSK = 0x00;
> > > PCICR = 0x02;
> > > PCMSK1 = 0x0f;
> > > PCIFR=0x02;
> > > 
> > > 
> > > What else do I have to do?
> > > 
> > > Thanks,
> > > 
> > > Richard Cooke
> > > Lake Forest, CA USA
> > > 
> > > 
> > 
> >
>
---------------------------------------------------------------
> > The Think Different Store
> > http://www.thinkdifferentstore.com/
> > For All Your Mac Gear
> >
>
---------------------------------------------------------------
> >
> 
> 

---------------------------------------------------------------
The Think Different Store
http://www.thinkdifferentstore.com/
For All Your Mac Gear
---------------------------------------------------------------

Re: Mega48V pwerdown troubles?

2007-07-23 by Richard Cooke

Hi Jim,

The code works great - as long as I don't go into power-down mode. 
While it is operating at full speed I never miss a switch press nor do
I get any false triggers.

I'm still trying so I haven't given up yet.

Richard

--- In AVR-Chat@yahoogroups.com, "Jim Wagner" <jim_d_wagner@...> wrote:
Show quoted textHide quoted text
>
> Richard -
> 
> This does not address your immediate question but is the
> next step after you solve that. Its tht nasty business of
> switch debounce. 
> 
> If it wakes up on a pin change, then does it start
> executing when the timers are fully up and operating? I've
> never dealt with this situation but I would be uneasy
> whether or not I could reliably use a timer as part of
> switch debounce. I think what I would otherwise try to do
> is start a timer (say 100ms or so) within the interrupt. If
> a second edge inturrupt happens while the timer is running,
> then I would reset the timer but ignore the edge. Question
> is whether or not the timer is fully available during that
> initial interrupt on wakeup. Guess if code is executing, it
> must be?
> 
> Jim
> 
> 
> On Sun, 22 Jul 2007 22:08:51 -0000
>  "Richard Cooke" <rcooke@...> wrote:
> > Jim,
> > 
> > Your post was empty.  I'm desperate and I'm out of ideas.
> > 
> > Thanks,
> > 
> > Richard 
> > 
> > --- In AVR-Chat@yahoogroups.com, "Jim Wagner"
> > <jim_d_wagner@> wrote:
> > >
> > > On Sun, 22 Jul 2007 20:28:47 -0000
> > >  "Richard Cooke" <rcooke@> wrote:
> > > > Hi Folks,
> > > > 
> > > > How do you set up the external interrupt on change to
> > get
> > > > the chip to
> > > > come out of powerdown mode?
> > > > 
> > > > I'm having trouble with getting my Mega48V to come
> > out of
> > > > powerdown. 
> > > > I need to read/debounce 4 tactile switches, power up
> > a
> > > > nRF905 chip,
> > > > send the command and then go back to sleep.
> > > > 
> > > > I've sucessfully run the program if I don't go into
> > sleep
> > > > mode but now
> > > > that I need to test the power consumption I've
> > enabled
> > > > the powerdown
> > > > section.
> > > > 
> > > > Here is the external pin change ISR:
> > > > 
> > > > // Pin change 8-14 interrupt service routine
> > > > interrupt [PCINT1] void pin_change_isr1(void)
> > > > {
> > > > EXT_PIN_INTR_DISABLE;         // Disable any more
> > > > external pin change
> > > > interrupts
> > > > PWR_UP = 1;                   // Power up the nRF905
> > chip
> > > > Switch_State = (PINC & 0x0f); // PC0, PC1, PC2, PC3
> > > > connected to the
> > > > switches
> > > > }
> > > > 
> > > > Here is where I set up the external pin change
> > interrupt
> > > > enable:
> > > > 
> > > > // External Interrupt(s) initialization
> > > > // INT0: Off
> > > > // INT1: Off
> > > > // Interrupt on any change on pins PCINT0-7: Off
> > > > // Interrupt on any change on pins PCINT8-14: On
> > > > // Interrupt on any change on pins PCINT16-23: Off
> > > > EICRA = 0x00;
> > > > EIMSK = 0x00;
> > > > PCICR = 0x02;
> > > > PCMSK1 = 0x0f;
> > > > PCIFR=0x02;
> > > > 
> > > > 
> > > > What else do I have to do?
> > > > 
> > > > Thanks,
> > > > 
> > > > Richard Cooke
> > > > Lake Forest, CA USA
> > > > 
> > > > 
> > > 
> > >
> >
> ---------------------------------------------------------------
> > > The Think Different Store
> > > http://www.thinkdifferentstore.com/
> > > For All Your Mac Gear
> > >
> >
> ---------------------------------------------------------------
> > >
> > 
> > 
> 
> ---------------------------------------------------------------
> The Think Different Store
> http://www.thinkdifferentstore.com/
> For All Your Mac Gear
> ---------------------------------------------------------------
>

Re: [AVR-Chat] Re: Mega48V pwerdown troubles?

2007-07-23 by John Samperi

At 08:42 AM 23/07/2007, you wrote:
>According to the Mega48 manual (page 40)

I can see a table on page 37 of my manual.
Page 40 is about System Control and Reset.

I can see that PCINT is supposed to wake up the processor.

Regards

John Samperi

********************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495       Fax (02) 9674-8745
Email: john@ampertronics.com.au
Website  http://www.ampertronics.com.au
*Electronic Design * Custom Products * Contract Assembly
********************************************************


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.10.14/912 - Release Date: 22/07/2007 7:02 PM

Re: [AVR-Chat] Re: Mega48V pwerdown troubles?

2007-07-23 by enkitec@gmail.com

A dumb question: have you enabled INT before going to SLEEP?

	Mark Jordan
Show quoted textHide quoted text
On 23 Jul 2007 at 3:29, Richard Cooke wrote:

> Hi Jim,
> 
> The code works great - as long as I don't go into power-down mode. 
> While it is operating at full speed I never miss a switch press nor do
> I get any false triggers.
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.