LL CRS Functions

Configuration

group CRS_LL_EF_Configuration

Functions

void LL_CRS_EnableFreqErrorCounter ( CRS_TypeDef * crsx )

Enable frequency error counter.

Reference Manual to LL API cross reference (Register Field Functions)

CR CEN LL_CRS_EnableFreqErrorCounter

Note

When this bit is set, the CRS_CFGR register is write-protected and cannot be modified.

Parameters :

crsx – CRS instance.

void LL_CRS_DisableFreqErrorCounter ( CRS_TypeDef * crsx )

Disable frequency error counter.

Reference Manual to LL API cross reference (Register Field Functions)

CR CEN LL_CRS_DisableFreqErrorCounter

Parameters :

crsx – CRS instance.

uint32_t LL_CRS_IsEnabledFreqErrorCounter ( const CRS_TypeDef * crsx )

Check if frequency error counter is enabled or not.

Reference Manual to LL API cross reference (Register Field Functions)

CR CEN LL_CRS_IsEnabledFreqErrorCounter

Parameters :

crsx – CRS instance.

Return values :

State – of bit (1 or 0).

void LL_CRS_EnableAutoTrimming ( CRS_TypeDef * crsx )

Enable automatic trimming counter.

Reference Manual to LL API cross reference (Register Field Functions)

CR AUTOTRIMEN LL_CRS_EnableAutoTrimming

Parameters :

crsx – CRS instance.

void LL_CRS_DisableAutoTrimming ( CRS_TypeDef * crsx )

Disable automatic trimming counter.

Reference Manual to LL API cross reference (Register Field Functions)

CR AUTOTRIMEN LL_CRS_DisableAutoTrimming

Parameters :

crsx – CRS instance.

uint32_t LL_CRS_IsEnabledAutoTrimming ( const CRS_TypeDef * crsx )

Check if automatic trimming is enabled or not.

Reference Manual to LL API cross reference (Register Field Functions)

CR AUTOTRIMEN LL_CRS_IsEnabledAutoTrimming

Parameters :

crsx – CRS instance.

Return values :

State – of bit (1 or 0).

void LL_CRS_SetHSI48SmoothTrimming ( CRS_TypeDef * crsx , uint32_t value )

Set HSI48 oscillator smooth trimming.

Reference Manual to LL API cross reference (Register Field Functions)

CR TRIM LL_CRS_SetHSI48SmoothTrimming

Note

Default value can be set thanks to LL_CRS_HSI48CALIBRATION_DEFAULT .

Warning

When the AUTOTRIMEN bit is set, this field is controlled by hardware and is read-only.

Parameters :
  • crsx – CRS instance

  • value – a number between Min_Data = 0 and Max_Data = 0x7FU.

uint32_t LL_CRS_GetHSI48SmoothTrimming ( const CRS_TypeDef * crsx )

Get HSI48 oscillator smooth trimming.

Reference Manual to LL API cross reference (Register Field Functions)

CR TRIM LL_CRS_GetHSI48SmoothTrimming

Parameters :

crsx – CRS instance.

Return values :

a – number between Min_Data = 0 and Max_Data = 0x7FU.

void LL_CRS_SetReloadCounter ( CRS_TypeDef * crsx , uint32_t value )

Set counter reload value.

Reference Manual to LL API cross reference (Register Field Functions)

CFGR RELOAD LL_CRS_SetReloadCounter

Note

Default value can be set thanks to LL_CRS_RELOADVALUE_DEFAULT . Otherwise it can be calculated in using macro LL_CRS_CALCULATE_RELOAD (_FTARGET_, FSYNC ).

Parameters :
  • crsx – CRS instance.

  • value – a number between Min_Data = 0 and Max_Data = 0xFFFF.

uint32_t LL_CRS_GetReloadCounter ( const CRS_TypeDef * crsx )

Get counter reload value.

Reference Manual to LL API cross reference (Register Field Functions)

CFGR RELOAD LL_CRS_GetReloadCounter

Parameters :

crsx – CRS instance.

Return values :

a – number between Min_Data = 0 and Max_Data = 0xFFFF.

void LL_CRS_SetFreqErrorLimit ( CRS_TypeDef * crsx , uint32_t value )

Set frequency error limit.

Reference Manual to LL API cross reference (Register Field Functions)

