Hi guys, very good ideas here, thank you all!
Ok, I will shed light on the situation, w/ info expansion (:
The MCU is an xmega32e5 running at 32MHz (internal RC), it has only two power connections (4 pins), AVCC, VCC and relative GND's.
My idea of firmware behavior in this task is to set the IRQ vector on a specified pin on low lever priority (in xmega is the 1st to be executed, I guess is the same in others) and connect it to the initial non isolated stage of the power domain.
Then at power failure this will trigger the ISR that will proceed with a fast shutdown on all the peripherals (optionally), reset a rtc value and write data to EEPROM.
I did not thought about setting all pins as input, thanks!
About this aspect I should really do just test and calculations because maybe going into a shutdown sequence will not save such enough time in respect of the time gained, I mean, if I employ 5ms to shut down things to save 5ms, well...
What is really necessary, in respect to what uncle_bob said about power dips,there will be a time checking routine, I can't risk to write thousand times in EEPROM in case of an oscillating DC if power supply failure.
For info: no battery power supply, only regulated external DC PWS. In theory shut down is controlled.
Saving settings every now and then will not be a good idea since the nature of the device, better don't put the feature then getting a complain from a potential customer saying that nothing is saved on the right config stage.
EEPROM data consistency, writing speed and BOD:
writing speed - I was thinking to use the Split Write method instead of Atomic Write, writing speed is the half.
consistency - I may use a CRC8, but I'm worried this will be a longer process in respect to a simple page write.
BOD - In xmega a brown out detection will force the MPU reset, I may set it at for instance 2v. But why? This will not save memory corruption if reset is forced during a write cycle, or yes?
To Ian: I have only two devices running on 3.3v rail: MCU and OLED display, but I may shift the OLED display on 5v rail and change the LDO with a slightly "bigger" one.
Additional problem: I cannot use a super cap, this is big, the board is compressed in 5cm diameter circle.
Uncle_bob said that isolating a power domain maybe not easy as it seems, my solution of the simple diode and a "big" cap was all that it came into my mind.
By a mere electrical point of view, what would you suggest peeps?
PS. For luck EEPROM write is not very intense, it's a bunch of bytes