LL CRS Macros

Common Write and read registers Macros

group CRS_LL_EM_WRITE_READ

Defines

LL_CRS_WRITE_REG ( instance , reg , value ) STM32_WRITE_REG((instance)->reg, (value))

Write a value in CRS register.

Parameters :
  • instance – CRS instance.

  • reg – Register to be written.

  • value – Value to be written in the register.

LL_CRS_READ_REG ( instance , reg ) STM32_READ_REG((instance)->reg)

Read a value in CRS register.

Parameters :
  • instance – CRS instance.

  • reg – Register to be read.

Return values :

Register – value

Exported_Macros_Calculate_Reload

group CRS_LL_EM_Exported_Macros_Calculate_Reload

Defines

LL_CRS_CALCULATE_RELOAD ( ftarget , fsync ) (((ftarget) / (fsync)) - 1U)

Macro to calculate reload value to be set in CRS register according to target and sync frequencies.

Note

The RELOAD value must be selected according to the ratio between the target frequency and the frequency of the synchronization source after prescaling. It is then decreased by one in order to reach the expected synchronization on the zero value. The formula is the following: RELOAD = (ftarget / fsync) -1

Parameters :
  • ftarget – Target frequency (value in Hz).

  • fsync – Synchronization signal frequency (value in Hz).

Return values :

Reload – value (in Hz)

LL_CRS_READ_FREQ_ERROR_DIRECTION ( value ) (STM32_READ_BIT((value), CRS_ISR_FEDIR))

Macro to read the frequency error direction value in CRS register.

Parameters :
Return values :

Frequency – error direction value

LL_CRS_READ_FREQ_ERROR_CAPTURE ( value ) (STM32_READ_BIT((value), CRS_ISR_FECAP) >> CRS_ISR_FECAP_Pos)

Macro to read the frequency error capture value in CRS register.

Parameters :
Return values :

Frequency – error capture value