Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
TrevorWhite
PostPosted: Mar 08, 2012 - 12:52 PM
Hangaround


Joined: Jan 20, 2003
Posts: 398
Location: Birmingham, England

Hi all.

I have looked through for old posts but is it really not possibly to wake the xmega from sleep periodically like the Tiny and Mega range can?

I have found that the WDT can cause a reset which wakes the processor up but I want to just sleep at a certain position in code and wake in a loop. Is that really not practical anymore?

Any help appreciated.

Thanks

Trev
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Slordak
PostPosted: Mar 08, 2012 - 02:21 PM
Wannabe


Joined: Sep 22, 2011
Posts: 91


Assuming the XMEGA is sleeping in a light enough state that the peripherals are still running, you can do this with any timer/counter interrupt. This is the lightest sleep state, "Idle Mode".

If the XMEGA is sleeping in a deeper state, including "Power-Save Mode" or "Extended Standby Mode", you need to make use of the Real Time Counter (RTC). This can cause a wake-up on overflow or on compare match.
 
 View user's profile Send private message  
Reply with quote Back to top
TrevorWhite
PostPosted: Mar 08, 2012 - 03:03 PM
Hangaround


Joined: Jan 20, 2003
Posts: 398
Location: Birmingham, England

Thanks for the answer. I have actually just worked around it by setting a value in eeprom in a special mode and then upon power up checking if it the eeprom has that value in it. I then decide what to do. Its a bit of a pain really but it works it seems. It probably waste a bit of energy but what can I poor boy do.

Still, finding the xmega a great device to work with in general.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
mojo-chan
PostPosted: Mar 08, 2012 - 04:19 PM
Resident


Joined: Jan 24, 2008
Posts: 521


Keep in mind that when the XMEGA resets it actually runs through a whole reset procedure that wastes a fair amount of energy. The datasheet says something like 1300uA during reset.

The lowest power way to do it that I could come up with was to run the RTC from the internal ultra low power 32KHz oscillator. It isn't very accurate (+/-30%) though.
 
 View user's profile Send private message  
Reply with quote Back to top
TrevorWhite
PostPosted: Mar 08, 2012 - 08:38 PM
Hangaround


Joined: Jan 20, 2003
Posts: 398
Location: Birmingham, England

I have the system running in Power-down mode. According to the datasheet the RTC Clock is not running. Nothing is running apart from the Port interrupts and the TWI interrupt. The wdt timer clock is separate and running. So in Power-down mode I do not think I can do your idea mojo-chan. It would have been useful if I could but doesn't look like I can.

If I wake up and use 5mA for 5ms and I wake up every second then the actual average is 30uA. I have a couple of pullups that are used and if I do not poll them like this they use 400uA when pulled down. So despite the polling currents it works out being 10 times better.

If I had the wdt interrupt available it would have been best.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Slordak
PostPosted: Mar 16, 2012 - 05:03 PM
Wannabe


Joined: Sep 22, 2011
Posts: 91


Per the XMEGA manual, the only difference between "Power-down Mode" and "Power-save Mode" is that the RTC can be running in "Power-save Mode".

In the datasheet I have, the typical current draw in "Power-down Mode" with the WDT running is 1 uA. The typical current draw in "Power-save Mode" with the RTC running from the 32 kHZ TOSC is 1.16 uA. Since the system eats up 1300 uA for a reset plus all the current spent running everything until your next sleep cycle, how can you possibly prefer to constantly reset instead of the miniscule difference between these modes?!

Use the "Power-save Mode"!
 
 View user's profile Send private message  
Reply with quote Back to top
TrevorWhite
PostPosted: Mar 18, 2012 - 12:24 PM
Hangaround


Joined: Jan 20, 2003
Posts: 398
Location: Birmingham, England

Sorry, I have only just read this. Thanks for taking the time to answer it. You have raised a great point and I really appreciate that. I obviously need to look into this.

Many thanks

Trev
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
hzrnbgy
PostPosted: Mar 18, 2012 - 02:10 PM
Hangaround


Joined: Mar 26, 2011
Posts: 216
Location: Aloha state

you can run the WDT in interrupt mode
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits