STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Loading...
Searching...
No Matches

Reset and clock control. More...

Collaboration diagram for RCC:

Data Structures

struct  RccRegisters_t
 RCC register block. More...

Macros

#define RCC_BASE   (0x40023800UL)
 RCC base address (AHB1).
#define RCC   ((RccRegisters_t *)RCC_BASE)
 The RCC instance.

Typedefs

typedef struct RccRegisters_t RccRegisters_t
 RCC register block.

CR - clock control (0x00)

#define RCC_CR_HSION_Pos   (0U)
 Bit 0.
#define RCC_CR_HSION   ((uint32_t)1U << RCC_CR_HSION_Pos)
  rw HSI on.
#define RCC_CR_HSIRDY_Pos   (1U)
 Bit 1.
#define RCC_CR_HSIRDY   ((uint32_t)1U << RCC_CR_HSIRDY_Pos)
  ro HSI ready.
#define RCC_CR_HSEON_Pos   (16U)
 Bit 16.
#define RCC_CR_HSEON   ((uint32_t)1U << RCC_CR_HSEON_Pos)
  rw HSE on.
#define RCC_CR_HSERDY_Pos   (17U)
 Bit 17.
#define RCC_CR_HSERDY   ((uint32_t)1U << RCC_CR_HSERDY_Pos)
  ro HSE ready.
#define RCC_CR_HSEBYP_Pos   (18U)
 Bit 18.
#define RCC_CR_HSEBYP   ((uint32_t)1U << RCC_CR_HSEBYP_Pos)
  rw HSE bypass: external clock on OSC_IN.
#define RCC_CR_CSSON_Pos   (19U)
 Bit 19.
#define RCC_CR_CSSON   ((uint32_t)1U << RCC_CR_CSSON_Pos)
  rw Clock security system on.
#define RCC_CR_PLLON_Pos   (24U)
 Bit 24.
#define RCC_CR_PLLON   ((uint32_t)1U << RCC_CR_PLLON_Pos)
  rw Main PLL on.
#define RCC_CR_PLLRDY_Pos   (25U)
 Bit 25.
#define RCC_CR_PLLRDY   ((uint32_t)1U << RCC_CR_PLLRDY_Pos)
  ro Main PLL locked.

PLLCFGR - PLL configuration (0x04)

Every field is rw and writable only while the PLL is off.

#define RCC_PLLCFGR_PLLM_Pos   (0U)
 Bits 5:0.
#define RCC_PLLCFGR_PLLM_Msk   ((uint32_t)0x3FU << RCC_PLLCFGR_PLLM_Pos)
 Input divider M (2-63): VCO input = source / M, 1-2 MHz.
#define RCC_PLLCFGR_PLLN_Pos   (6U)
 Bits 14:6.
#define RCC_PLLCFGR_PLLN_Msk   ((uint32_t)0x1FFU << RCC_PLLCFGR_PLLN_Pos)
 Multiplier N (50-432): VCO output = VCO input x N, 100-432 MHz.
#define RCC_PLLCFGR_PLLP_Pos   (16U)
 Bits 17:16.
#define RCC_PLLCFGR_PLLP_Msk   ((uint32_t)0x3U << RCC_PLLCFGR_PLLP_Pos)
 Output divider P for SYSCLK; values below.
#define RCC_PLLCFGR_PLLSRC_Pos   (22U)
 Bit 22.
#define RCC_PLLCFGR_PLLSRC   ((uint32_t)1U << RCC_PLLCFGR_PLLSRC_Pos)
 PLL input: 0 = HSI, 1 = HSE.

PLLCFGR.PLLSRC values

Already shifted into position.

#define RCC_PLLCFGR_PLLSRC_HSI   (0x0U)
 HSI feeds the PLL.
#define RCC_PLLCFGR_PLLSRC_HSE   (RCC_PLLCFGR_PLLSRC)
 HSE feeds the PLL.

PLLCFGR.PLLP values

#define RCC_PLLCFGR_PLLP_DIV2   (0x0U)
 VCO / 2.
#define RCC_PLLCFGR_PLLP_DIV4   (0x1U)
 VCO / 4.
#define RCC_PLLCFGR_PLLP_DIV6   (0x2U)
 VCO / 6.
#define RCC_PLLCFGR_PLLP_DIV8   (0x3U)
 VCO / 8.

CFGR - clock configuration (0x08)

#define RCC_CFGR_SW_Pos   (0U)
 Bits 1:0.
#define RCC_CFGR_SW_Msk   ((uint32_t)0x3U << RCC_CFGR_SW_Pos)
  rw SYSCLK source requested; values below.
#define RCC_CFGR_SWS_Pos   (2U)
 Bits 3:2.
#define RCC_CFGR_SWS_Msk   ((uint32_t)0x3U << RCC_CFGR_SWS_Pos)
  ro SYSCLK source in use, reported once a switch completes.
#define RCC_CFGR_HPRE_Pos   (4U)
 Bits 7:4.
#define RCC_CFGR_HPRE_Msk   ((uint32_t)0xFU << RCC_CFGR_HPRE_Pos)
  rw AHB prescaler; values below.
#define RCC_CFGR_PPRE1_Pos   (10U)
 Bits 12:10.
#define RCC_CFGR_PPRE1_Msk   ((uint32_t)0x7U << RCC_CFGR_PPRE1_Pos)
  rw APB1 prescaler; APB1 must stay at or below 45 MHz.
#define RCC_CFGR_PPRE2_Pos   (13U)
 Bits 15:13.
#define RCC_CFGR_PPRE2_Msk   ((uint32_t)0x7U << RCC_CFGR_PPRE2_Pos)
  rw APB2 prescaler; APB2 must stay at or below 90 MHz.

CFGR.SW / CFGR.SWS values

One encoding for both fields; shift by the field's _Pos.

