AnsweredAssumed Answered

Problem with stm32f100c6 clock configuration

Question asked by amer.sherif on Jul 16, 2012
Latest reply on Nov 17, 2012 by Ahmad.Ibrahim
Hi everybody!

I'm using STM32F100C6 with IAR Embedded Workbench IDE and i'm trying to configure the system clock.

First i tried to use the external oscillator HSE that's built on the board, 20MHz, here's the code related:
       /* Enable the HSE */

       /* Wait till HSE is ready and if Time out is reached exit */
       HSEStartUpStatus = RCC_WaitForHSEStartUp();
       while(HSEStartUpStatus == ERROR)

The problem is that it stays there forever!

So i made some search for other way to deliver the 24 MHz that i need in my application and i found that i can use the HSI.
Here's the code related:

    /* Reset the RCC clock configuration to the default reset state */

    /* Enable Internal High Speed oscillator */

    /* Configure HCLK such as HCLK = SYSCLK */

    /* Configure PCLK2 such as PCLK2 = HCLK */

    /* Configure PCLK1 such as PCLK1 = HCLK */

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

    /* Enable the PLL */

    /* Select the PLL as system clock source */

I made a check after that to see how the code affected the system clock:
    RCC_ClocksTypeDef RCC_Clocks;

System clock, HCLK, PCLK1 and PCLK2 are 8MHz

Any help in that please?

Thanks in advance!