This is a RTC additional function. This is only for Nucleo F401RE & F411RE mbed(Added L152RE, F334R8, L476RG & F746xx). If you connected battery backup circuit for internal RTC, you can make a power-off and reset condition. RTC still has proper time and date.
Dependents: Nucleo_rtos_sample PB_Emma_Ethernet
Please refer following NOTE information.
/users/kenjiArai/notebook/nucleo-series-rtc-control-under-power-onoff-and-re/
SetRTC.h
- Committer:
- kenjiArai
- Date:
- 2015-02-07
- Revision:
- 0:e4c20fd769f1
- Child:
- 1:3129de8d50ea
- Child:
- 2:765470eab2a6
File content as of revision 0:e4c20fd769f1:
/* * mbed Library program * Check & set RTC function and set proper clock if we can set * ONLY FOR "Nucleo Board" * * Copyright (c) 2014-2015 Kenji Arai / JH1PJL * http://www.page.sannet.ne.jp/kenjia/index.html * http://mbed.org/users/kenjiArai/ * Created: October 24th, 2014 * Revised: Feburary 7th, 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 * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef SET_RTC_H #define SET_RTC_H #include "mbed.h" #define TIMEOUT ((uint32_t)5000) #define RTC_DAT0 0x55aa55aa #define RTC_DAT1 0xaa55aa55 enum { UNKNOWN = -1, OK = 0, NG }; /** Check and set RTC module inside Nucleo STM32X CPU. * Latest Nucleo board has external LSE Crystal X2 but no proper setting both HW ans SW. * In addition, every power on and/or reset make initial condition even HW Backup condition. * This is cased by mbed initial subroutine problem. * This program intends to use RTC with X2 and works well with battery back-up hardware setting. * * @code * #include "mbed.h" * #include "SetRTC.h" * * int main() { * time_t seconds; * * CheckRTC(); * printf("Time: %s", ctime(&seconds)); * } * @endcode */ /** Check and Set RTC * @param none * @return if proper setting = OK, if not = NG and UNKNOWN-> no support this program */ int32_t SetRTC(void); void show_RTC_reg( void ); void time_enter_mode(void); #endif // SET_RTC_H