#define RCC_CFGR_SYSCLK_HSI   (0x0U)
 HSI.
#define RCC_CFGR_SYSCLK_HSE   (0x1U)
 HSE.
#define RCC_CFGR_SYSCLK_PLL   (0x2U)
 Main PLL (P output).

CFGR.HPRE values

There is no /32.

#define RCC_CFGR_HPRE_DIV1   (0x0U)
 SYSCLK / 1.
#define RCC_CFGR_HPRE_DIV2   (0x8U)
 SYSCLK / 2.
#define RCC_CFGR_HPRE_DIV4   (0x9U)
 SYSCLK / 4.
#define RCC_CFGR_HPRE_DIV8   (0xAU)
 SYSCLK / 8.
#define RCC_CFGR_HPRE_DIV16   (0xBU)
 SYSCLK / 16.
#define RCC_CFGR_HPRE_DIV64   (0xCU)
 SYSCLK / 64.
#define RCC_CFGR_HPRE_DIV128   (0xDU)
 SYSCLK / 128.
#define RCC_CFGR_HPRE_DIV256   (0xEU)
 SYSCLK / 256.
#define RCC_CFGR_HPRE_DIV512   (0xFU)
 SYSCLK / 512.

CFGR.PPRE1 / CFGR.PPRE2 values

One encoding for both fields; shift by the field's _Pos.

#define RCC_CFGR_PPRE_DIV1   (0x0U)
 HCLK / 1.
#define RCC_CFGR_PPRE_DIV2   (0x4U)
 HCLK / 2.
#define RCC_CFGR_PPRE_DIV4   (0x5U)
 HCLK / 4.
#define RCC_CFGR_PPRE_DIV8   (0x6U)
 HCLK / 8.
#define RCC_CFGR_PPRE_DIV16   (0x7U)
 HCLK / 16.

CIR - clock interrupt (0x0C)

#define RCC_CIR_CSSF_Pos   (7U)
 Bit 7.
#define RCC_CIR_CSSF   ((uint32_t)1U << RCC_CIR_CSSF_Pos)
  ro Clock security system detected an HSE failure.
#define RCC_CIR_CSSC_Pos   (23U)
 Bit 23.
#define RCC_CIR_CSSC   ((uint32_t)1U << RCC_CIR_CSSC_Pos)
  wo Write 1 to clear CSSF.

AHB1RSTR - AHB1 peripheral reset (0x10)

Every bit is rw: set to hold the peripheral in reset.

#define RCC_AHB1RSTR_GPIOARST_Pos   (0U)
 Bit 0.
#define RCC_AHB1RSTR_GPIOARST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOARST_Pos)
 GPIOA reset.
#define RCC_AHB1RSTR_GPIOBRST_Pos   (1U)
 Bit 1.
#define RCC_AHB1RSTR_GPIOBRST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOBRST_Pos)
 GPIOB reset.
#define RCC_AHB1RSTR_GPIOCRST_Pos   (2U)
 Bit 2.
#define RCC_AHB1RSTR_GPIOCRST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOCRST_Pos)
 GPIOC reset.
#define RCC_AHB1RSTR_GPIODRST_Pos   (3U)
 Bit 3.
#define RCC_AHB1RSTR_GPIODRST   ((uint32_t)1U << RCC_AHB1RSTR_GPIODRST_Pos)
 GPIOD reset.
#define RCC_AHB1RSTR_GPIOERST_Pos   (4U)
 Bit 4.
#define RCC_AHB1RSTR_GPIOERST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOERST_Pos)
 GPIOE reset.
#define RCC_AHB1RSTR_GPIOFRST_Pos   (5U)
 Bit 5.
#define RCC_AHB1RSTR_GPIOFRST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOFRST_Pos)
 GPIOF reset.
#define RCC_AHB1RSTR_GPIOGRST_Pos   (6U)
 Bit 6.
#define RCC_AHB1RSTR_GPIOGRST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOGRST_Pos)
 GPIOG reset.
#define RCC_AHB1RSTR_GPIOHRST_Pos   (7U)
 Bit 7.
#define RCC_AHB1RSTR_GPIOHRST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOHRST_Pos)
 GPIOH reset.

AHB1ENR - AHB1 clock enable (0x30)

Every bit is rw.

Read the register back after enabling, before touching the peripheral.

#define RCC_AHB1ENR_GPIOAEN_Pos   (0U)
 Bit 0.
#define RCC_AHB1ENR_GPIOAEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOAEN_Pos)
 GPIOA clock.
#define RCC_AHB1ENR_GPIOBEN_Pos   (1U)
 Bit 1.
#define RCC_AHB1ENR_GPIOBEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOBEN_Pos)
 GPIOB clock.
#define RCC_AHB1ENR_GPIOCEN_Pos   (2U)
 Bit 2.
#define RCC_AHB1ENR_GPIOCEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOCEN_Pos)
 GPIOC clock.
#define RCC_AHB1ENR_GPIODEN_Pos   (3U)
 Bit 3.
#define RCC_AHB1ENR_GPIODEN   ((uint32_t)1U << RCC_AHB1ENR_GPIODEN_Pos)
 GPIOD clock.
#define RCC_AHB1ENR_GPIOEEN_Pos   (4U)
 Bit 4.
#define RCC_AHB1ENR_GPIOEEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOEEN_Pos)
 GPIOE clock.
#define RCC_AHB1ENR_GPIOFEN_Pos   (5U)
 Bit 5.
#define RCC_AHB1ENR_GPIOFEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOFEN_Pos)
 GPIOF clock.
#define RCC_AHB1ENR_GPIOGEN_Pos   (6U)
 Bit 6.
#define RCC_AHB1ENR_GPIOGEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOGEN_Pos)
 GPIOG clock.
#define RCC_AHB1ENR_GPIOHEN_Pos   (7U)
 Bit 7.
