前段时间有幸在论坛领到一块NUCLEO-F413ZH,之前也没有用过CubeMx,所以想着去试一下;NUCLEO-F413板载是没有HSE的,所以只能把PLLCLK的时钟源选为HSI; 同时,我在下载了F4的官方软件工程 en.stm32cubef4 , 然后,发现里面的时钟配置是这样的: /** * @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 */ 这是static void SystemClock_Config(void) 的功能说明 然后,我按照这个参数在CubeMx上勾选,发现 SYSCLK就已经溢出了,超过了100M; 然后,我仿真去查看 RCC->PLLCFGR寄存器的值,也是符合 上面的参数的; 还在研究中,希望有经验的能解答下 |
评分
查看全部评分
其实我是想弄明白,为什么我按照demo的参数这么分配会溢出
******************************************************************************
* @file Demonstrations/Src/main.c
* @author MCD Application Team
* @version V1.0.1
* @date 17-February-2017
* @brief This demo describes how display bmp images from SD card on LCD using
the Adafruit 1.8" TFT shield with Joystick and microSD mounted on top
of the STM32 Nucleo board.
******************************************************************************
最新的F4的软件包,没搞明白而已
你看错了吧,demo里面是用HSI,
我这里也是用的HSI
而且在使用HSE之前,先要使能pin才行啊,我这里HSE都是灰色的
你说的有道理,是我先看了注释先入为主了,没有认真看代码
/**
* @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)
确实是我一根筋,
评分
查看全部评分
@brief System Clock Configuration
* The system Clock is configured as follow :
* System Clock source = PLL (HSE)
* SYSCLK(Hz) = 216000000
* HCLK(Hz) = 216000000
* AHB Prescaler = 1
* APB1 Prescaler = 4
* APB2 Prescaler = 2
* HSE Frequency(Hz) = 8000000
* PLL_M = 8
* PLL_N = 432
* PLL_P = 2
* PLL_Q = 9
* PLL_R = 7
* VDD(V) = 3.3
* Main regulator output voltage = Scale1 mode
* Flash Latency(WS) = 7
* @param None
* @retval None
我这个例程是用的外部晶振,但是我并没有给开发板接任何外部晶振,看你的回答是可以旁路ST-Link模块的8M晶振,请教您,这个具体在cubeMX里怎么设置呢?