Skip to main content
Yihao Guo
Associate II
July 14, 2015
Solved

STM32 clock configuration

  • July 14, 2015
  • 2 replies
  • 2542 views
Posted on July 14, 2015 at 07:15

I am a beginner in STM32. Recently I surf the Internet and find some codes written by others. They all says that the RCC should be configured at first as follow:

1. Reset the RCC register;

2. Open HSE;

3. Wait for HSE start up;

4.RCC_HCLKConfig;

5. RCC_PCLK2Config;

6. RCC_PCLK1Config;

7. RCC_PLLConfig;

8. Rcc_PLLCmd(ENABLE);

9. Wait for PLL to work;

10. RCC_SYSCLKConfig;

11. Determine that whether PLL is the system clock;

12. Open the peripheral's clock.

But how can I know these procedures from the reference manual or the datasheet?

#stm32 #clock-configuration #reply
    This topic has been closed for replies.
    Best answer by nesrine
    Posted on July 14, 2015 at 11:51

    Hello,

    1) In the section Reset and clock control (RCC) in any reference manual of STM32 products you can find details about clocks settings.

    2) If you are using HAL, I would suggest you to use CUBEMX tool which has ''clock diagram'' where you can configure the clock easily. 

    3) If you are using standard library you can use clock configuration tool: 

    For example if you are using STM32F40X/41x microcontrollers you can have more information about the clock configuration tools (downloads and settings) via this

    http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1533/PF257927

    I hope this helps,

    Syrine.

    2 replies

    nesrine
    nesrineBest answer
    Visitor II
    July 14, 2015
    Posted on July 14, 2015 at 11:51

    Hello,

    1) In the section Reset and clock control (RCC) in any reference manual of STM32 products you can find details about clocks settings.

    2) If you are using HAL, I would suggest you to use CUBEMX tool which has ''clock diagram'' where you can configure the clock easily. 

    3) If you are using standard library you can use clock configuration tool: 

    For example if you are using STM32F40X/41x microcontrollers you can have more information about the clock configuration tools (downloads and settings) via this

    http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1533/PF257927

    I hope this helps,

    Syrine.

    Yihao Guo
    Yihao GuoAuthor
    Associate II
    July 18, 2015
    Posted on July 18, 2015 at 03:18

    Thank you very much!