CFGR FELIM LL_CRS_SetFreqErrorLimit

Note

Default value can be set thanks to LL_CRS_ERRORLIMIT_DEFAULT .

Parameters :
  • crsx – CRS instance.

  • value – a number between Min_Data = 0 and Max_Data = 255.

uint32_t LL_CRS_GetFreqErrorLimit ( const CRS_TypeDef * crsx )

Get frequency error limit.

Reference Manual to LL API cross reference (Register Field Functions)

CFGR FELIM LL_CRS_GetFreqErrorLimit

Parameters :

crsx – CRS instance.

Return values :

A – number between Min_Data = 0 and Max_Data = 255.

void LL_CRS_SetSyncDivider ( CRS_TypeDef * crsx , uint32_t divider )

Set division factor for SYNC signal.

Reference Manual to LL API cross reference (Register Field Functions)

CFGR SYNCDIV LL_CRS_SetSyncDivider

Parameters :
uint32_t LL_CRS_GetSyncDivider ( const CRS_TypeDef * crsx )

Get division factor for SYNC signal.

Reference Manual to LL API cross reference (Register Field Functions)

CFGR SYNCDIV LL_CRS_GetSyncDivider

Parameters :

crsx – CRS instance.

Return values :

Returned – value can be one of the following values:

void LL_CRS_SetSyncSignalSource ( CRS_TypeDef * crsx , uint32_t source )

Set SYNC signal source.

Reference Manual to LL API cross reference (Register Field Functions)

CFGR SYNCSRC LL_CRS_SetSyncSignalSource

Parameters :
uint32_t LL_CRS_GetSyncSignalSource ( const CRS_TypeDef * crsx )

Get SYNC signal source.

Reference Manual to LL API cross reference (Register Field Functions)

CFGR SYNCSRC LL_CRS_GetSyncSignalSource

Parameters :

crsx – CRS instance.

Return values :

Returned – value can be one of the following values:

void LL_CRS_SetSyncPolarity ( CRS_TypeDef * crsx , uint32_t polarity )

Set input polarity for the SYNC signal source.

Reference Manual to LL API cross reference (Register Field Functions)

CFGR SYNCPOL LL_CRS_SetSyncPolarity

Parameters :
uint32_t LL_CRS_GetSyncPolarity ( const CRS_TypeDef * crsx )

Get input polarity for the SYNC signal source.

Reference Manual to LL API cross reference (Register Field Functions)

CFGR SYNCPOL LL_CRS_GetSyncPolarity

Parameters :

crsx – CRS instance.

Return values :

Returned – value can be one of the following values:

void LL_CRS_ConfigTrimming ( CRS_TypeDef * crsx , uint32_t trimming , uint32_t auto_trimming )

Configure CRS for the trimming.

Reference Manual to LL API cross reference (Register Field Functions)

CR TRIM LL_CRS_ConfigTrimming

CR AUTOTRIMEN LL_CRS_ConfigTrimming

Warning

When the auto trimming is enabled, the trimming is controlled by hardware and is read-only.

Parameters :
  • crsx – CRS instance.

  • trimming – a number between Min_Data = 0 and Max_Data = 0x7FU.

  • auto_trimming – LL_CRS_AUTO_TRIMMING_DISABLE to disable the auto trimming. LL_CRS_AUTO_TRIMMING_ENABLE to enable the auto trimming.

void LL_CRS_ConfigSynchronization ( CRS_TypeDef * crsx , uint32_t settings , uint32_t reload , uint32_t frequency_error_limit )

Configure CRS for the synchronization.

Reference Manual to LL API cross reference (Register Field Functions)

CFGR RELOAD LL_CRS_ConfigSynchronization

CFGR FELIM LL_CRS_ConfigSynchronization

CFGR SYNCDIV LL_CRS_ConfigSynchronization

CFGR SYNCSRC LL_CRS_ConfigSynchronization

CFGR SYNCPOL LL_CRS_ConfigSynchronization

Parameters :

CRS_Management

group CRS_LL_EF_CRS_Management

Functions

void LL_CRS_GenerateEvent_SWSYNC ( CRS_TypeDef * crsx )

Generate software SYNC event.

Reference Manual to LL API cross reference (Register Field Functions)

