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:
Mon Jan 11 07:55:27 2021 +0000
Parent:
12:8cb1f89541d1
Child:
14:4b03106ece1f
Commit message:
add boards

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Jan 06 23:57:37 2021 +0000
+++ b/main.cpp	Mon Jan 11 07:55:27 2021 +0000
@@ -6,7 +6,7 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created: January   17th, 2015
- *      Revised: January    6th, 2021
+ *      Revised: January   11th, 2021
  */
 
 /*  mbed library now suports RTC continuous operation at Reset & Power ON/OFF
@@ -30,6 +30,15 @@
     Nucleo-L152RE /  ok    /  ok     / no check (Need additional hardware)
     Nucleo-L073RZ /  ok    /  ok     / no check (Need additional hardware)
     not support on Mbed-os6.6.0 Nucleo-L053R8
+    
+    ----- add tested board -----
+    Nucleo-F446ZE
+    DISCO-F746NG
+    Nucleo-F746ZG
+    DISCO-F769NI
+    Nucleo-H743ZI2
+    Nucleo-F303K8
+    Nucleo-L432KC
 
     < Back-up circuit >
     CN7 VIN <- SBD <- 330 Ohm <- CR2032 + - -> CN7 GND
@@ -44,8 +53,16 @@
 #include "mbed.h"
 
 //  Definition -----------------------------------------------------------------
-#if (defined(TARGET_STM32F746NG) || defined(TARGET_STM32F746ZG))
+#if defined(TARGET_DISCO_F746NG)  \
+ || defined(TARGET_NUCLEO_F746ZG) \
+ || defined(TARGET_DISCO_F769NI)  \
+ || defined(TARGET_NUCLEO_F446ZE) \
+ || defined(TARGET_NUCLEO_H743ZI2)
 #define PUSHED_SW   1   // Active high
+#elif  defined(TARGET_NUCLEO_F303K8) \
+    || defined(TARGET_NUCLEO_L432KC)
+#define USER_BUTTON A0  // temporary setting
+#define PUSHED_SW   0   // Active low
 #else
 #define PUSHED_SW   0   // Active low
 #endif
@@ -107,14 +124,19 @@
                 }
                 thread_sleep_for(10);
                 puts("Entered the standby mode. ");
+#if defined(TARGET_NUCLEO_F303K8) || defined(TARGET_NUCLEO_L432KC)
+                puts("Please change A0 level for wake-up(Reset).");
+#else
                 puts("Please push USER BUTTON to wake-up(Reset).");
+#endif
                 myled = 0;
+ 
                 InterruptIn usr_sw(USER_BUTTON);
                 thread_sleep_for(1000);
                 DigitalIn dmy0(LED1);
                 DigitalIn dmy1(USBTX);
                 DigitalIn dmy2(USBRX);
-                usr_sw.fall(&usr_sw_irq);
+                usr_sw.fall(&usr_sw_irq); // actual push or chattering
                 thread_sleep_for(LONGLONGTIME);
             }
             thread_sleep_for(50);