Main Site Documentation

I'm having trouble with Cerb and Microsoft.SPOT.Hardware.PowerState.Sleep


I have code like this…

[quote]Microsoft.SPOT.Hardware.PowerState.MaximumTimeToActive = new TimeSpan(TimeSpan.TicksPerSecond * 10);

Microsoft.SPOT.Hardware.PowerState.Sleep(SleepLevel.DeepSleep, HardwareEvent.SystemTimer | HardwareEvent.GeneralPurpose);[/quote]

My device does wake up when I press a key on my keypad, but it never seems to wakeup on the timer?!?

I wanted my device to use as little power as necessary. So I check for keypad activity and when there isn’t any I turn off my peripherals and jump to DeepSleep. As soon as the user touches any key the device wakes up and response. There isn’t a perceivable lag so from the user standpoint they have no idea what’s happening. This works great for my device.

…BUT then I added my watchdog code. Since I need to kick that regularly, I changed my Sleep call to wakeup on a timer. My thinking is that the device should wake up every 10 seconds or so to kick the watchdog and then return to deep sleep.

I’d imagine other people would want to use NETMF this way, so I thought maybe someone else had run into this issue?

As always your help is appreciated.

Does Microsoft.SPOT.Hardware.PowerState.Sleep work with the HardwareEvent.SystemTimer event on Cerb boards?


I should clarify, I’ve disabled the watchdog code until I get the sleep/wakeup working properly.


You are using a Cerb board, true? The STM32F4’s disable certain clocks based on the power level. I don’t know which level “SleepLevel.DeepSleep” translates to, nor which clock the firmware is setting for the system timer, but I am suspecting that your timer is not running at the power level you are setting. Just a shot in the dark. I think we would need someone more familiar with the STM32 .NETMF port to fill in some of these blanks.


I prototype on Cerb boards, mostly the Cerb 40 and Cerbuino Bee. The same code eventually runs on custom boards we produce. I’ve tried this code on both and it doesn’t seem to function any differently.

I consulted page 70 of Doc ID 018909 Rev 1 from STM. They list the three modes as Sleep, Stop and Standby. I’m not sure that I’m reading it properly, but it looks like Sleep and Standby both support waking up from the RTC wakeup event. Stop does not. So, maybe DeepSleep in NETMF relates to STOP on the STM32F4?

I’ll post back when I have this sorted out for the next guy.


I hope you don’t mind I add this here. If you do, tell me and I will delete the post.

I am using Fez Cerbuino Bee aswell.

I am having an even worse problem, which is It won’t even go to sleep on this command:

Is there any news on this?

Thank you really much…