cancel
Showing results for 
Search instead for 
Did you mean: 

Setting up HSE on STM32F4 Discovery

jdcowpland
Associate II
Posted on December 12, 2013 at 15:48

I'm sure there's probably already a post on how to do this, but I can't find it so here goes:

I'm trying to set up the external 8 MHz oscillator on the F4 Discovery. I'm using Keil IDE and have set my xtal osc to 8.0 MHz in the target options. I've then added this code to my setup:

void RCC_Configuration(void){
RCC_DeInit();
// Enable HSE
RCC_HSEConfig(RCC_HSE_ON);
while(RCC_WaitForHSEStartUp() == SUCCESS);
RCC_PLLConfig(RCC_PLLSource_HSE,8,336,2,7);// Source = HSE, M = 8, N = 336, P = 2, Q = 7
RCC_PLLCmd(ENABLE);
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
RCC_HCLKConfig(RCC_SYSCLK_Div1);
RCC_PCLK1Config(RCC_HCLK_Div4);
RCC_PCLK2Config(RCC_HCLK_Div4);
}

Unsurprisingly, it doesn't seem to work. Can anyone help out?
1 REPLY 1
jdcowpland
Associate II
Posted on December 12, 2013 at 16:12

Ok, so just found that if I call the SystemInit function, then the HSE is enabled.