AnsweredAssumed Answered

HSI Clock Configuraion

Question asked by amer.sherif.001 on Jan 28, 2013
Latest reply on Jan 29, 2013 by Clive One
Hi,

I'm using stm32f10xc4, low density value line, it supports an HSE of 8 MHz, my hardware has 20 MHz which is wrong and that's the reason why the clock configuration doesn't go properly - i guess -.

So i tried to get the HSI through the PLL, the target is to reach 24MHz.

Here's my code, but it still doesn't work!

     /* Enable Internal High Speed oscillator */
     RCC_HSICmd(ENABLE);


     /* Set PLL clock output to 24MHz using HSI (8MHz) as entry clock */
     RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_6);


     /* Select the PLL as system clock source */
     RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);


     /* Enable the PLL */
     RCC_PLLCmd(ENABLE);


     /* Output PLL clock divided by 2 on MCO pin */
     RCC_MCOConfig(RCC_MCO_PLLCLK_Div2);


     /* Configure HCLK such as HCLK = SYSCLK */
     RCC_HCLKConfig(RCC_SYSCLK_Div1);


     /* Configure PCLK1 such as PCLK1 = HCLK/2 */
     RCC_PCLK1Config(RCC_HCLK_Div1);


     /* Configure PCLK2 such as PCLK2 = HCLK */
     RCC_PCLK2Config(RCC_HCLK_Div1);


     /* Configure ADCCLK such as ADCCLK = PCLK2/2 */
     RCC_ADCCLKConfig(RCC_PCLK2_Div2);

The while(1) inside main contains this:
     GPIO_WriteBit(GPIOB, GPIO_Pin_0, Bit_SET);
     GPIO_WriteBit(GPIOB, GPIO_Pin_0, Bit_RESET);
to measure the frequency, i'm exposing PB.0 to scope.

I tried to use this one but didn't work out either, gave me an unavailable item when watched.
     RCC_ClocksTypeDef RCC_Clocks;
     RCC_GetClocksFreq(&RCC_Clocks);

Any idea?

Thanks

Outcomes