CR SWSYNC LL_CRS_GenerateEvent_SWSYNC

Parameters :

crsx – CRS instance.

uint32_t LL_CRS_GetFreqErrorDirection ( const CRS_TypeDef * crsx )

Get the frequency error direction latched in the time of the last SYNC event.

Reference Manual to LL API cross reference (Register Field Functions)

ISR FEDIR LL_CRS_GetFreqErrorDirection

Parameters :

crsx – CRS instance.

Return values :

Returned – value can be one of the following values:

uint32_t LL_CRS_GetFreqErrorCapture ( const CRS_TypeDef * crsx )

Get the frequency error counter value latched in the time of the last SYNC event.

Reference Manual to LL API cross reference (Register Field Functions)

ISR FECAP LL_CRS_GetFreqErrorCapture

Parameters :

crsx – CRS instance.

Return values :

A – number between Min_Data = 0x0000 and Max_Data = 0xFFFF.

uint32_t LL_CRS_GetFreqErrorInfo ( const CRS_TypeDef * crsx )

Get the frequency error counter value and error direction latched in the time of the last SYNC event.

Reference Manual to LL API cross reference (Register Field Functions)

ISR FEDIR LL_CRS_GetFreqErrorInfo

ISR FECAP LL_CRS_GetFreqErrorInfo

Parameters :

crsx – CRS instance.

Return values :

A – number between Min_Data = 0x0000 and Max_Data = 0x1FFFF.

FLAG_Management

group CRS_LL_EF_FLAG_Management

Functions

uint32_t LL_CRS_IsActiveFlag ( const CRS_TypeDef * crsx , uint32_t mask )

Get flag(s) CRS.

Reference Manual to LL API cross reference (Register Field Functions)

ISR SYNCOKF LL_CRS_IsActiveFlag

ISR SYNCWARNF LL_CRS_IsActiveFlag

ISR ERRF LL_CRS_IsActiveFlag

ISR ESYNCF LL_CRS_IsActiveFlag

ISR SYNCERR LL_CRS_IsActiveFlag

ISR SYNCMISS LL_CRS_IsActiveFlag

ISR TRIMOVF LL_CRS_IsActiveFlag

Parameters :
  • crsx – CRS instance.

  • mask – This parameter can be a combination of the following values:

    • LL_CRS_ISR_SYNCOKF

    • LL_CRS_ISR_SYNCWARNF

    • LL_CRS_ISR_ERRF

    • LL_CRS_ISR_ESYNCF

    • LL_CRS_ISR_SYNCERR

    • LL_CRS_ISR_SYNCMISS

    • LL_CRS_ISR_TRIMOVF

Return values :

Return – 1 if at least one flag is set, else 0.

uint32_t LL_CRS_IsActiveFlag_SYNCOK ( const CRS_TypeDef * crsx )

Check if SYNC event OK signal occurred or not.

Reference Manual to LL API cross reference (Register Field Functions)

ISR SYNCOKF LL_CRS_IsActiveFlag_SYNCOK

Parameters :

crsx – CRS instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_CRS_IsActiveFlag_SYNCWARN ( const CRS_TypeDef * crsx )

Check if SYNC warning signal occurred or not.

Reference Manual to LL API cross reference (Register Field Functions)

ISR SYNCWARNF LL_CRS_IsActiveFlag_SYNCWARN

Parameters :

crsx – CRS instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_CRS_IsActiveFlag_ERR ( const CRS_TypeDef * crsx )

Check if synchronization or trimming error signal occurred or not.

Reference Manual to LL API cross reference (Register Field Functions)

ISR ERRF LL_CRS_IsActiveFlag_ERR

Parameters :

crsx – CRS instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_CRS_IsActiveFlag_ESYNC ( const CRS_TypeDef * crsx )

Check if expected SYNC signal occurred or not.

Reference Manual to LL API cross reference (Register Field Functions)

ISR ESYNCF LL_CRS_IsActiveFlag_ESYNC

Parameters :

crsx – CRS instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_CRS_IsActiveFlag_SYNCERR ( const CRS_TypeDef * crsx )

Check if SYNC error signal occurred or not.

Reference Manual to LL API cross reference (Register Field Functions)

ISR SYNCERR LL_CRS_IsActiveFlag_SYNCERR