#define RCC_AHB1ENR_GPIOHEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOHEN_Pos)
 GPIOH clock.

APB1RSTR - APB1 peripheral reset (0x20)

Every bit is rw.

#define RCC_APB1RSTR_USART2RST_Pos   (17U)
 Bit 17.
#define RCC_APB1RSTR_USART2RST   ((uint32_t)1U << RCC_APB1RSTR_USART2RST_Pos)
 USART2 reset.
#define RCC_APB1RSTR_PWRRST_Pos   (28U)
 Bit 28.
#define RCC_APB1RSTR_PWRRST   ((uint32_t)1U << RCC_APB1RSTR_PWRRST_Pos)
 PWR reset.

APB1ENR - APB1 clock enable (0x40)

Every bit is rw.

#define RCC_APB1ENR_WWDGEN_Pos   (11U)
 Bit 11.
#define RCC_APB1ENR_WWDGEN   ((uint32_t)1U << RCC_APB1ENR_WWDGEN_Pos)
 WWDG clock; required before any WWDG register access.
#define RCC_APB1ENR_USART2EN_Pos   (17U)
 Bit 17.
#define RCC_APB1ENR_USART2EN   ((uint32_t)1U << RCC_APB1ENR_USART2EN_Pos)
 USART2 clock.
#define RCC_APB1ENR_PWREN_Pos   (28U)
 Bit 28.
#define RCC_APB1ENR_PWREN   ((uint32_t)1U << RCC_APB1ENR_PWREN_Pos)
 PWR clock; required before any PWR register access.

APB2RSTR - APB2 peripheral reset (0x24)

#define RCC_APB2RSTR_SYSCFGRST_Pos   (14U)
 Bit 14.
#define RCC_APB2RSTR_SYSCFGRST   ((uint32_t)1U << RCC_APB2RSTR_SYSCFGRST_Pos)
  rw SYSCFG reset.

APB2ENR - APB2 clock enable (0x44)

#define RCC_APB2ENR_SYSCFGEN_Pos   (14U)
 Bit 14.
#define RCC_APB2ENR_SYSCFGEN   ((uint32_t)1U << RCC_APB2ENR_SYSCFGEN_Pos)
  rw SYSCFG clock; required before any SYSCFG register access.

CSR - clock control and status (0x74)

The reset-cause flags stay set until RMVF clears them.

#define RCC_CSR_LSION_Pos   (0U)
 Bit 0.
#define RCC_CSR_LSION   ((uint32_t)1U << RCC_CSR_LSION_Pos)
  rw LSI on.
#define RCC_CSR_LSIRDY_Pos   (1U)
 Bit 1.
#define RCC_CSR_LSIRDY   ((uint32_t)1U << RCC_CSR_LSIRDY_Pos)
  ro LSI ready.
#define RCC_CSR_RMVF_Pos   (24U)
 Bit 24.
#define RCC_CSR_RMVF   ((uint32_t)1U << RCC_CSR_RMVF_Pos)
  rw Write 1 to clear every reset flag below.
#define RCC_CSR_BORRSTF_Pos   (25U)
 Bit 25.
#define RCC_CSR_BORRSTF   ((uint32_t)1U << RCC_CSR_BORRSTF_Pos)
  ro Brown-out reset occurred.
#define RCC_CSR_PINRSTF_Pos   (26U)
 Bit 26.
#define RCC_CSR_PINRSTF   ((uint32_t)1U << RCC_CSR_PINRSTF_Pos)
  ro NRST pin reset occurred.
#define RCC_CSR_PORRSTF_Pos   (27U)
 Bit 27.
#define RCC_CSR_PORRSTF   ((uint32_t)1U << RCC_CSR_PORRSTF_Pos)
  ro Power-on reset occurred.
#define RCC_CSR_SFTRSTF_Pos   (28U)
 Bit 28.
#define RCC_CSR_SFTRSTF   ((uint32_t)1U << RCC_CSR_SFTRSTF_Pos)
  ro Software reset occurred.
#define RCC_CSR_IWDGRSTF_Pos   (29U)
 Bit 29.
#define RCC_CSR_IWDGRSTF   ((uint32_t)1U << RCC_CSR_IWDGRSTF_Pos)
  ro Independent watchdog reset occurred.
#define RCC_CSR_WWDGRSTF_Pos   (30U)
 Bit 30.
#define RCC_CSR_WWDGRSTF   ((uint32_t)1U << RCC_CSR_WWDGRSTF_Pos)
  ro Window watchdog reset occurred.
#define RCC_CSR_LPWRRSTF_Pos   (31U)
 Bit 31.
#define RCC_CSR_LPWRRSTF   ((uint32_t)1U << RCC_CSR_LPWRRSTF_Pos)
  ro Low-power reset occurred.

Detailed Description

Reset and clock control.

Macro Definition Documentation

◆ RCC_BASE

#define RCC_BASE   (0x40023800UL)

RCC base address (AHB1).

Definition at line 20 of file rcc_reg.h.

◆ RCC

#define RCC   ((RccRegisters_t *)RCC_BASE)

The RCC instance.

Definition at line 61 of file rcc_reg.h.

◆ RCC_CR_HSION_Pos

#define RCC_CR_HSION_Pos   (0U)

Bit 0.

Definition at line 65 of file rcc_reg.h.

◆ RCC_CR_HSION

#define RCC_CR_HSION   ((uint32_t)1U << RCC_CR_HSION_Pos)

rw HSI on.

Definition at line 67 of file rcc_reg.h.

Referenced by rccHsiDisable(), and rccHsiEnable().

◆ RCC_CR_HSIRDY_Pos

#define RCC_CR_HSIRDY_Pos   (1U)

Bit 1.

Definition at line 68 of file rcc_reg.h.

◆ RCC_CR_HSIRDY

#define RCC_CR_HSIRDY   ((uint32_t)1U << RCC_CR_HSIRDY_Pos)

