In the past, you need modify rtc_api.c in mbed-dev source code. From this revision, you can just use RTC function all of conditions (Normal, Reset, Stand-by, Power OFF).

Note

From now on, you do NOT need any modification for mbed-dev library because STM team updates rtc_api.c source code and support RTC function under reset & standby condition includes power off condition (You need additional VBAT back-up hardware).

Please refer following NOTE information.
/users/kenjiArai/notebook/nucleo-series-rtc-control-under-power-onoff-and-re/

Files at this revision

API Documentation at this revision

Comitter:
kenjiArai
Date:
Sat Feb 14 11:35:34 2015 +0000
Parent:
0:0751c92c0f71
Child:
2:77ec44bf1fa5
Commit message:
support L152 mbed. Need to modify rtc_api.c in mbed-src.

Changed in this revision

SetRTC.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-src.lib Show annotated file Show diff for this revision Revisions of this file
mbed-src_check_rtc_base464.lib Show diff for this revision Revisions of this file
--- a/SetRTC.lib	Sat Feb 07 03:18:40 2015 +0000
+++ b/SetRTC.lib	Sat Feb 14 11:35:34 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/kenjiArai/code/SetRTC/#e4c20fd769f1
+http://developer.mbed.org/users/kenjiArai/code/SetRTC/#3129de8d50ea
--- a/main.cpp	Sat Feb 07 03:18:40 2015 +0000
+++ b/main.cpp	Sat Feb 14 11:35:34 2015 +0000
@@ -6,7 +6,7 @@
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
  *      Created: January   17th, 2015
- *      Revised: Feburary   7th, 2015
+ *      Revised: Feburary  14th, 2015
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
@@ -18,6 +18,7 @@
 //  Include ---------------------------------------------------------------------------------------
 #include "mbed.h"
 #include "TextLCD.h"
+ // MUST -> need to modify rtc_api.c, please refer SetRTC.h file [CATION] and modify_info_xxx.h
 #include "SetRTC.h"
 
 //  Definition ------------------------------------------------------------------------------------
@@ -25,6 +26,11 @@
 
 #define USE_LCD
 
+#if defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F411RE) || defined(TARGET_NUCLEO_L152RE)
+#else
+#error "Target is only Nucleo F401RE, F411RE and L152RE"
+#endif
+
 //  Object ----------------------------------------------------------------------------------------
 DigitalIn userSW(USER_BUTTON);
 DigitalOut myled(LED1);         // Indicate the sampling period
@@ -73,7 +79,7 @@
     }
     show_RTC_reg(); // only for debug purpose
     while(1) {
-        myled = !myled;
+        myled = 1;
         seconds = time(NULL);
         strftime(buf, 40, " %B %d,'%y, %H:%M:%S\r\n", localtime(&seconds));
         pc.printf("[Time] %s", buf);
@@ -88,7 +94,7 @@
         if (counter){
             --counter;
             //      012345678901234567890123456789012345678901234567890123456789012
-            pc.printf("Is time correct? If okay, nothing. If not, please hit any key.\r");
+            pc.printf("Is time correct? If no, hit any key.\r");
             wait(1.0);
             if (pc.readable() == 1){
                 buf[0] = pc.getc();  // dummy read
@@ -110,7 +116,8 @@
 #endif
             pc.printf("\r\nEnter Deep Sleep Mode, please push RESET to wake-up\r\n");
             wait(1.0);
-            myled = 0;       
+            myled = 0;
+            deepsleep_preparation();      
             deepsleep();
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-src.lib	Sat Feb 14 11:35:34 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-src/#cfdbf9d61292
--- a/mbed-src_check_rtc_base464.lib	Sat Feb 07 03:18:40 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://developer.mbed.org/users/kenjiArai/code/mbed-src_check_rtc_base464/#f8b8977c8d16