Saturday, February 22, 2020

3. Setting System Clock Frequency (Excel Utility)

    In this example, I am using Excel Utility

Steps:
    1. After creating any project with Atollic TrueStudio, the HSE value is automatically set to 25   
          MHz, which is not correct. First, we have to edit it to 8 MHz. For that go to stm32f4xx.h and
          find HSE_VALUE. Change there the value to 8000000.


     2. Open the Excel File

    Here we can see HSE value is 8 (i.e. 8 MHz), we always have to use this value. stm32f4 Discovery
   Board have external Oscillator whose frequency is 8 MHz. Our Discovery have highest frequency
   of 168 MHz. We can choose here our own frequency. In my Example I'm setting the value to 48 
   MHz.

    3. Enter HCLK frequency value

    4. Click on Run and choose PLL(HSE) as source clock and then click on OK.


    5. Click on Generate. A file (system_stm32f4xx.c) in the same folder with new clock frequency
        will be generated.


    6. Copy that file. Then go to your project on Atollic TrueStudio. Replace there the 
        file system_stm32f4xx.c with new one we have generated.


    Ready to Go :)

No comments:

Post a Comment