ro HSI ready.

Definition at line 70 of file rcc_reg.h.

Referenced by rccHsiDisable(), rccHsiEnable(), and rccSysclkSwitch().

◆ RCC_CR_HSEON_Pos

#define RCC_CR_HSEON_Pos   (16U)

Bit 16.

Definition at line 71 of file rcc_reg.h.

◆ RCC_CR_HSEON

#define RCC_CR_HSEON   ((uint32_t)1U << RCC_CR_HSEON_Pos)

rw HSE on.

Definition at line 73 of file rcc_reg.h.

Referenced by rccHseDisable(), and rccHseEnable().

◆ RCC_CR_HSERDY_Pos

#define RCC_CR_HSERDY_Pos   (17U)

Bit 17.

Definition at line 74 of file rcc_reg.h.

◆ RCC_CR_HSERDY

#define RCC_CR_HSERDY   ((uint32_t)1U << RCC_CR_HSERDY_Pos)

ro HSE ready.

Definition at line 76 of file rcc_reg.h.

Referenced by rccHseDisable(), rccHseEnable(), and rccSysclkSwitch().

◆ RCC_CR_HSEBYP_Pos

#define RCC_CR_HSEBYP_Pos   (18U)

Bit 18.

Definition at line 77 of file rcc_reg.h.

◆ RCC_CR_HSEBYP

#define RCC_CR_HSEBYP   ((uint32_t)1U << RCC_CR_HSEBYP_Pos)

rw HSE bypass: external clock on OSC_IN.

Writable only with HSEON clear.

Definition at line 79 of file rcc_reg.h.

Referenced by bspClockInit(), and rccHseEnable().

◆ RCC_CR_CSSON_Pos

#define RCC_CR_CSSON_Pos   (19U)

Bit 19.

Definition at line 80 of file rcc_reg.h.

◆ RCC_CR_CSSON

#define RCC_CR_CSSON   ((uint32_t)1U << RCC_CR_CSSON_Pos)

rw Clock security system on.

Definition at line 82 of file rcc_reg.h.

◆ RCC_CR_PLLON_Pos

#define RCC_CR_PLLON_Pos   (24U)

Bit 24.

Definition at line 83 of file rcc_reg.h.

◆ RCC_CR_PLLON

#define RCC_CR_PLLON   ((uint32_t)1U << RCC_CR_PLLON_Pos)

rw Main PLL on.

Configure PLLCFGR first.

Definition at line 85 of file rcc_reg.h.

Referenced by rccPllConfig(), rccPllDisable(), and rccPllEnable().

◆ RCC_CR_PLLRDY_Pos

#define RCC_CR_PLLRDY_Pos   (25U)

Bit 25.

Definition at line 86 of file rcc_reg.h.

◆ RCC_CR_PLLRDY

#define RCC_CR_PLLRDY   ((uint32_t)1U << RCC_CR_PLLRDY_Pos)

ro Main PLL locked.

Definition at line 88 of file rcc_reg.h.

Referenced by rccPllDisable(), rccPllEnable(), and rccSysclkSwitch().

◆ RCC_PLLCFGR_PLLM_Pos

#define RCC_PLLCFGR_PLLM_Pos   (0U)

Bits 5:0.

Definition at line 94 of file rcc_reg.h.

Referenced by rccPllConfig().

◆ RCC_PLLCFGR_PLLM_Msk

#define RCC_PLLCFGR_PLLM_Msk   ((uint32_t)0x3FU << RCC_PLLCFGR_PLLM_Pos)

Input divider M (2-63): VCO input = source / M, 1-2 MHz.

Definition at line 96 of file rcc_reg.h.

Referenced by rccPllConfig().

◆ RCC_PLLCFGR_PLLN_Pos

#define RCC_PLLCFGR_PLLN_Pos   (6U)

Bits 14:6.

Definition at line 97 of file rcc_reg.h.

Referenced by rccPllConfig().

◆ RCC_PLLCFGR_PLLN_Msk

#define RCC_PLLCFGR_PLLN_Msk   ((uint32_t)0x1FFU << RCC_PLLCFGR_PLLN_Pos)

Multiplier N (50-432): VCO output = VCO input x N, 100-432 MHz.

Definition at line 99 of file rcc_reg.h.

Referenced by rccPllConfig().

◆ RCC_PLLCFGR_PLLP_Pos

#define RCC_PLLCFGR_PLLP_Pos   (16U)

Bits 17:16.

Definition at line 100 of file rcc_reg.h.

Referenced by rccPllConfig().

◆ RCC_PLLCFGR_PLLP_Msk

#define RCC_PLLCFGR_PLLP_Msk   ((uint32_t)0x3U << RCC_PLLCFGR_PLLP_Pos)

Output divider P for SYSCLK; values below.

Definition at line 102 of file rcc_reg.h.

Referenced by rccPllConfig().

◆ RCC_PLLCFGR_PLLSRC_Pos

#define RCC_PLLCFGR_PLLSRC_Pos   (22U)

Bit 22.

Definition at line 103 of file rcc_reg.h.

◆ RCC_PLLCFGR_PLLSRC

#define RCC_PLLCFGR_PLLSRC   ((uint32_t)1U << RCC_PLLCFGR_PLLSRC_Pos)

PLL input: 0 = HSI, 1 = HSE.

Definition at line 105 of file rcc_reg.h.

Referenced by rccOscillatorDisableGuard(), and rccPllConfig().

◆ RCC_PLLCFGR_PLLSRC_HSI

#define RCC_PLLCFGR_PLLSRC_HSI   (0x0U)

HSI feeds the PLL.

Definition at line 111 of file rcc_reg.h.

Referenced by rccHsiDisable(), and rccPllConfig().

◆ RCC_PLLCFGR_PLLSRC_HSE

