RCC Exported Functions

group RCC_Exported_Functions

Functions

void RCC_PeriphClockCmd(uint32_t APBPeriph, uint32_t APBPeriph_Clock, FunctionalState NewState)

Enable or disable the APB peripheral clock.

Parameters:
  • APBPeriph – Specify the APB peripheral to gate its clock. This parameter can be one of the following values, refer to APB Peripheral Define.

    • APBPeriph_TIMER: The APB peripheral of TIMER.

    • APBPeriph_ENHTIMER: The APB peripheral of ENHTIMER.

    • APBPeriph_FLASH: The APB peripheral of FLASH.

    • APBPeriph_GDMA: The APB peripheral of GDMA.

    • APBPeriph_PKE: The APB peripheral of PKE.

    • APBPeriph_SHA256: The APB peripheral of SHA256.

    • APBPeriph_FLASH1: The APB peripheral of FLASH1.

    • APBPeriph_FLH_SEC: The APB peripheral of FLH_SEC.

    • APBPeriph_MODEM: The APB peripheral of MODEM.

    • APBPeriph_BLUEWIZ: The APB peripheral of BLUEWIZ.

    • APBPeriph_ZIGBEE: The APB peripheral of ZIGBEE.

    • APBPeriph_IF8080: The APB peripheral of IF8080.

    • APBPeriph_SPI2W: The APB peripheral of SPI2W.

    • APBPeriph_KEYSCAN: The APB peripheral of KEYSCAN.

    • APBPeriph_QDEC: The APB peripheral of QDEC.

    • APBPeriph_I2Cx: The APB peripheral of I2C, where x can be 0 to 1.

    • APBPeriph_IR: The APB peripheral of IR.

    • APBPeriph_SPIx: The APB peripheral of SPI, where x can be 0 to 1.

    • APBPeriph_UARTx: The APB peripheral of UART, where x can be 0 to 2.

    • APBPeriph_GPIO: The APB peripheral of GPIO.

    • APBPeriph_ADC: The APB peripheral of ADC.

    • APBPeriph_I2Sx: The APB peripheral of I2S, where x can be 0 to 1.

    • APBPeriph_CODEC: The APB peripheral of CODEC.

  • APBPeriph_Clock – Specify the APB peripheral clock config. This parameter can be one of the following values (must be the same with APBPeriph), refer to RCC Peripheral Clock.

    • APBPeriph_TIMER_CLOCK: The APB peripheral clock of TIMER.

    • APBPeriph_ENHTIMER_CLOCK: The APB peripheral clock of ENHTIMER.

    • APBPeriph_FLASH_CLOCK: The APB peripheral clock of FLASH.

    • APBPeriph_GDMA_CLOCK: The APB peripheral clock of GDMA.

    • APBPeriph_PKE_CLOCK: The APB peripheral clock of PKE.

    • APBPeriph_SHA256_CLOCK: The APB peripheral clock of SHA256.

    • APBPeriph_FLASH1_CLOCK: The APB peripheral clock of FLASH1.

    • APBPeriph_FLH_SEC_CLOCK: The APB peripheral clock of FLH_SEC.

    • APBPeriph_MODEM_CLOCK: The APB peripheral clock of MODEM.

    • APBPeriph_BLUEWIZ_CLOCK: The APB peripheral clock of BLUEWIZ.

    • APBPeriph_ZIGBEE_CLOCK: The APB peripheral clock of ZIGBEE.

    • APBPeriph_IF8080_CLOCK: The APB peripheral clock of IF8080.

    • APBPeriph_SPI2W_CLOCK: The APB peripheral clock of SPI2W.

    • APBPeriph_KEYSCAN_CLOCK: The APB peripheral clock of KEYSCAN.

    • APBPeriph_QDEC_CLOCK: The APB peripheral clock of QDEC.

    • APBPeriph_I2Cx_CLOCK: The APB peripheral clock of I2C, where x can be 0 to 1.

    • APBPeriph_IR_CLOCK: The APB peripheral clock of IR.

    • APBPeriph_SPIx_CLOCK: The APB peripheral clock of SPI, where x can be 0 to 1.

    • APBPeriph_UARTx_CLOCK: The APB peripheral clock of UART, where x can be 0 to 2.

    • APBPeriph_GPIO_CLOCK: The APB peripheral clock of GPIO.

    • APBPeriph_ADC_CLOCK: The APB peripheral clock of ADC.

    • APBPeriph_I2Sx_CLOCK: The APB peripheral clock of I2S, where x can be 0 to 1.

    • APBPeriph_CODEC_CLOCK: The APB peripheral clock of CODEC.

  • NewState – New state of the specified peripheral clock. This parameter can be: ENABLE or DISABLE.

Returns:

None.

void RCC_I2CClkDivConfig(I2C_TypeDef *I2Cx, uint16_t ClockDiv)

Configure the I2C clock divider.

Parameters:
  • I2Cx – Where x can be 0 or 1 to select the I2C peripheral.

  • ClockDiv – Specify the APB peripheral to gate its clock. This parameter can be one of the following values, refer to I2C Clock Divider.

    • I2C_CLOCK_DIV_1

    • I2C_CLOCK_DIV_2

    • I2C_CLOCK_DIV_4

    • I2C_CLOCK_DIV_8

Returns:

None.

