|
STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
|
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. | |
NUCLEO-F446RE configuration built on the drivers: today the 180 MHz clock bring-up.
| #define BSP_HSE_HZ (8000000U) |
| #define BSP_PLL_M (8U) |
PLL M: VCO input = HSE / M = 1 MHz.
Definition at line 42 of file bsp.h.
Referenced by bspClockInit().
| #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().
| #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).
Definition at line 46 of file bsp.h.
Referenced by bspClockInit().
| #define BSP_SYSCLK_HZ ((BSP_HSE_HZ / BSP_PLL_M) * BSP_PLL_N / BSP_PLL_P_DIV) |
| #define BSP_HCLK_HZ (BSP_SYSCLK_HZ) |
| #define BSP_PCLK1_HZ (BSP_HCLK_HZ / 4U) |
| #define BSP_PCLK2_HZ (BSP_HCLK_HZ / 2U) |
| 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.
| rcc | RCC block (e.g. RCC). |
| pwr | PWR block (e.g. PWR). |
| flash | Flash interface block (e.g. FLASH). |
| DRIVER_STATUS_OK | SYSCLK runs from the PLL at 180 MHz. |
| DRIVER_STATUS_ERR_TIMEOUT | HSE, the PLL, the regulator, over-drive or the switch did not report ready. |
| DRIVER_STATUS_ERR_BUSY | HSE or the PLL was already on. |
| DRIVER_STATUS_ERR_HW_FAULT | The flash latency did not read back. |
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().