#define RCC_PLLCFGR_PLLSRC_HSE   (RCC_PLLCFGR_PLLSRC)

HSE feeds the PLL.

Definition at line 112 of file rcc_reg.h.

Referenced by bspClockInit(), rccHseDisable(), and rccPllConfig().

◆ RCC_PLLCFGR_PLLP_DIV2

#define RCC_PLLCFGR_PLLP_DIV2   (0x0U)

VCO / 2.

Definition at line 117 of file rcc_reg.h.

Referenced by bspClockInit().

◆ RCC_PLLCFGR_PLLP_DIV4

#define RCC_PLLCFGR_PLLP_DIV4   (0x1U)

VCO / 4.

Definition at line 118 of file rcc_reg.h.

◆ RCC_PLLCFGR_PLLP_DIV6

#define RCC_PLLCFGR_PLLP_DIV6   (0x2U)

VCO / 6.

Definition at line 119 of file rcc_reg.h.

◆ RCC_PLLCFGR_PLLP_DIV8

#define RCC_PLLCFGR_PLLP_DIV8   (0x3U)

VCO / 8.

Definition at line 120 of file rcc_reg.h.

◆ RCC_CFGR_SW_Pos

#define RCC_CFGR_SW_Pos   (0U)

Bits 1:0.

Definition at line 125 of file rcc_reg.h.

Referenced by rccSysclkSwitch().

◆ RCC_CFGR_SW_Msk

#define RCC_CFGR_SW_Msk   ((uint32_t)0x3U << RCC_CFGR_SW_Pos)

rw SYSCLK source requested; values below.

Definition at line 127 of file rcc_reg.h.

Referenced by rccSysclkSwitch().

◆ RCC_CFGR_SWS_Pos

#define RCC_CFGR_SWS_Pos   (2U)

Bits 3:2.

Definition at line 128 of file rcc_reg.h.

Referenced by rccActiveSysclkSource().

◆ RCC_CFGR_SWS_Msk

#define RCC_CFGR_SWS_Msk   ((uint32_t)0x3U << RCC_CFGR_SWS_Pos)

ro SYSCLK source in use, reported once a switch completes.

Definition at line 130 of file rcc_reg.h.

Referenced by rccActiveSysclkSource().

◆ RCC_CFGR_HPRE_Pos

#define RCC_CFGR_HPRE_Pos   (4U)

Bits 7:4.

Definition at line 131 of file rcc_reg.h.

Referenced by rccBusPrescalerConfig().

◆ RCC_CFGR_HPRE_Msk

#define RCC_CFGR_HPRE_Msk   ((uint32_t)0xFU << RCC_CFGR_HPRE_Pos)

rw AHB prescaler; values below.

Definition at line 133 of file rcc_reg.h.

Referenced by rccBusPrescalerConfig().

◆ RCC_CFGR_PPRE1_Pos

#define RCC_CFGR_PPRE1_Pos   (10U)

Bits 12:10.

Definition at line 134 of file rcc_reg.h.

Referenced by rccBusPrescalerConfig().

◆ RCC_CFGR_PPRE1_Msk

#define RCC_CFGR_PPRE1_Msk   ((uint32_t)0x7U << RCC_CFGR_PPRE1_Pos)

rw APB1 prescaler; APB1 must stay at or below 45 MHz.

Definition at line 136 of file rcc_reg.h.

Referenced by rccBusPrescalerConfig().

◆ RCC_CFGR_PPRE2_Pos

#define RCC_CFGR_PPRE2_Pos   (13U)

Bits 15:13.

Definition at line 137 of file rcc_reg.h.

Referenced by rccBusPrescalerConfig().

◆ RCC_CFGR_PPRE2_Msk

#define RCC_CFGR_PPRE2_Msk   ((uint32_t)0x7U << RCC_CFGR_PPRE2_Pos)

rw APB2 prescaler; APB2 must stay at or below 90 MHz.

Definition at line 139 of file rcc_reg.h.

Referenced by rccBusPrescalerConfig().

◆ RCC_CFGR_SYSCLK_HSI

#define RCC_CFGR_SYSCLK_HSI   (0x0U)

HSI.

Definition at line 145 of file rcc_reg.h.

Referenced by rccHsiDisable(), and rccSysclkSwitch().

◆ RCC_CFGR_SYSCLK_HSE

#define RCC_CFGR_SYSCLK_HSE   (0x1U)

HSE.

Definition at line 146 of file rcc_reg.h.

Referenced by rccHseDisable(), and rccSysclkSwitch().

◆ RCC_CFGR_SYSCLK_PLL

#define RCC_CFGR_SYSCLK_PLL   (0x2U)

Main PLL (P output).

Definition at line 147 of file rcc_reg.h.

Referenced by bspClockInit(), rccOscillatorDisableGuard(), rccPllDisable(), and rccSysclkSwitch().

◆ RCC_CFGR_HPRE_DIV1

#define RCC_CFGR_HPRE_DIV1   (0x0U)

SYSCLK / 1.

Definition at line 153 of file rcc_reg.h.

Referenced by bspClockInit(), and rccValidateHpre().

◆ RCC_CFGR_HPRE_DIV2

#define RCC_CFGR_HPRE_DIV2   (0x8U)

SYSCLK / 2.

Definition at line 154 of file rcc_reg.h.

Referenced by rccValidateHpre().

◆ RCC_CFGR_HPRE_DIV4

#define RCC_CFGR_HPRE_DIV4   (0x9U)

SYSCLK / 4.

Definition at line 155 of file rcc_reg.h.

Referenced by rccValidateHpre().

◆ RCC_CFGR_HPRE_DIV8

#define RCC_CFGR_HPRE_DIV8   (0xAU)

SYSCLK / 8.

Definition at line 156 of file rcc_reg.h.

Referenced by rccValidateHpre().

◆ RCC_CFGR_HPRE_DIV16

