124
8331B–AVR–03/12
Atmel AVR XMEGA AU
10.5.2
Main Power Restore and Start-up Sequence
At every startup after main power is restored, the software should:
1.
Control the main reset source to determine that a POR or BOD took place.
2.
Check for power on the V
BAT
pin by reading the BBPWR flag.
3.
Read the power supervisor flags to determine further software action:
a.
If all power supervision flags are cleared, the battery backup system runs as nor-
mal. The software should enable access to the battery backup system and check
the crystal oscillator failure flag. If the flag is set, the software should assume that
the RTC counter value is invalid and take appropriate action.
b.
If any power supervision flags are set, it indicates the battery backup system has
lost power sometime during the period when the rest of the device was unpower-
erd. Software should assume that the configuration and RTC value are invalid and
take appropriate action.