STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Loading...
Searching...
No Matches
bsp.h File Reference

NUCLEO-F446RE board support: the 180 MHz clock configuration. More...

#include "driver_status.h"
#include "flash.h"
#include "pwr.h"
#include "rcc.h"
Include dependency graph for bsp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

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.

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.

Detailed Description

NUCLEO-F446RE board support: the 180 MHz clock configuration.

One board, one configuration, so there is no frequency solver. The configuration follows ST's own NUCLEO-F446 180 MHz example, from the 8 MHz clock the ST-LINK drives on OSC_IN (see the clock tree):

Stage Setting Result
HSE bypass 8 MHz
PLL M 8 1 MHz
PLL N 360 360 MHz
PLL P 2 180 MHz SYSCLK
AHB /1 180 MHz
APB1 /4 45 MHz
APB2 /2 90 MHz
Regulator scale 1, over-drive
Flash 5 wait states, prefetch and caches on

The _Static_asserts below check the BSP_* constants against the chip's limits. bsp.c writes the matching register values separately, and test_bsp.c checks the two agree, so change both together.

Definition in file bsp.h.