github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/runtime/runtime_stm32f469.go (about)

     1  //go:build stm32f4 && stm32f469
     2  
     3  package runtime
     4  
     5  import "device/stm32"
     6  
     7  /*
     8  clock settings
     9  
    10  	+-------------+--------+
    11  	| HSE         | 8mhz   |
    12  	| SYSCLK      | 180mhz |
    13  	| HCLK        | 180mhz |
    14  	| APB2(PCLK2) | 90mhz  |
    15  	| APB1(PCLK1) | 45mhz  |
    16  	+-------------+--------+
    17  */
    18  const (
    19  	HSE_STARTUP_TIMEOUT = 0x0500
    20  	// PLL Options - See RM0386 Reference Manual pg. 148
    21  	PLL_M    = 8 // PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N
    22  	PLL_N    = 360
    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_R    = 6 // DSI
    26  	PLL_CFGR = PLL_M | (PLL_N << stm32.RCC_PLLCFGR_PLLN_Pos) | (((PLL_P >> 1) - 1) << stm32.RCC_PLLCFGR_PLLP_Pos) |
    27  		(1 << stm32.RCC_PLLCFGR_PLLSRC_Pos) | (PLL_Q << stm32.RCC_PLLCFGR_PLLQ_Pos) | (PLL_R << stm32.RCC_PLLCFGR_PLLR_Pos)
    28  )