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

NUCLEO-F446RE configuration built on the drivers: today the 180 MHz clock bring-up. More...

Functions

DRIVER_MUST_CHECK DriverStatus_e bspClockInit (RccRegisters_t *rcc, PwrRegisters_t *pwr, FlashRegisters_t *flash)
 Bring SYSCLK from the 16 MHz HSI reset state to 180 MHz.

Configuration

#define BSP_HSE_HZ   (8000000U)
 HSE input from the ST-LINK MCO, in bypass mode.
#define BSP_PLL_M   (8U)
 PLL M: VCO input = HSE / M = 1 MHz.
#define BSP_PLL_N   (360U)
 PLL N: VCO output = 1 MHz x N = 360 MHz.
#define BSP_PLL_P_DIV   (2U)
 PLL P divisor (register value RCC_PLLCFGR_PLLP_DIV2).
#define BSP_FLASH_LATENCY   (5U)
 Flash wait states for 180 MHz at 2.7-3.6 V (RM0390 Table 5).

Resulting clocks

Pass these to systickInit() and uartInit().

#define BSP_SYSCLK_HZ   ((BSP_HSE_HZ / BSP_PLL_M) * BSP_PLL_N / BSP_PLL_P_DIV)
 SYSCLK: HSE / M x N / P.
#define BSP_HCLK_HZ   (BSP_SYSCLK_HZ)
 HCLK (AHB /1): core, SysTick, GPIO.
#define BSP_PCLK1_HZ   (BSP_HCLK_HZ / 4U)
 APB1 (/4): USART2, PWR.
#define BSP_PCLK2_HZ   (BSP_HCLK_HZ / 2U)
 APB2 (/2): SYSCFG.

Detailed Description

NUCLEO-F446RE configuration built on the drivers: today the 180 MHz clock bring-up.

Macro Definition Documentation

◆ BSP_HSE_HZ

#define BSP_HSE_HZ   (8000000U)

HSE input from the ST-LINK MCO, in bypass mode.

Definition at line 41 of file bsp.h.

◆ BSP_PLL_M

#define BSP_PLL_M   (8U)

PLL M: VCO input = HSE / M = 1 MHz.

Definition at line 42 of file bsp.h.

Referenced by bspClockInit().

◆ BSP_PLL_N

#define BSP_PLL_N   (360U)

PLL N: VCO output = 1 MHz x N = 360 MHz.

Definition at line 43 of file bsp.h.

Referenced by bspClockInit().

◆ BSP_PLL_P_DIV

#define BSP_PLL_P_DIV   (2U)

PLL P divisor (register value RCC_PLLCFGR_PLLP_DIV2).

Definition at line 44 of file bsp.h.

◆ BSP_FLASH_LATENCY

#define BSP_FLASH_LATENCY   (5U)

Flash wait states for 180 MHz at 2.7-3.6 V (RM0390 Table 5).

Definition at line 46 of file bsp.h.

Referenced by bspClockInit().

◆ BSP_SYSCLK_HZ

#define BSP_SYSCLK_HZ   ((BSP_HSE_HZ / BSP_PLL_M) * BSP_PLL_N / BSP_PLL_P_DIV)

SYSCLK: HSE / M x N / P.

Definition at line 53 of file bsp.h.

◆ BSP_HCLK_HZ

#define BSP_HCLK_HZ   (BSP_SYSCLK_HZ)

HCLK (AHB /1): core, SysTick, GPIO.

Definition at line 54 of file bsp.h.

◆ BSP_PCLK1_HZ

#define BSP_PCLK1_HZ   (BSP_HCLK_HZ / 4U)

APB1 (/4): USART2, PWR.

Definition at line 55 of file bsp.h.

◆ BSP_PCLK2_HZ

#define BSP_PCLK2_HZ   (BSP_HCLK_HZ / 2U)

APB2 (/2): SYSCFG.

Definition at line 56 of file bsp.h.

Function Documentation

◆ bspClockInit()

DriverStatus_e bspClockInit ( RccRegisters_t * rcc,
PwrRegisters_t * pwr,
FlashRegisters_t * flash )

Bring SYSCLK from the 16 MHz HSI reset state to 180 MHz.

Follows the bring-up order in rcc.h, turning HSE on before setting the regulator so that a missing clock fails first. It ends by enabling prefetch and the caches. It stops at the first failing step and returns that step's status.

Parameters
rccRCC block (e.g. RCC).
pwrPWR block (e.g. PWR).
flashFlash interface block (e.g. FLASH).
Precondition
Called once from reset: SYSCLK is HSI, and HSE and the PLL are off.
Return values
DRIVER_STATUS_OKSYSCLK runs from the PLL at 180 MHz.
DRIVER_STATUS_ERR_TIMEOUTHSE, the PLL, the regulator, over-drive or the switch did not report ready.
DRIVER_STATUS_ERR_BUSYHSE or the PLL was already on.
DRIVER_STATUS_ERR_HW_FAULTThe flash latency did not read back.
Warning
No unwind. After a failure the earlier steps stay in effect, such as HSE, the regulator scale or a running PLL, while SYSCLK is still HSI, which is safe to continue from. A second call reports BUSY.
Note
INVALID_PARAM and NOT_INITIALIZED cannot occur with these constants.

Definition at line 12 of file bsp.c.

References BSP_FLASH_LATENCY, BSP_PLL_M, BSP_PLL_N, bspClockInit(), DRIVER_STATUS_OK, flashEnableCaches(), PWR_CR_VOS_SCALE1, pwrEnableOverdrive(), pwrSetVoltageScale(), pwrWaitVoltageScaleReady(), RCC_CFGR_HPRE_DIV1, RCC_CFGR_PPRE_DIV2, RCC_CFGR_PPRE_DIV4, RCC_CFGR_SYSCLK_PLL, RCC_CR_HSEBYP, RCC_PLLCFGR_PLLP_DIV2, RCC_PLLCFGR_PLLSRC_HSE, rccBusPrescalerConfig(), rccHseEnable(), rccPllConfig(), rccPllEnable(), rccPwrClockEnable(), and rccSysclkSwitch().

Referenced by bspClockInit().

Here is the call graph for this function:
Here is the caller graph for this function: