HAL CRS Types

Enumerations

group CRS_Exported_Types_Group1

Enums

enum hal_crs_auto_trimming_status_t

HAL CRS auto trimming status definitions.

Values:

enumerator HAL_CRS_AUTO_TRIMMING_DISABLED

Auto trimming is disabled

enumerator HAL_CRS_AUTO_TRIMMING_ENABLED

Auto trimming is enabled

enum hal_crs_auto_trimming_state_t

HAL CRS auto trimming state definitions.

Values:

enumerator HAL_CRS_AUTO_TRIMMING_DISABLE

Auto trimming disabled (default) Auto trimming disabled (default)

enumerator HAL_CRS_AUTO_TRIMMING_ENABLE

0x00000040 Automatic trimming enable Auto trimming enabled Auto trimming enabled

enum hal_crs_sync_source_t

HAL CRS synchronization source definitions.

Values:

enumerator HAL_CRS_SYNC_SOURCE_GPIO

Synchronization signal source GPIO Synchronization signal source GPIO

enumerator HAL_CRS_SYNC_SOURCE_LSE

0x10000000 Synchronization signal source LSE Synchronization signal source LSE

enumerator HAL_CRS_SYNC_SOURCE_USB

0x20000000 Synchronization signal source USB SOF (default) Synchronization signal source USB SOF (default)

enumerator HAL_CRS_SYNC_SOURCE_HSE_1MHZ

Synchronization signal source HSE 1MHz Synchronization signal source HSE 1MHz

enum hal_crs_sync_div_t

HAL CRS synchronization divider definitions.

Values:

enumerator HAL_CRS_SYNC_DIV1

Synchronization signal not divided (default) Synchronization signal not divided (default)

enumerator HAL_CRS_SYNC_DIV2

0x01000000 Synchronization signal divided by 2 Synchronization signal divided by 2

enumerator HAL_CRS_SYNC_DIV4

0x02000000 Synchronization signal divided by 4 Synchronization signal divided by 4

enumerator HAL_CRS_SYNC_DIV8

Synchronization signal divided by 8 Synchronization signal divided by 8

enumerator HAL_CRS_SYNC_DIV16

0x04000000 Synchronization signal divided by 16 Synchronization signal divided by 16

enumerator HAL_CRS_SYNC_DIV32

Synchronization signal divided by 32 Synchronization signal divided by 32

enumerator HAL_CRS_SYNC_DIV64

Synchronization signal divided by 64 Synchronization signal divided by 64

enumerator HAL_CRS_SYNC_DIV128

0x07000000 SYNC divider Synchronization signal divided by 128 Synchronization signal divided by 128

enum hal_crs_sync_polarity_t

HAL CRS synchronization polarity definitions.

Values:

enumerator HAL_CRS_SYNC_POLARITY_RISING

Synchronization active on rising edge (default) Synchronization active on rising edge (default)

enumerator HAL_CRS_SYNC_POLARITY_FALLING

0x80000000 SYNC polarity selection Synchronization active on falling edge Synchronization active on falling edge

enum hal_crs_frequency_error_dir_t

HAL CRS frequency error direction definitions.

Values:

enumerator HAL_CRS_FREQUENCY_ERROR_DIR_UP

Upcounting direction, the actual frequency is above the target Upcounting direction, the actual frequency is above the target

enumerator HAL_CRS_FREQUENCY_ERROR_DIR_DOWN

0x00008000 Frequency error direction Downcounting direction, the actual frequency is below the target Downcounting direction, the actual frequency is below the target

enum hal_crs_state_t

HAL CRS state definition.

Values:

enumerator HAL_CRS_STATE_RESET

CRS driver not initialized and not started

enumerator HAL_CRS_STATE_IDLE

CRS driver initialized and not started

enumerator HAL_CRS_STATE_ACTIVE

CRS driver initialized and started

enum hal_crs_t

HAL CRS instances definition.

Values:

enumerator HAL_CRS1

Instance CRS

Handle Structure

group CRS_Exported_Types_Group2

Typedefs

typedef struct hal_crs_handle_s hal_crs_handle_t

CRS handle type definition

typedef void ( * hal_crs_cb_t ) ( hal_crs_handle_t * hcrs )

Pointer to a CRS callback function

struct hal_crs_handle_s
#include <stm32c5xx_hal_crs.h>

CRS handle structure definition.

Public Members

hal_crs_t instance

Peripheral instance

volatile hal_crs_state_t global_state

CRS global state

volatile uint32_t last_error_codes

Variable storing the cumulative last errors

hal_crs_cb_t p_error_cb

Error user callback (disabled if the switch USE_HAL_CRS_REGISTER_CALLBACKS is set to 0U)

hal_crs_cb_t p_sync_ok_cb

Synchronization OK user callback (disabled if the switch USE_HAL_CRS_REGISTER_CALLBACKS is set to 0U)

hal_crs_cb_t p_sync_warn_cb

Synchronization warning user callback (disabled if the switch USE_HAL_CRS_REGISTER_CALLBACKS is set to 0U)

hal_crs_cb_t p_expected_sync_cb

Expected synchronization user callback (disabled if the switch USE_HAL_CRS_REGISTER_CALLBACKS is set to 0U)

const void * p_user_data

CRS user data

Configuration Structure

group CRS_Exported_Types_Group3
struct hal_crs_config_t
#include <stm32c5xx_hal_crs.h>

HAL CRS configuration structure definition.

Public Members

hal_crs_sync_div_t divider

Specifies the division factor of the SYNC signal.

hal_crs_sync_source_t source

Specifies the SYNC signal source.

hal_crs_sync_polarity_t polarity

Specifies the input polarity for the SYNC signal source.

uint32_t reload

Specifies the value to be loaded in the frequency error counter with each SYNC event. It can be calculated using the macro HAL_CRS_CALCULATE_RELOAD(ftarget, fsync). This parameter must be a number between 0 and 0xFFFF or HAL_CRS_RELOAD_DEFAULT_VALUE.

uint32_t frequency_error_limit

Specifies the value to be used to evaluate the captured frequency error value. This parameter must be a number between 0 and 0xFF or HAL_CRS_ERRORLIMIT_DEFAULT_VALUE.

uint32_t trimming

Specifies a user-programmable trimming value to the HSI144 oscillator. This parameter must be a number between 0 and 0x5FU or HAL_CRS_TRIMMING_DEFAULT_VALUE.

hal_crs_auto_trimming_state_t auto_trimming

Specifies the auto trimming enable or disable.

Synchronization Structure

group CRS_Exported_Types_Group4
struct hal_crs_frequency_error_info_t
#include <stm32c5xx_hal_crs.h>

HAL CRS synchronization structure definition.

Public Members

uint32_t frequency_error_capture

Specifies the frequency error counter value latched at the time of the last SYNC event. This parameter must be a number between 0 and 0xFFFF.

hal_crs_frequency_error_dir_t frequency_error_dir

Specifies the counting direction of the frequency error counter latched at the time of the last SYNC event. It shows whether the actual frequency is below or above the target.