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/
Revision 6:5ada291037aa, committed 2016-01-29
- Comitter:
- kenjiArai
- Date:
- Fri Jan 29 07:51:04 2016 +0000
- Parent:
- 5:bc464a588c2e
- Child:
- 7:27a1cf7f8921
- Commit message:
- Use mbed-dev lib. (old rev. -> use mbed-src)
Changed in this revision
--- a/SetRTC.lib Sat May 23 22:26:37 2015 +0000 +++ b/SetRTC.lib Fri Jan 29 07:51:04 2016 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/kenjiArai/code/SetRTC/#fc7223031196 +http://developer.mbed.org/users/kenjiArai/code/SetRTC/#4074fe3e67c7
--- a/TextLCD.lib Sat May 23 22:26:37 2015 +0000 +++ b/TextLCD.lib Fri Jan 29 07:51:04 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/kenjiArai/code/TextLCD/#986538f94abe +http://developer.mbed.org/users/wim/code/TextLCD/#111ca62e8a59
--- a/main.cpp Sat May 23 22:26:37 2015 +0000 +++ b/main.cpp Fri Jan 29 07:51:04 2016 +0000 @@ -24,7 +24,7 @@ // Definition ------------------------------------------------------------------------------------ #define SHOW_KEY_PROMPT 30 -#define USE_LCD +//#define USE_LCD #if defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F411RE) \ || defined(TARGET_NUCLEO_L152RE) || defined(TARGET_NUCLEO_F334R8) @@ -36,10 +36,11 @@ DigitalIn userSW(USER_BUTTON); DigitalOut myled(LED1); // Indicate the sampling period Serial pc(USBTX, USBRX); -#if defined(USE_LCD) +//#if defined(USE_LCD) I2C i2c(D14,D15); // SDA, SCL TextLCD_I2C_N lcd(&i2c, 0x7c, TextLCD::LCD8x2); // LCD(Akizuki AQM0802A) -#endif +//#endif +DigitalOut pwr_onoff(PA_9); // RAM ------------------------------------------------------------------------------------------- @@ -58,6 +59,8 @@ uint8_t wait_counter = 0; uint8_t xtal = 0; + pwr_onoff = 1; + wait(2.0); #if defined(USE_LCD) // lcd lcd.locate(0, 0); // 1st line top
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-dev.lib Fri Jan 29 07:51:04 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-dev/#2a2065e67ef6
--- a/mbed-src.lib Sat May 23 22:26:37 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed-src/#1abac31e188e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/readme_1st.txt Fri Jan 29 07:51:04 2016 +0000 @@ -0,0 +1,3 @@ +Please modify source code in mbed-dev library before using the program. +Refer /SetRTC/modify_info_F4xx.h, modify_info_F334.h and modify_info_L152.h + by JH1PJL \ No newline at end of file