STM32H735xx HAL User Manual
Functions
Extended Clock Recovery System Control functions
RCCEx Exported Functions

Extended Clock Recovery System Control functions. More...

Functions

void HAL_RCCEx_CRSConfig (RCC_CRSInitTypeDef *pInit)
 Start automatic synchronization for polling mode.
void HAL_RCCEx_CRSSoftwareSynchronizationGenerate (void)
 Generate the software synchronization event.
void HAL_RCCEx_CRSGetSynchronizationInfo (RCC_CRSSynchroInfoTypeDef *pSynchroInfo)
 Return synchronization info.
uint32_t HAL_RCCEx_CRSWaitSynchronization (uint32_t Timeout)
 Wait for CRS Synchronization status.
void HAL_RCCEx_CRS_IRQHandler (void)
 Handle the Clock Recovery System interrupt request.
__weak void HAL_RCCEx_CRS_SyncOkCallback (void)
 RCCEx Clock Recovery System SYNCOK interrupt callback.
__weak void HAL_RCCEx_CRS_SyncWarnCallback (void)
 RCCEx Clock Recovery System SYNCWARN interrupt callback.
__weak void HAL_RCCEx_CRS_ExpectedSyncCallback (void)
 RCCEx Clock Recovery System Expected SYNC interrupt callback.
__weak void HAL_RCCEx_CRS_ErrorCallback (uint32_t Error)
 RCCEx Clock Recovery System Error interrupt callback.

Detailed Description

Extended Clock Recovery System Control functions.

 ===============================================================================
                ##### Extended Clock Recovery System Control functions  #####
 ===============================================================================
    [..]
      For devices with Clock Recovery System feature (CRS), RCC Extension HAL driver can be used as follows:

      (#) In System clock config, HSI48 needs to be enabled

      (#) Enable CRS clock in IP MSP init which will use CRS functions

      (#) Call CRS functions as follows:
          (##) Prepare synchronization configuration necessary for HSI48 calibration
              (+++) Default values can be set for frequency Error Measurement (reload and error limit)
                        and also HSI48 oscillator smooth trimming.
              (+++) Macro __HAL_RCC_CRS_RELOADVALUE_CALCULATE can be also used to calculate
                        directly reload value with target and synchronization frequencies values
          (##) Call function HAL_RCCEx_CRSConfig which
              (+++) Resets CRS registers to their default values.
              (+++) Configures CRS registers with synchronization configuration
              (+++) Enables automatic calibration and frequency error counter feature
           Note: When using USB LPM (Link Power Management) and the device is in Sleep mode, the
           periodic USB SOF will not be generated by the host. No SYNC signal will therefore be
           provided to the CRS to calibrate the HSI48 on the run. To guarantee the required clock
           precision after waking up from Sleep mode, the LSE or reference clock on the GPIOs
           should be used as SYNC signal.

          (##) A polling function is provided to wait for complete synchronization
              (+++) Call function HAL_RCCEx_CRSWaitSynchronization()
              (+++) According to CRS status, user can decide to adjust again the calibration or continue
                        application if synchronization is OK

      (#) User can retrieve information related to synchronization in calling function
            HAL_RCCEx_CRSGetSynchronizationInfo()

      (#) Regarding synchronization status and synchronization information, user can try a new calibration
           in changing synchronization configuration and call again HAL_RCCEx_CRSConfig.
           Note: When the SYNC event is detected during the down-counting phase (before reaching the zero value),
           it means that the actual frequency is lower than the target (and so, that the TRIM value should be
           incremented), while when it is detected during the up-counting phase it means that the actual frequency
           is higher (and that the TRIM value should be decremented).

      (#) In interrupt mode, user can resort to the available macros (__HAL_RCC_CRS_XXX_IT). Interrupts will go
          through CRS Handler (CRS_IRQn/CRS_IRQHandler)
              (++) Call function HAL_RCCEx_CRSConfig()
              (++) Enable CRS_IRQn (thanks to NVIC functions)
              (++) Enable CRS interrupt (__HAL_RCC_CRS_ENABLE_IT)
              (++) Implement CRS status management in the following user callbacks called from
                   HAL_RCCEx_CRS_IRQHandler():
                   (+++) HAL_RCCEx_CRS_SyncOkCallback()
                   (+++) HAL_RCCEx_CRS_SyncWarnCallback()
                   (+++) HAL_RCCEx_CRS_ExpectedSyncCallback()
                   (+++) HAL_RCCEx_CRS_ErrorCallback()

      (#) To force a SYNC EVENT, user can use the function HAL_RCCEx_CRSSoftwareSynchronizationGenerate().
          This function can be called before calling HAL_RCCEx_CRSConfig (for instance in Systick handler)


Function Documentation

void HAL_RCCEx_CRS_ErrorCallback ( uint32_t  Error)

RCCEx Clock Recovery System Error interrupt callback.

Parameters:
ErrorCombination of Error status. This parameter can be a combination of the following values:
Return values:
none

Definition at line 3484 of file stm32h7xx_hal_rcc_ex.c.

Referenced by HAL_RCCEx_CRS_IRQHandler().

RCCEx Clock Recovery System Expected SYNC interrupt callback.

Return values:
none

Definition at line 3468 of file stm32h7xx_hal_rcc_ex.c.

Referenced by HAL_RCCEx_CRS_IRQHandler().

void HAL_RCCEx_CRS_IRQHandler ( void  )

RCCEx Clock Recovery System SYNCOK interrupt callback.

Return values:
none

Definition at line 3446 of file stm32h7xx_hal_rcc_ex.c.

Referenced by HAL_RCCEx_CRS_IRQHandler().

RCCEx Clock Recovery System SYNCWARN interrupt callback.

Return values:
none

Definition at line 3457 of file stm32h7xx_hal_rcc_ex.c.

Referenced by HAL_RCCEx_CRS_IRQHandler().

Generate the software synchronization event.

Return values:
None

Definition at line 3255 of file stm32h7xx_hal_rcc_ex.c.

uint32_t HAL_RCCEx_CRSWaitSynchronization ( uint32_t  Timeout)

Wait for CRS Synchronization status.

Parameters:
TimeoutDuration of the time-out
Note:
Timeout is based on the maximum time to receive a SYNC event based on synchronization frequency.
If Time-out set to HAL_MAX_DELAY, HAL_TIMEOUT will be never returned.
Return values:
Combinationof Synchronization status This parameter can be a combination of the following values:

Definition at line 3298 of file stm32h7xx_hal_rcc_ex.c.

References __HAL_RCC_CRS_CLEAR_FLAG, __HAL_RCC_CRS_GET_FLAG, HAL_GetTick(), RCC_CRS_FLAG_ESYNC, RCC_CRS_FLAG_SYNCERR, RCC_CRS_FLAG_SYNCMISS, RCC_CRS_FLAG_SYNCOK, RCC_CRS_FLAG_SYNCWARN, RCC_CRS_FLAG_TRIMOVF, RCC_CRS_NONE, RCC_CRS_SYNCERR, RCC_CRS_SYNCMISS, RCC_CRS_SYNCOK, RCC_CRS_SYNCWARN, RCC_CRS_TIMEOUT, and RCC_CRS_TRIMOVF.