void RCC_SPIClkDivConfig(SPI_TypeDef *SPIx, uint16_t ClockDiv)

Configure the SPI clock divider.

Parameters:
  • SPIx – Where x can be 0 or 1 to select the SPI peripheral.

  • ClockDiv – Specify the APB peripheral to gate its clock. This parameter can be one of the following values, refer to SPI Clock Divider.

    • SPI_CLOCK_DIV_1

    • SPI_CLOCK_DIV_2

    • SPI_CLOCK_DIV_4

    • SPI_CLOCK_DIV_8

Returns:

None.

void RCC_TIMClkDivConfig(E_TIM_NUM TIMx, uint16_t ClockDiv)

Configure the TIMER and ENH-TIMER clock divider.

Parameters:
  • TIMx – selected TIM number.

  • ClockDiv – Specify the APB peripheral to gate its clock. This parameter can be one of the following values, refer to TIM Clock Divider.

    • TIM_CLOCK_DIV_1

    • TIM_CLOCK_DIV_125

    • TIM_CLOCK_DIV_2

    • TIM_CLOCK_DIV_4

    • TIM_CLOCK_DIV_8

    • TIM_CLOCK_DIV_40

Returns:

None

void RCC_UARTClkDivConfig(UART_TypeDef *UARTx, uint16_t ClockDiv)

Configure the UART clock divider.

Parameters:
  • UARTx – Selected UART peripheral.

  • ClockDiv – Specify the APB peripheral to gate its clock. This parameter can be one of the following values, refer to UART Clock Divider.

    • UART_CLOCK_DIV_1

    • UART_CLOCK_DIV_2

    • UART_CLOCK_DIV_4

    • UART_CLOCK_DIV_16

Returns:

None.

void RCC_PeriFunctionConfig(uint32_t APBPeriph, FunctionalState NewState)

Enable or disable the APB peripheral function.

Parameters:
  • APBPeriph – Specify the APB peripheral. This parameter can be one of the following values, refer to APB Peripheral Define.

    • APBPeriph_TIMER

    • APBPeriph_ENHTIMER

    • APBPeriph_FLASH

    • APBPeriph_GDMA

    • APBPeriph_PKE

    • APBPeriph_SHA256

    • APBPeriph_FLASH1

    • APBPeriph_FLH_SEC

    • APBPeriph_MODEM

    • APBPeriph_BLUEWIZ

    • APBPeriph_ZIGBEE

    • APBPeriph_IF8080

    • APBPeriph_SPI2W

    • APBPeriph_KEYSCAN

    • APBPeriph_QDEC

    • APBPeriph_I2C1

    • APBPeriph_I2C0

    • APBPeriph_IR

    • APBPeriph_SPI1

    • APBPeriph_SPI0

    • APBPeriph_UART0

    • APBPeriph_UART1

    • APBPeriph_UART2

    • APBPeriph_GPIO

    • APBPeriph_ADC

    • APBPeriph_I2S0

    • APBPeriph_I2S1

    • APBPeriph_CODEC

  • NewState – New state of the specified peripheral clock. This parameter can be: ENABLE or DISABLE.

Returns:

None.

void RCC_PeriClockConfig(uint32_t APBPeriph_Clock, FunctionalState NewState)

Enable or disable the APB peripheral clock.

Parameters:
  • APBPeriph_Clock – Specify the APB peripheral clock config. This parameter can be one of the following values (must be the same with APBPeriph), refer to RCC Peripheral Clock.

    • APBPeriph_TIMER_CLOCK

    • APBPeriph_ENHTIMER_CLOCK

    • APBPeriph_FLASH_CLOCK

    • APBPeriph_GDMA_CLOCK

    • APBPeriph_PKE_CLOCK

    • APBPeriph_SHA256_CLOCK

    • APBPeriph_FLASH1_CLOCK

    • APBPeriph_FLH_SEC_CLOCK

    • APBPeriph_MODEM_CLOCK

    • APBPeriph_BLUEWIZ_CLOCK

    • APBPeriph_ZIGBEE_CLOCK

    • APBPeriph_IF8080_CLOCK

    • APBPeriph_SPI2W_CLOCK

    • APBPeriph_KEYSCAN_CLOCK

    • APBPeriph_QDEC_CLOCK

    • APBPeriph_I2C1_CLOCK

    • APBPeriph_I2C0_CLOCK

    • APBPeriph_IR_CLOCK

    • APBPeriph_SPI1_CLOCK

    • APBPeriph_SPI0_CLOCK

    • APBPeriph_UART0_CLOCK

    • APBPeriph_UART1_CLOCK

    • APBPeriph_UART2_CLOCK

    • APBPeriph_GPIO_CLOCK

    • APBPeriph_ADC_CLOCK

    • APBPeriph_I2S0_CLOCK

    • APBPeriph_I2S1_CLOCK

    • APBPeriph_CODEC_CLOCK

  • NewState – New state of the specified peripheral clock. This parameter can be: ENABLE or DISABLE.

Returns:

None.

void RCC_ClockSrc5MCmd(void)

Enables the 5M clock source.

Returns:

None.

void RCC_ClockSrc10MCmd(void)

Enables the 10M clock source.

Returns:

None.

void RCC_ClockSrc20MCmd(void)

Enables the 20M clock source.

Returns:

None.