Parameters :

crsx – CRS instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_CRS_IsActiveFlag_SYNCMISS ( const CRS_TypeDef * crsx )

Check if SYNC missed error signal occurred or not.

Reference Manual to LL API cross reference (Register Field Functions)

ISR SYNCMISS LL_CRS_IsActiveFlag_SYNCMISS

Parameters :

crsx – CRS instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_CRS_IsActiveFlag_TRIMOVF ( const CRS_TypeDef * crsx )

Check if trimming overflow or underflow occurred or not.

Reference Manual to LL API cross reference (Register Field Functions)

ISR TRIMOVF LL_CRS_IsActiveFlag_TRIMOVF

Parameters :

crsx – CRS instance.

Return values :

State – of bit (1 or 0).

void LL_CRS_ClearFlag ( CRS_TypeDef * crsx , uint32_t mask )

Clear CRS flag(s).

Reference Manual to LL API cross reference (Register Field Functions)

ICR ERRC LL_CRS_ClearFlag

ICR SYNCWARNC LL_CRS_ClearFlag

ICR SYNCOKC LL_CRS_ClearFlag

ICR ESYNCC LL_CRS_ClearFlag

Parameters :
  • crsx – CRS instance.

  • mask – specifies the CRS flags to be cleared. This parameter can be a combination of the following values:

    • LL_CRS_ICR_SYNCOKC

    • LL_CRS_ICR_SYNCWARNC

    • LL_CRS_ICR_ERRC

    • LL_CRS_ICR_ESYNCC

void LL_CRS_ClearFlag_SYNCOK ( CRS_TypeDef * crsx )

Clear the SYNC event OK flag.

Reference Manual to LL API cross reference (Register Field Functions)

ICR SYNCOKC LL_CRS_ClearFlag_SYNCOK

Parameters :

crsx – CRS instance.

void LL_CRS_ClearFlag_SYNCWARN ( CRS_TypeDef * crsx )

Clear the SYNC warning flag.

Reference Manual to LL API cross reference (Register Field Functions)

ICR SYNCWARNC LL_CRS_ClearFlag_SYNCWARN

Parameters :

crsx – CRS instance.

void LL_CRS_ClearFlag_ERR ( CRS_TypeDef * crsx )

Clear TRIMOVF, SYNCMISS and SYNCERR bits and consequently also the ERR flag.

Reference Manual to LL API cross reference (Register Field Functions)

ICR ERRC LL_CRS_ClearFlag_ERR

Parameters :

crsx – CRS instance.

void LL_CRS_ClearFlag_ESYNC ( CRS_TypeDef * crsx )

Clear expected SYNC flag.

Reference Manual to LL API cross reference (Register Field Functions)

ICR ESYNCC LL_CRS_ClearFlag_ESYNC

Parameters :

crsx – CRS instance.

IT_Management

group CRS_LL_EF_IT_Management

Functions

void LL_CRS_EnableIT ( CRS_TypeDef * crsx , uint32_t mask )

Enable interrupt(s).

Reference Manual to LL API cross reference (Register Field Functions)

CR SYNCOKIE LL_CRS_EnableIT

CR SYNCWARNIE LL_CRS_EnableIT

CR ERRIE LL_CRS_EnableIT

CR ESYNCIE LL_CRS_EnableIT

Parameters :
  • crsx – CRS instance.

  • mask – This parameter can be a combination of the following values:

    • LL_CRS_CR_SYNCOKIE

    • LL_CRS_CR_SYNCWARNIE

    • LL_CRS_CR_ERRIE

    • LL_CRS_CR_ESYNCIE

void LL_CRS_DisableIT ( CRS_TypeDef * crsx , uint32_t mask )

Disable interrupt(s).

Reference Manual to LL API cross reference (Register Field Functions)

CR SYNCOKIE LL_CRS_DisableIT

CR SYNCWARNIE LL_CRS_DisableIT

CR ERRIE LL_CRS_DisableIT

CR ESYNCIE LL_CRS_DisableIT

Parameters :
  • crsx – CRS instance.

  • mask – This parameter can be a combination of the following values:

    • LL_CRS_CR_SYNCOKIE

    • LL_CRS_CR_SYNCWARNIE

    • LL_CRS_CR_ERRIE

    • LL_CRS_CR_ESYNCIE