#define RCC_CFGR_HPRE_DIV16   (0xBU)

SYSCLK / 16.

Definition at line 157 of file rcc_reg.h.

Referenced by rccValidateHpre().

◆ RCC_CFGR_HPRE_DIV64

#define RCC_CFGR_HPRE_DIV64   (0xCU)

SYSCLK / 64.

Definition at line 158 of file rcc_reg.h.

Referenced by rccValidateHpre().

◆ RCC_CFGR_HPRE_DIV128

#define RCC_CFGR_HPRE_DIV128   (0xDU)

SYSCLK / 128.

Definition at line 159 of file rcc_reg.h.

Referenced by rccValidateHpre().

◆ RCC_CFGR_HPRE_DIV256

#define RCC_CFGR_HPRE_DIV256   (0xEU)

SYSCLK / 256.

Definition at line 160 of file rcc_reg.h.

Referenced by rccValidateHpre().

◆ RCC_CFGR_HPRE_DIV512

#define RCC_CFGR_HPRE_DIV512   (0xFU)

SYSCLK / 512.

Definition at line 161 of file rcc_reg.h.

Referenced by rccValidateHpre().

◆ RCC_CFGR_PPRE_DIV1

#define RCC_CFGR_PPRE_DIV1   (0x0U)

HCLK / 1.

Definition at line 167 of file rcc_reg.h.

Referenced by rccValidatePpre().

◆ RCC_CFGR_PPRE_DIV2

#define RCC_CFGR_PPRE_DIV2   (0x4U)

HCLK / 2.

Definition at line 168 of file rcc_reg.h.

Referenced by bspClockInit(), and rccValidatePpre().

◆ RCC_CFGR_PPRE_DIV4

#define RCC_CFGR_PPRE_DIV4   (0x5U)

HCLK / 4.

Definition at line 169 of file rcc_reg.h.

Referenced by bspClockInit(), and rccValidatePpre().

◆ RCC_CFGR_PPRE_DIV8

#define RCC_CFGR_PPRE_DIV8   (0x6U)

HCLK / 8.

Definition at line 170 of file rcc_reg.h.

Referenced by rccValidatePpre().

◆ RCC_CFGR_PPRE_DIV16

#define RCC_CFGR_PPRE_DIV16   (0x7U)

HCLK / 16.

Definition at line 171 of file rcc_reg.h.

Referenced by rccValidatePpre().

◆ RCC_CIR_CSSF_Pos

#define RCC_CIR_CSSF_Pos   (7U)

Bit 7.

Definition at line 176 of file rcc_reg.h.

◆ RCC_CIR_CSSF

#define RCC_CIR_CSSF   ((uint32_t)1U << RCC_CIR_CSSF_Pos)

ro Clock security system detected an HSE failure.

Definition at line 178 of file rcc_reg.h.

◆ RCC_CIR_CSSC_Pos

#define RCC_CIR_CSSC_Pos   (23U)

Bit 23.

Definition at line 179 of file rcc_reg.h.

◆ RCC_CIR_CSSC

#define RCC_CIR_CSSC   ((uint32_t)1U << RCC_CIR_CSSC_Pos)

wo Write 1 to clear CSSF.

Definition at line 181 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOARST_Pos

#define RCC_AHB1RSTR_GPIOARST_Pos   (0U)

Bit 0.

Definition at line 187 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOARST

#define RCC_AHB1RSTR_GPIOARST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOARST_Pos)

GPIOA reset.

Definition at line 188 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOBRST_Pos

#define RCC_AHB1RSTR_GPIOBRST_Pos   (1U)

Bit 1.

Definition at line 189 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOBRST

#define RCC_AHB1RSTR_GPIOBRST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOBRST_Pos)

GPIOB reset.

Definition at line 190 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOCRST_Pos

#define RCC_AHB1RSTR_GPIOCRST_Pos   (2U)

Bit 2.

Definition at line 191 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOCRST

#define RCC_AHB1RSTR_GPIOCRST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOCRST_Pos)

GPIOC reset.

Definition at line 192 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIODRST_Pos

#define RCC_AHB1RSTR_GPIODRST_Pos   (3U)

Bit 3.

Definition at line 193 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIODRST

#define RCC_AHB1RSTR_GPIODRST   ((uint32_t)1U << RCC_AHB1RSTR_GPIODRST_Pos)

GPIOD reset.

Definition at line 194 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOERST_Pos

#define RCC_AHB1RSTR_GPIOERST_Pos   (4U)

Bit 4.

Definition at line 195 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOERST

#define RCC_AHB1RSTR_GPIOERST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOERST_Pos)

GPIOE reset.

Definition at line 196 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOFRST_Pos

#define RCC_AHB1RSTR_GPIOFRST_Pos   (5U)

Bit 5.

Definition at line 197 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOFRST

#define RCC_AHB1RSTR_GPIOFRST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOFRST_Pos)

GPIOF reset.

Definition at line 198 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOGRST_Pos

#define RCC_AHB1RSTR_GPIOGRST_Pos   (6U)

Bit 6.

Definition at line 199 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOGRST

#define RCC_AHB1RSTR_GPIOGRST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOGRST_Pos)

GPIOG reset.

Definition at line 200 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOHRST_Pos

#define RCC_AHB1RSTR_GPIOHRST_Pos   (7U)

Bit 7.

Definition at line 201 of file rcc_reg.h.

◆ RCC_AHB1RSTR_GPIOHRST

#define RCC_AHB1RSTR_GPIOHRST   ((uint32_t)1U << RCC_AHB1RSTR_GPIOHRST_Pos)

GPIOH reset.

Definition at line 202 of file rcc_reg.h.

◆ RCC_AHB1ENR_GPIOAEN_Pos

#define RCC_AHB1ENR_GPIOAEN_Pos   (0U)

Bit 0.

Definition at line 209 of file rcc_reg.h.

