> Thank you Mark, can you elaborate how to power down peripherals?
"Chapter 10 Power management" in the reference manual is the obvious place to start.
This chip has:
10.2.1 Peripheral Power Management Registers (PPMRH, PPMRL)
They don't power down and reset the peripherals though. They only allow the clocks to be stopped.
Do not simply "stop the clocks" on running peripherals. For instance on the MCF5329 LCDC, stopping the clock while the LCDC is in the middle of a DMA cycle locks it up and locks up the whole chip solid. I'd refer you to the following:
10.2.1
NOTE
It is the software’s responsibility to appropriately disable module clocks
using the PPMRx only when a module is completely unused or quiescent.
10.4.1.5 Peripheral Shut Down
Most peripherals may be disabled by software to cease internal clock generation and remain
in a static state. Each peripheral has its own specific disabling sequence (refer to each
peripheral description for further details). A peripheral may be disabled at any time
and remain disabled during any low-power mode of operation.
You should try to write modular drivers for every peripheral. For each one you want both "open()" and "close()" functions, with the "close()" operation being in the main the reverse of what the "open()" function did.
If you're not using the "Soft Reset" for anything, you could use it to transition from the Boot to the Appliction. Have the boot run normally, set up SRAM (or whatever) so the App can run, and then trigger a Soft Reset. When the boot starts again, it can check for the SOFT bit in the RSR, and then bypass what it normally does and run the Application code with a minimum of setup.
Some chips from some manufacturers might have sections that can be powered down and reset simply. This isn't one of them.
Tom