Cerberus and RTC wakeup

Hi guys

I’m doing some power tests using a cerberus and 4.3 SDK. I manage to down consumption to 5mA using SleepLevel.DeepSleep and now i need to use RTC to wake up the board. I soldered the recomended crystal between PC14 and PC15 pins but the board doesn’t wake up.
If i use SleepLevel.Sleep the RTC wakes the board, so i assume that the crystal is ok, but with SleepLevel.DeepSleep or SleepLevel.Off the RTC doesn’t work.

Any ideas?

Regards

What did you set your wake-up events to?

This is my code:

DateTime time = new DateTime(2014, 09, 12, 09, 00, 00);
RealTimeClock.SetDateTime(time);
RealTimeClock.SetAlarm(RealTimeClock.GetDateTime().AddSeconds(60));
PowerState.WakeupEvents |= HardwareEvent.OEMReserved2;
PowerState.Sleep(SleepLevel.Sleep, HardwareEvent.OEMReserved2);
//rest of the code

@ geologic -

is your version 4.3.4.0?

I’m using 4.3.3
I tried updating to 4.3.4 but cannot write firmware to the board, it gives me this error:

Error. Detailed situation:
Operation: 3
ErrorCode: 1234500A
Percent: 8
dwTag: 0000002B
szDevLink: \?\usb#vid_0483&pid_df11#3057326d3332#{3fe809ab-fb91-4cb5-a643-69670d52366e}
wTransferSize: 2048
LastDFUStatus.bStatus: 11
LastDFUStatus.bState: 10
LastDFUStatus.iString: 0
LastDFUStatus.bwPollTimeout: 0
CurrentRequest: 10000000
CurrentNBlock: 0
CurrentLength: 5
CurrentAddress: 08000000
CurrentImageElement: 0

@ geologic -

Can you please give us that screenshot, I really haven’t seen it before.

after update to 4.3.4.0, if still does not work, remove cap C11 and C10, and make sure your crystal is still connected to PC14, PC15 after removed these capacitors.

and the device won’t wake up if you are in VS.

This is exactly the error I get, and I have decided that the board is not working. Its scrap. Somneone from GHI claimed that the FLASH part of the chip was broken.

Not sure if that is the correct diagnosis…?

We can take a look if you send us one of them.

An RMA with you costs about 150usd in shipping and tax. I think I will scrap it.

@ andre.m - say that to the guys working in the border tax regime in Denmark! Any help appreciated! They charge 60usd just to check the value - each way!

@ njbuch - So if we send you a return with a zero value invoice, they still charge you $60 on the incoming package?

@ Gary - indeed. And add a 3 weeks delay.

@ njbuch - that’s crazy, I understand an import tax of some sort but to charge you $60 just to look at the included invoice. :wall:

Well, not sure what i did, but now i have a working cerberus with 4.3.4 :stuck_out_tongue:

This is what i did:

1 - error on erase at DFU tester 3.0.1
2 - opened DfuseDemo 3.0.2 (exe file is on the same folder than DFU tester)
3 - click "Leave DFU Mode"
4 - at Upload Action, click “choose…” and selected loader.dfu file
5 - click "Upload"
6 - after success closed window
7 - opened DFU tester and did the normal procedure: Detach, erase, download

njbuch: can you try these steps to see if you can update your board?

Regards

I will, next weekend…

Getting back to the beginning…
With 4.3.4 i have the same problem with SleepLevel.DeepSleep or SleepLevel.Off, the RTC doesn’t wake up.
Another strange behavior, SleepLevel.Sleep always wake up after 60 seconds even i set a different timer (for example 30 seconds or 2 minutes).

@ Dat: I’m not very confortable dessoldering those tiny caps, is there any other way?

Can you read the rtc time to make sure it’s running right

@ geologic -

  • Sleep Level.Sleep just put CPU in idle state, peripherals are still running if active. It means the board can be woken up if any interrupt is triggered.

  • Sleep Level.DeepSleep: GPIO + RTC interrupt active.

  • Sleep Level.Off: Only RTC interrupt active

Beside, the board won’t be woken if run in VS mode. You should deploy then run without VS.

Also as hagster said, firs thing, make sure RTC work. You can read them like these:

Debug.Print("now is            : " + RealTimeClock.GetDateTime().Date + "/" + RealTimeClock.GetDateTime().Month + "/" + RealTimeClock.GetDateTime().Date + " - " + RealTimeClock.GetDateTime().Hour + ":" + RealTimeClock.GetDateTime().Minute + ":" + RealTimeClock.GetDateTime().Second);
                Debug.Print("Start Hibernate at: " + RealTimeClock.GetAlarm().Date + "/" + RealTimeClock.GetAlarm().Month + "/" + RealTimeClock.GetAlarm().Date + " - " + RealTimeClock.GetAlarm().Hour + ":" + RealTimeClock.GetAlarm().Minute + ":" + RealTimeClock.GetAlarm().Second);

If your board is 1.1 or older, you may need to remove those caps to get RTC works.

I’m running it without VS and my board is 1.2

This is my code that is inside a button press event:

Mainboard.SetDebugLED(false);

DateTime time = new DateTime(2014, 9, 15, 7, 30, 0);
TimeService.SetUtcTime(time.Ticks);

GHI.Processor.RealTimeClock.SetDateTime(time);  // IT HANGS HERE

Debug.Print("Time: " + DateTime.Now);
RealTimeClock.SetAlarm(DateTime.Now.AddSeconds(120));

Debug.Print("now is            : " + RealTimeClock.GetDateTime().Date + "-" + RealTimeClock.GetDateTime().Month + "-" + RealTimeClock.GetDateTime().Date + " - " + RealTimeClock.GetDateTime().Hour + ":" + RealTimeClock.GetDateTime().Minute + ":" + RealTimeClock.GetDateTime().Second);

Debug.Print("Start Hibernate at: " + RealTimeClock.GetAlarm().Date + "-" + RealTimeClock.GetAlarm().Month + "-" + RealTimeClock.GetAlarm().Date + " - " + RealTimeClock.GetAlarm().Hour + ":" + RealTimeClock.GetAlarm().Minute + ":" + RealTimeClock.GetAlarm().Second);

PowerState.WakeupEvents |= HardwareEvent.OEMReserved2;
PowerState.Sleep(SleepLevel.Sleep, HardwareEvent.OEMReserved2);

Debug.Print("Awake            : " + RealTimeClock.GetDateTime().Date + "/" + RealTimeClock.GetDateTime().Month + "/" + RealTimeClock.GetDateTime().Date + " - " + RealTimeClock.GetDateTime().Hour + ":" + RealTimeClock.GetDateTime().Minute + ":" + RealTimeClock.GetDateTime().Second);

Debug.Print("Time: " + DateTime.Now);
Mainboard.SetDebugLED(true);

I have 2 strange behaviors:

  1. it hangs at line this line: GHI.Processor.RealTimeClock.SetDateTime(time)
  2. if i comment the line above and use RealTimeClock.SetAlarm(RealTimeClock.GetDateTime().AddSeconds(120));, it works ok, RTC GetDateTime reports 1/1/1980 00:00:00 and RealTimeClock.GetAlarm().Minute reports 2 minutes but it always wake up after 1 minute

So, before i call the fixies to dessolder those caps, is there any more ideas?