◆ RCC_AHB1ENR_GPIOAEN

#define RCC_AHB1ENR_GPIOAEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOAEN_Pos)

GPIOA clock.

Definition at line 210 of file rcc_reg.h.

Referenced by rccGpioClockBit().

◆ RCC_AHB1ENR_GPIOBEN_Pos

#define RCC_AHB1ENR_GPIOBEN_Pos   (1U)

Bit 1.

Definition at line 211 of file rcc_reg.h.

◆ RCC_AHB1ENR_GPIOBEN

#define RCC_AHB1ENR_GPIOBEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOBEN_Pos)

GPIOB clock.

Definition at line 212 of file rcc_reg.h.

Referenced by rccGpioClockBit().

◆ RCC_AHB1ENR_GPIOCEN_Pos

#define RCC_AHB1ENR_GPIOCEN_Pos   (2U)

Bit 2.

Definition at line 213 of file rcc_reg.h.

◆ RCC_AHB1ENR_GPIOCEN

#define RCC_AHB1ENR_GPIOCEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOCEN_Pos)

GPIOC clock.

Definition at line 214 of file rcc_reg.h.

Referenced by rccGpioClockBit().

◆ RCC_AHB1ENR_GPIODEN_Pos

#define RCC_AHB1ENR_GPIODEN_Pos   (3U)

Bit 3.

Definition at line 215 of file rcc_reg.h.

◆ RCC_AHB1ENR_GPIODEN

#define RCC_AHB1ENR_GPIODEN   ((uint32_t)1U << RCC_AHB1ENR_GPIODEN_Pos)

GPIOD clock.

Definition at line 216 of file rcc_reg.h.

Referenced by rccGpioClockBit().

◆ RCC_AHB1ENR_GPIOEEN_Pos

#define RCC_AHB1ENR_GPIOEEN_Pos   (4U)

Bit 4.

Definition at line 217 of file rcc_reg.h.

◆ RCC_AHB1ENR_GPIOEEN

#define RCC_AHB1ENR_GPIOEEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOEEN_Pos)

GPIOE clock.

Definition at line 218 of file rcc_reg.h.

Referenced by rccGpioClockBit().

◆ RCC_AHB1ENR_GPIOFEN_Pos

#define RCC_AHB1ENR_GPIOFEN_Pos   (5U)

Bit 5.

Definition at line 219 of file rcc_reg.h.

◆ RCC_AHB1ENR_GPIOFEN

#define RCC_AHB1ENR_GPIOFEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOFEN_Pos)

GPIOF clock.

Definition at line 220 of file rcc_reg.h.

Referenced by rccGpioClockBit().

◆ RCC_AHB1ENR_GPIOGEN_Pos

#define RCC_AHB1ENR_GPIOGEN_Pos   (6U)

Bit 6.

Definition at line 221 of file rcc_reg.h.

◆ RCC_AHB1ENR_GPIOGEN

#define RCC_AHB1ENR_GPIOGEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOGEN_Pos)

GPIOG clock.

Definition at line 222 of file rcc_reg.h.

Referenced by rccGpioClockBit().

◆ RCC_AHB1ENR_GPIOHEN_Pos

#define RCC_AHB1ENR_GPIOHEN_Pos   (7U)

Bit 7.

Definition at line 223 of file rcc_reg.h.

◆ RCC_AHB1ENR_GPIOHEN

#define RCC_AHB1ENR_GPIOHEN   ((uint32_t)1U << RCC_AHB1ENR_GPIOHEN_Pos)

GPIOH clock.

Definition at line 224 of file rcc_reg.h.

Referenced by rccGpioClockBit().

◆ RCC_APB1RSTR_USART2RST_Pos

#define RCC_APB1RSTR_USART2RST_Pos   (17U)

Bit 17.

Definition at line 230 of file rcc_reg.h.

◆ RCC_APB1RSTR_USART2RST

#define RCC_APB1RSTR_USART2RST   ((uint32_t)1U << RCC_APB1RSTR_USART2RST_Pos)

USART2 reset.

Definition at line 232 of file rcc_reg.h.

◆ RCC_APB1RSTR_PWRRST_Pos

#define RCC_APB1RSTR_PWRRST_Pos   (28U)

Bit 28.

Definition at line 233 of file rcc_reg.h.

◆ RCC_APB1RSTR_PWRRST

#define RCC_APB1RSTR_PWRRST   ((uint32_t)1U << RCC_APB1RSTR_PWRRST_Pos)

PWR reset.

Definition at line 234 of file rcc_reg.h.

◆ RCC_APB1ENR_WWDGEN_Pos

#define RCC_APB1ENR_WWDGEN_Pos   (11U)

Bit 11.

Definition at line 240 of file rcc_reg.h.

◆ RCC_APB1ENR_WWDGEN

#define RCC_APB1ENR_WWDGEN   ((uint32_t)1U << RCC_APB1ENR_WWDGEN_Pos)

WWDG clock; required before any WWDG register access.

Definition at line 242 of file rcc_reg.h.

Referenced by rccWwdgClockDisable(), and rccWwdgClockEnable().

◆ RCC_APB1ENR_USART2EN_Pos

#define RCC_APB1ENR_USART2EN_Pos   (17U)

Bit 17.

Definition at line 243 of file rcc_reg.h.

◆ RCC_APB1ENR_USART2EN

#define RCC_APB1ENR_USART2EN   ((uint32_t)1U << RCC_APB1ENR_USART2EN_Pos)

USART2 clock.

Definition at line 245 of file rcc_reg.h.

Referenced by rccUsart2ClockDisable(), and rccUsart2ClockEnable().

◆ RCC_APB1ENR_PWREN_Pos

#define RCC_APB1ENR_PWREN_Pos   (28U)

Bit 28.

Definition at line 246 of file rcc_reg.h.

◆ RCC_APB1ENR_PWREN

