github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/runtime/runtime_stm32f407.go (about) 1 //go:build stm32f4 && stm32f407 2 3 package runtime 4 5 import "device/stm32" 6 7 /* 8 clock settings 9 10 +-------------+--------+ 11 | HSE | 8mhz | 12 | SYSCLK | 168mhz | 13 | HCLK | 168mhz | 14 | APB2(PCLK2) | 84mhz | 15 | APB1(PCLK1) | 42mhz | 16 +-------------+--------+ 17 */ 18 const ( 19 HSE_STARTUP_TIMEOUT = 0x0500 20 // PLL Options - See RM0090 Reference Manual pg. 95 21 PLL_M = 8 // PLL_VCO = (HSE_VALUE or HSI_VLAUE / PLL_M) * PLL_N 22 PLL_N = 336 23 PLL_P = 2 // SYSCLK = PLL_VCO / PLL_P 24 PLL_Q = 7 // USB OTS FS, SDIO and RNG Clock = PLL_VCO / PLL_Q 25 PLL_CFGR = PLL_M | (PLL_N << stm32.RCC_PLLCFGR_PLLN_Pos) | (((PLL_P >> 1) - 1) << stm32.RCC_PLLCFGR_PLLP_Pos) | 26 (1 << stm32.RCC_PLLCFGR_PLLSRC_Pos) | (PLL_Q << stm32.RCC_PLLCFGR_PLLQ_Pos) 27 )