CARME-M4 BSP  V1.5
Initialization and Configuration functions

Initialization and Configuration functions. More...

+ Collaboration diagram for Initialization and Configuration functions:

Functions

ErrorStatus RTC_DeInit (void)
 Deinitializes the RTC registers to their default reset values. More...
 
ErrorStatus RTC_Init (RTC_InitTypeDef *RTC_InitStruct)
 Initializes the RTC registers according to the specified parameters in RTC_InitStruct. More...
 
void RTC_StructInit (RTC_InitTypeDef *RTC_InitStruct)
 Fills each RTC_InitStruct member with its default value. More...
 
void RTC_WriteProtectionCmd (FunctionalState NewState)
 Enables or disables the RTC registers write protection. More...
 
ErrorStatus RTC_EnterInitMode (void)
 Enters the RTC Initialization mode. More...
 
void RTC_ExitInitMode (void)
 Exits the RTC Initialization mode. More...
 
ErrorStatus RTC_WaitForSynchro (void)
 Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock. More...
 
ErrorStatus RTC_RefClockCmd (FunctionalState NewState)
 Enables or disables the RTC reference clock detection. More...
 
void RTC_BypassShadowCmd (FunctionalState NewState)
 Enables or Disables the Bypass Shadow feature. More...
 

Detailed Description

Initialization and Configuration functions.

 ===============================================================================
             ##### Initialization and Configuration functions #####
 ===============================================================================
 
 [..] This section provide functions allowing to initialize and configure the RTC
      Prescaler (Synchronous and Asynchronous), RTC Hour format, disable RTC registers
      Write protection, enter and exit the RTC initialization mode, RTC registers
      synchronization check and reference clock detection enable.
  
   (#) The RTC Prescaler is programmed to generate the RTC 1Hz time base. It is
       split into 2 programmable prescalers to minimize power consumption.
       (++) A 7-bit asynchronous prescaler and A 13-bit synchronous prescaler.
       (++) When both prescalers are used, it is recommended to configure the 
            asynchronous prescaler to a high value to minimize consumption.

   (#) All RTC registers are Write protected. Writing to the RTC registers
       is enabled by writing a key into the Write Protection register, RTC_WPR.

   (#) To Configure the RTC Calendar, user application should enter initialization
       mode. In this mode, the calendar counter is stopped and its value can be 
       updated. When the initialization sequence is complete, the calendar restarts 
       counting after 4 RTCCLK cycles.

   (#) To read the calendar through the shadow registers after Calendar initialization,
       calendar update or after wakeup from low power modes the software must first 
       clear the RSF flag. The software must then wait until it is set again before 
       reading the calendar, which means that the calendar registers have been 
       correctly copied into the RTC_TR and RTC_DR shadow registers.
       The RTC_WaitForSynchro() function implements the above software sequence 
       (RSF clear and RSF check).

Function Documentation

void RTC_BypassShadowCmd ( FunctionalState  NewState)

Enables or Disables the Bypass Shadow feature.

Note
When the Bypass Shadow is enabled the calendar value are taken directly from the Calendar counter.
Parameters
NewStatenew state of the Bypass Shadow feature. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 710 of file stm32f4xx_rtc.c.

ErrorStatus RTC_DeInit ( void  )

Deinitializes the RTC registers to their default reset values.

Note
This function doesn't reset the RTC Clock source and RTC Backup Data registers.
Parameters
None
Return values
AnErrorStatus enumeration value:
  • SUCCESS: RTC registers are deinitialized
  • ERROR: RTC registers are not deinitialized

Definition at line 375 of file stm32f4xx_rtc.c.

+ Here is the call graph for this function:

ErrorStatus RTC_EnterInitMode ( void  )

Enters the RTC Initialization mode.

Note
The RTC Initialization mode is write protected, use the RTC_WriteProtectionCmd(DISABLE) before calling this function.
Parameters
None
Return values
AnErrorStatus enumeration value:
  • SUCCESS: RTC is in Init mode
  • ERROR: RTC is not in Init mode

Definition at line 552 of file stm32f4xx_rtc.c.

+ Here is the caller graph for this function:

void RTC_ExitInitMode ( void  )

Exits the RTC Initialization mode.

Note
When the initialization sequence is complete, the calendar restarts counting after 4 RTCCLK cycles.
The RTC Initialization mode is write protected, use the RTC_WriteProtectionCmd(DISABLE) before calling this function.
Parameters
None
Return values
None

Definition at line 597 of file stm32f4xx_rtc.c.

+ Here is the caller graph for this function:

ErrorStatus RTC_Init ( RTC_InitTypeDef RTC_InitStruct)

Initializes the RTC registers according to the specified parameters in RTC_InitStruct.

Parameters
RTC_InitStructpointer to a RTC_InitTypeDef structure that contains the configuration information for the RTC peripheral.
Note
The RTC Prescaler register is write protected and can be written in initialization mode only.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: RTC registers are initialized
  • ERROR: RTC registers are not initialized

Definition at line 457 of file stm32f4xx_rtc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ErrorStatus RTC_RefClockCmd ( FunctionalState  NewState)

Enables or disables the RTC reference clock detection.

Parameters
NewStatenew state of the RTC reference clock. This parameter can be: ENABLE or DISABLE.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: RTC reference clock detection is enabled
  • ERROR: RTC reference clock detection is disabled

Definition at line 662 of file stm32f4xx_rtc.c.

+ Here is the call graph for this function:

void RTC_StructInit ( RTC_InitTypeDef RTC_InitStruct)

Fills each RTC_InitStruct member with its default value.

Parameters
RTC_InitStructpointer to a RTC_InitTypeDef structure which will be initialized.
Return values
None

Definition at line 503 of file stm32f4xx_rtc.c.

ErrorStatus RTC_WaitForSynchro ( void  )

Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock.

Note
The RTC Resynchronization mode is write protected, use the RTC_WriteProtectionCmd(DISABLE) before calling this function.
To read the calendar through the shadow registers after Calendar initialization, calendar update or after wakeup from low power modes the software must first clear the RSF flag. The software must then wait until it is set again before reading the calendar, which means that the calendar registers have been correctly copied into the RTC_TR and RTC_DR shadow registers.
Parameters
None
Return values
AnErrorStatus enumeration value:
  • SUCCESS: RTC registers are synchronised
  • ERROR: RTC registers are not synchronised

Definition at line 619 of file stm32f4xx_rtc.c.

+ Here is the caller graph for this function:

void RTC_WriteProtectionCmd ( FunctionalState  NewState)

Enables or disables the RTC registers write protection.

Note
All the RTC registers are write protected except for RTC_ISR[13:8], RTC_TAFCR and RTC_BKPxR.
Writing a wrong key reactivates the write protection.
The protection mechanism is not affected by system reset.
Parameters
NewStatenew state of the write protection. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 525 of file stm32f4xx_rtc.c.