前段时间有幸在
论坛领到一块NUCLEO-F413ZH,之前也没有用过CubeMx,所以想着去试一下;NUCLEO-F413板载是没有HSE的,所以只能把PLLCLK的时钟源选为HSI;
同时,我在下载了F4的官方软件工程 en.
STM32cubef4 ,
然后,发现里面的时钟配置是这样的:
/**
* @brief System Clock Configura
tion
* The system Clock is configured as follow :
* System Clock source = PLL (HSI)
* SYSCLK(Hz) = 100000000
* HCLK(Hz) = 100000000
* AHB Prescaler = 1
* APB1 Prescaler = 2
* APB2 Prescaler = 1
* HSE Frequency(Hz) = 8000000
* PLL_M = 8
* PLL_N = 400
* PLL_P = 4
* PLL_Q = 7
* VDD(V) = 3.3
* Main regulator output voltage = Scale2 mode
* Flash Latency(WS) = 3
* @param None
* @retval None
*/
这是static void SystemClock_Config(void) 的功能说明
然后,我按照这个参数在CubeMx上勾选,发现 SYSCLK就已经溢出了,超过了100M;
然后,我
仿真去查看 RCC->PLLCFGR寄存器的值,也是符合 上面的参数的;
还在研究中,希望有经验的能解答下
其实我是想弄明白,为什么我按照demo的参数这么分配会溢出
我这里也是用的HSI
而且在使用HSE之前,先要使能pin才行啊,我这里HSE都是灰 {MOD}的
你说的有道理,是我先看了注释先入为主了,没有认真看代码
/**
* @brief System Clock Configuration
* The system Clock is configured as follow :
* System Clock source = PLL (HSI)
* SYSCLK(Hz) = 100000000
* HCLK(Hz) = 100000000
* AHB Prescaler = 1
* APB1 Prescaler = 2
* APB2 Prescaler = 1
* HSE Frequency(Hz) = 8000000
* PLL_M = 8
* PLL_N = 400
* PLL_P = 4
* PLL_Q = 7
* VDD(V) = 3.3
* Main regulator output voltage = Scale2 mode
* Flash Latency(WS) = 3
* @param None
* @retval None
/* Enable HSI Oscillator and activate PLL with HSI as source */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 8;
RCC_OscInitStruct.PLL.PLLN = 400;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
RCC_OscInitStruct.PLL.PLLQ = 7;
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
确实是我一根筋,
一周热门 更多>