ATMega reset on wakeup?

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a ATMega1284 ( not a pico power part ) project that im FINALLY getting to go to sleep.

it sleeps just fine but on wakeup it resets. Grrrr

 

If I use SLEEP_MODE_IDLE everything is fine, if I use SLEEP_MODE_PWR_DWN it resets on wakeup

 

My Sleep code

        cli();
 	set_sleep_mode(SLEEP_MODE_PWR_DOWN);
	//set_sleep_mode(SLEEP_MODE_IDLE);
 	
 	// sleep_mode() has a possible race condition
 	sleep_enable();
 	sei();
 	sleep_cpu();
        sleep_disable();

 

Other that that it's working great, I'd just like to reduce power as much as possible. I'm about ready to just use idle mode :(

 

For those reading my post history yes the full swing osc fixed my start up issue. I just don't want to bring that old thread back to life

 

Thanks for the help!

Keith

Keith Vasilakes

Firmware engineer

Minnesota

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Let's see the smallest complete test program that exhibits the problem.

 

What wakeup sources are enabled?  What wakeup source is being used?  Is there a catching ISR?

 

Related to the last, how do you know it is a reset?  What reset cause is shown in MCUSR?

 

The answer to the last will help to answer about possible BOD interaction.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Wed. Jul 12, 2017 - 05:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Youre a slave driver, thats so much work lol

I did neglect to say that, for testing,  BOD is disabled, WDT is disabled.

 

Wakeup on on a pin change interrupt  ISR(PCINT3_vect)

 

I assume it's a reset since my processor restarts and does it's power up dance ;)

 

MCUSR, Yeah, gotta read that, forgot this chip has one

Keith Vasilakes

Firmware engineer

Minnesota

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

keith v wrote:
I assume it's a reset since my processor restarts and does it's power up dance

Do I really like to break up ass-u-me for you?

 

Thus the request for the complete sanity-check test program.  First guess is no catching ISR, and not a real reset.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ha ha you sure bit on that bait.

 

I know it is a reset, what I don't know is why it's resetting.

 

It's not being caught by my unhandled interrupt handler or my other error handlers.

 

But yes I'll be instrumenting the code better tonight.

Keith Vasilakes

Firmware engineer

Minnesota

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

keith v wrote:
I know it is a reset, what I don't know is why it's resetting.

Without the MCUSR evidence, it isn't known whether it is in fact an AVR reset, or some other mechanism such that the PC ends up at 0.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

well, that didn't help, the reset cause is zero on my restart.

I know it works since I get jtag and por resets.

Keith Vasilakes

Firmware engineer

Minnesota

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

keith v wrote:
well, that didn't help, the reset cause is zero on my restart.
That means something ran amok, and somehow ended up at 0.  Uncaught interrupt; null function pointer; stack overflow; ...

 

theusch wrote:
Let's see the smallest complete test program that exhibits the problem.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes yes yes, only so many hours in the night

Keith Vasilakes

Firmware engineer

Minnesota