uint32_t LL_CRS_IsEnabledIT ( const CRS_TypeDef * crsx , uint32_t mask )

Indicate whether the interrupt(s) is(are) enabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR SYNCOKIE LL_CRS_IsEnabledIT

CR SYNCWARNIE LL_CRS_IsEnabledIT

CR ERRIE LL_CRS_IsEnabledIT

CR ESYNCIE LL_CRS_IsEnabledIT

Parameters :
  • crsx – CRS instance.

  • mask – This parameter can be a combination of the following values:

    • LL_CRS_CR_SYNCOKIE

    • LL_CRS_CR_SYNCWARNIE

    • LL_CRS_CR_ERRIE

    • LL_CRS_CR_ESYNCIE

Return values :

State – of bit (1 or 0).

void LL_CRS_EnableIT_SYNCOK ( CRS_TypeDef * crsx )

Enable SYNC event OK interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR SYNCOKIE LL_CRS_EnableIT_SYNCOK

Parameters :

crsx – CRS instance.

void LL_CRS_DisableIT_SYNCOK ( CRS_TypeDef * crsx )

Disable SYNC event OK interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR SYNCOKIE LL_CRS_DisableIT_SYNCOK

Parameters :

crsx – CRS instance.

uint32_t LL_CRS_IsEnabledIT_SYNCOK ( const CRS_TypeDef * crsx )

Check if SYNC event OK interrupt is enabled or not.

Reference Manual to LL API cross reference (Register Field Functions)

CR SYNCOKIE LL_CRS_IsEnabledIT_SYNCOK

Parameters :

crsx – CRS instance.

Return values :

State – of bit (1 or 0).

void LL_CRS_EnableIT_SYNCWARN ( CRS_TypeDef * crsx )

Enable SYNC warning interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR SYNCWARNIE LL_CRS_EnableIT_SYNCWARN

Parameters :

crsx – CRS instance.

void LL_CRS_DisableIT_SYNCWARN ( CRS_TypeDef * crsx )

Disable SYNC warning interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR SYNCWARNIE LL_CRS_DisableIT_SYNCWARN

Parameters :

crsx – CRS instance.

uint32_t LL_CRS_IsEnabledIT_SYNCWARN ( const CRS_TypeDef * crsx )

Check if SYNC warning interrupt is enabled or not.

Reference Manual to LL API cross reference (Register Field Functions)

CR SYNCWARNIE LL_CRS_IsEnabledIT_SYNCWARN

Parameters :

crsx – CRS instance.

Return values :

State – of bit (1 or 0).

void LL_CRS_EnableIT_ERR ( CRS_TypeDef * crsx )

Enable synchronization or trimming error interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR ERRIE LL_CRS_EnableIT_ERR

Parameters :

crsx – CRS instance.

void LL_CRS_DisableIT_ERR ( CRS_TypeDef * crsx )

Disable synchronization or trimming error interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR ERRIE LL_CRS_DisableIT_ERR

Parameters :

crsx – CRS instance.

uint32_t LL_CRS_IsEnabledIT_ERR ( const CRS_TypeDef * crsx )

Check if synchronization or trimming error interrupt is enabled or not.

Reference Manual to LL API cross reference (Register Field Functions)

CR ERRIE LL_CRS_IsEnabledIT_ERR

Parameters :

crsx – CRS instance.

Return values :

State – of bit (1 or 0).

void LL_CRS_EnableIT_ESYNC ( CRS_TypeDef * crsx )

Enable expected SYNC interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR ESYNCIE LL_CRS_EnableIT_ESYNC

Parameters :

crsx – CRS instance.

void LL_CRS_DisableIT_ESYNC ( CRS_TypeDef * crsx )

Disable expected SYNC interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR ESYNCIE LL_CRS_DisableIT_ESYNC

Parameters :

crsx – CRS instance.

uint32_t LL_CRS_IsEnabledIT_ESYNC ( const CRS_TypeDef * crsx )

Check if expected SYNC interrupt is enabled or not.

Reference Manual to LL API cross reference (Register Field Functions)

CR ESYNCIE LL_CRS_IsEnabledIT_ESYNC

Parameters :

crsx – CRS instance.

Return values :

State – of bit (1 or 0).