Using 12M external crystal oscillator with stm32 under IAR

Publisher:sdlg668Latest update time:2018-08-21 Source: eefocusKeywords:IAR Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The system defaults to using an 8M external crystal oscillator, and three places need to be modified: 

The first step is to open stm32f10x.h and change


define HSE_VALUE ((uint32_t)8000000) /!< Value of the External oscillator in Hz /


change into:


define HSE_VALUE ((uint32_t)12000000) /!< Value of the External oscillator in Hz /


The second step is to open system_stm32f10x.c and modify the PLL parameters.

/*  PLL configuration: PLLCLK = HSE * 9 = 72 MHz */

RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE |

                                    RCC_CFGR_PLLMULL));

RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_HSE | RCC_CFGR_PLLMULL9);

change into: 

/* PLL configuration: PLLCLK = HSE * 6 = 72 MHz */ 

RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE | 

RCC_CFGR_PLLMULL)); 

RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_HSE | RCC_CFGR_PLLMULL6); 

Step 3, use #define SYSCLK_FREQ_72MHz 72000000 

Step 4: Modify the project option 

Write the picture description here 
In Defined symbols, add HSE_VALUE = ((uint32_t)12000000)

Keywords:IAR Reference address:Using 12M external crystal oscillator with stm32 under IAR

Previous article:STM32F407+LWIP
Next article:STM32 changes 12M crystal to 8M crystal oscillator, Keil and program settings

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号