Win CE Power shutdown options on Colibri PXA

What is the simplest way to do a Windows shutdown on the Colibri PXA320. I have tried:

				retVal = SetSystemPowerState(NULL, POWER_STATE_OFF, 0);

It returns a 2 which indicates success but then does nothing. I’m running the CE 6.0 image.

We don’t support the POWER_STATE_OFF with our PXA BSPs (we didn’t test it). You could try to use POWER_FORCE instead of 0 as the last parameter and see if this makes a difference.
Do you need it in order to save power? Or would you like to use it to clean-up some handles? To safe power you could also just put the module into suspend mode:

To clean-up handles (e.g. file handles, etc.) please flush and close them individually in your application.
Let me know if you need any further information.

We have an instrument that we need to be able to turn completely off (for shelf life)–not just put into suspend mode. That does work BTW. Normally, holding the power button down for 3 seconds on a Windows CE device allows a full shut-down.

Such features would have to be built into the the carrier board you are going to use. At the end it would be a simple GPIO switching your carrier board off. Our standard carrier boards (Evaluation Board, Iris, Viola) don’t provide such features by default. You could do some tests with our Colibri Evaluation Board:
http://docs.toradex.com/102281-colibri-evaluation-board-schematics.zip
On page 3 of the schematics you will find connector X4. The FORCE_OFF# signal can be used for your feature. You can pull this signal low and the evaluation board turns off. But note: It’s not as easy as connecting any GPIO there and it will work. Based on the power up sequence and other stuff on the carrier board, there might be glitches on the GPIOs which would prevent the carrier board from booting. So you would have to implement a solid feature, e.g. using a GPIO feed through a buffer which uses RESET_OUT# as the output enable. Like this you avoid glitches powering off your device too early.
I hope these hints help.