#define RCC_APB1ENR_PWREN   ((uint32_t)1U << RCC_APB1ENR_PWREN_Pos)

PWR clock; required before any PWR register access.

Definition at line 248 of file rcc_reg.h.

Referenced by rccPwrClockDisable(), and rccPwrClockEnable().

◆ RCC_APB2RSTR_SYSCFGRST_Pos

#define RCC_APB2RSTR_SYSCFGRST_Pos   (14U)

Bit 14.

Definition at line 253 of file rcc_reg.h.

◆ RCC_APB2RSTR_SYSCFGRST

#define RCC_APB2RSTR_SYSCFGRST   ((uint32_t)1U << RCC_APB2RSTR_SYSCFGRST_Pos)

rw SYSCFG reset.

Definition at line 255 of file rcc_reg.h.

◆ RCC_APB2ENR_SYSCFGEN_Pos

#define RCC_APB2ENR_SYSCFGEN_Pos   (14U)

Bit 14.

Definition at line 260 of file rcc_reg.h.

◆ RCC_APB2ENR_SYSCFGEN

#define RCC_APB2ENR_SYSCFGEN   ((uint32_t)1U << RCC_APB2ENR_SYSCFGEN_Pos)

rw SYSCFG clock; required before any SYSCFG register access.

Definition at line 262 of file rcc_reg.h.

Referenced by rccSyscfgClockDisable(), and rccSyscfgClockEnable().

◆ RCC_CSR_LSION_Pos

#define RCC_CSR_LSION_Pos   (0U)

Bit 0.

Definition at line 268 of file rcc_reg.h.

◆ RCC_CSR_LSION

#define RCC_CSR_LSION   ((uint32_t)1U << RCC_CSR_LSION_Pos)

rw LSI on.

Definition at line 270 of file rcc_reg.h.

◆ RCC_CSR_LSIRDY_Pos

#define RCC_CSR_LSIRDY_Pos   (1U)

Bit 1.

Definition at line 271 of file rcc_reg.h.

◆ RCC_CSR_LSIRDY

#define RCC_CSR_LSIRDY   ((uint32_t)1U << RCC_CSR_LSIRDY_Pos)

ro LSI ready.

Definition at line 273 of file rcc_reg.h.

◆ RCC_CSR_RMVF_Pos

#define RCC_CSR_RMVF_Pos   (24U)

Bit 24.

Definition at line 274 of file rcc_reg.h.

◆ RCC_CSR_RMVF

#define RCC_CSR_RMVF   ((uint32_t)1U << RCC_CSR_RMVF_Pos)

rw Write 1 to clear every reset flag below.

Definition at line 276 of file rcc_reg.h.

Referenced by rccClearResetFlags().

◆ RCC_CSR_BORRSTF_Pos

#define RCC_CSR_BORRSTF_Pos   (25U)

Bit 25.

Definition at line 277 of file rcc_reg.h.

◆ RCC_CSR_BORRSTF

#define RCC_CSR_BORRSTF   ((uint32_t)1U << RCC_CSR_BORRSTF_Pos)

ro Brown-out reset occurred.

Definition at line 279 of file rcc_reg.h.

◆ RCC_CSR_PINRSTF_Pos

#define RCC_CSR_PINRSTF_Pos   (26U)

Bit 26.

Definition at line 280 of file rcc_reg.h.

◆ RCC_CSR_PINRSTF

#define RCC_CSR_PINRSTF   ((uint32_t)1U << RCC_CSR_PINRSTF_Pos)

ro NRST pin reset occurred.

Definition at line 282 of file rcc_reg.h.

◆ RCC_CSR_PORRSTF_Pos

#define RCC_CSR_PORRSTF_Pos   (27U)

Bit 27.

Definition at line 283 of file rcc_reg.h.

◆ RCC_CSR_PORRSTF

#define RCC_CSR_PORRSTF   ((uint32_t)1U << RCC_CSR_PORRSTF_Pos)

ro Power-on reset occurred.

Definition at line 285 of file rcc_reg.h.

◆ RCC_CSR_SFTRSTF_Pos

#define RCC_CSR_SFTRSTF_Pos   (28U)

Bit 28.

Definition at line 286 of file rcc_reg.h.

◆ RCC_CSR_SFTRSTF

#define RCC_CSR_SFTRSTF   ((uint32_t)1U << RCC_CSR_SFTRSTF_Pos)

ro Software reset occurred.

Definition at line 288 of file rcc_reg.h.

◆ RCC_CSR_IWDGRSTF_Pos

#define RCC_CSR_IWDGRSTF_Pos   (29U)

Bit 29.

Definition at line 289 of file rcc_reg.h.

◆ RCC_CSR_IWDGRSTF

#define RCC_CSR_IWDGRSTF   ((uint32_t)1U << RCC_CSR_IWDGRSTF_Pos)

ro Independent watchdog reset occurred.

Definition at line 291 of file rcc_reg.h.

◆ RCC_CSR_WWDGRSTF_Pos

#define RCC_CSR_WWDGRSTF_Pos   (30U)

Bit 30.

Definition at line 292 of file rcc_reg.h.

◆ RCC_CSR_WWDGRSTF

#define RCC_CSR_WWDGRSTF   ((uint32_t)1U << RCC_CSR_WWDGRSTF_Pos)

ro Window watchdog reset occurred.

Definition at line 294 of file rcc_reg.h.

◆ RCC_CSR_LPWRRSTF_Pos

#define RCC_CSR_LPWRRSTF_Pos   (31U)

Bit 31.

Definition at line 295 of file rcc_reg.h.

◆ RCC_CSR_LPWRRSTF

#define RCC_CSR_LPWRRSTF   ((uint32_t)1U << RCC_CSR_LPWRRSTF_Pos)

ro Low-power reset occurred.

Definition at line 297 of file rcc_reg.h.