STM32 RCC experiment MCO pin output clock waveform

Publisher:ZhenxiangLatest update time:2016-10-10 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1: RCC setting uses internal HSI clock, SYSclk 64M MCO output 32M
1:
void RCC_Configuration(void)
{
  ErrorStatus HSEStartUpStatus;  
  /* RCC system reset(for debug purpose) */
  RCC_DeInit(); //??RCC?????÷?is?????±????
 
  /* Enable HSE */
  //RCC_HSEConfig(RCC_HSE_ON);    //?è???????????§??
RCC_HSEConfig(RCC_HSE_OFF);
RCC_HSICmd(ENABLE);                        //??????
  //RCC_HSICmd(DISABLE);                        //??????
  /* Wait till HSE is ready */     //HSE  ?????????§??
  //HSEStartUpStatus = RCC_WaitForHSEStartUp();       //????HSE????
 
       while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET)        
        {        
        }
 
 // if(HSEStartUpStatus == SUCCESS)
//  {
    /* HCLK = SYSCLK *///?è??AHB?±??=???????±?? ?¨RCC_SYSCLK_Div1??·?????????
    RCC_HCLKConfig(RCC_SYSCLK_Div1);     
  
    /* PCLK2 = HCLK *///?è??????APB2?±??(×??ó72MHZ)
    RCC_PCLK2Config(RCC_HCLK_Div1);    //RCC_HCLK_Div1   ??·?????RCC_HCLK_Div2  2·???
 
    /* PCLK1 = HCLK/2 *///?è??????APB1?±???¨×??ó36MHZ??
    RCC_PCLK1Config(RCC_HCLK_Div2);
 
    /* Flash 2 wait state */
    FLASH_SetLatency(FLASH_Latency_2);
    /* Enable Prefetch Buffer */
    FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
 
    /* PLLCLK = 8MHz * 9 = 72 MHz */
    //RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
 
    //?????±????8/2=4M   4*16 = 64        hsi  =  64m  (MAX)
  RCC_PLLConfig(RCC_PLLSource_HSI_Div2 , RCC_PLLMul_16);
 
 
    /* Enable PLL */ 
    RCC_PLLCmd(ENABLE);
 
    /* Wait till PLL is ready */
    while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
    {
    }
 
    /* Select PLL as system clock source */
    RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
 
    /* Wait till PLL is used as system clock source */
    while(RCC_GetSYSCLKSource() != 0x08)
    {
    }
 // }  
}
 
2: Set MCO pin PA8
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP ;
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;  // ×???????????50MHz
  GPIO_Init(GPIOA, &GPIO_InitStructure);
Note: The A8 pin uses the multiplexed push-pull output mode. When I used the push-pull output, the waveform did not appear. The push-pull output can only output TTL, while the multiplexed push-pull can output the clock waveform.
 
3: Set up MCO mode
RCC_MCOConfig(RCC_MCO_PLLCLK_Div2); //Because the maximum port speed is 50M, PLL frequency division by 2 is required
 
 
2: RCC setting uses external HSE clock, SYSclk 72M MCO output 36M
Just change the RCC settings, and leave the rest unchanged

Keywords:STM32 Reference address:STM32 RCC experiment MCO pin output clock waveform

Previous article:STM32 input capture, infrared decoding, support long press
Next article:STM32 interrupt priority understanding and preemptive priority and slave priority

Recommended ReadingLatest update time:2024-11-23 13:43

Understanding of STM32 pin multiplexing
Take timer 3 in STM32 as an example. The key point is the understanding of Full remap and Partial remap. 1. Pin function diagram. 2. Description of full reuse and partial reuse. 3. Related configuration instructions, clock instructions AFIO and pin multiplexing FullRemap.
[Microcontroller]
Understanding of STM32 pin multiplexing
STM32 uses PWM to control multiple servos
Preface     I've been playing with a 6-DOF robotic arm recently. The core control device of this robotic arm is the six servos that can rotate 180 degrees. I didn't learn how to use servos in a systematic way at school, so I just used the STM32 to write the driver code myself to drive the six servos. Steering gear c
[Microcontroller]
STM32 uses PWM to control multiple servos
STM32+IAP solution realizes network upgrade application firmware
I have been paying attention to this concept for some time. I finally had the opportunity to practice it == Network upgrade application firmware. Here I record the problems encountered and the solutions.  The principle is the same as the serial port as a transmission method circulated on the Internet; the only differe
[Microcontroller]
STM32+IAP solution realizes network upgrade application firmware
STM32 drives ESP8266 to connect to Alibaba Cloud (2) ---- Connect to Alibaba IoT Studio to realize Web visualization
Burn MQTT firmware Overview Alibaba IoT Studio is an IoT development platform that can be used to quickly build cloud-based IoT applications. It provides a wealth of IoT components and tools, allowing developers to easily perform operations such as device access, data storage, and data analysis. To achieve
[Microcontroller]
STM32 drives ESP8266 to connect to Alibaba Cloud (2) ---- Connect to Alibaba IoT Studio to realize Web visualization
STM32 firmware library description
Version: v2.0.3 l Release time: 09/22/2008 l Function: : Provides driver functions for all peripherals on the STM32 microcontroller chip, allowing users to spend more time on application development to speed up product time to market. (In essence, it defines the parameter configuration of various registers as macros
[Microcontroller]
STM32 firmware library description
Common library functions for STM32 MCU
1.GPIO initialization function usage: voidGPIO_Configuration(void) { GPIO_InitTypeDefGPIO_InitStructure; //GPIO status restores default parameters GPIO_InitStructure.GPIO_Pin=GPIO_Pin_label|GPIO_Pin_label; //Pin position definition, the label can be NONE, ALL, 0 to 15. GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
[Microcontroller]
Design of electric vehicle battery management system based on STM32 and CAN bus
 With the widespread application of battery energy, the depletion of oil resources and environmental pollution, electric vehicles have attracted more and more attention for their advantages of energy saving and environmental protection. In the research and development of electric vehicles, the research and manufacture
[Power Management]
Design of electric vehicle battery management system based on STM32 and CAN bus
STM32 library function assertion
When we learn STM32, the function assert_param is very likely to appear. If you search online, you will find that the assertion mechanism is generally explained online and is used during the program development and debugging stage. Next, I will talk about my views on these applications. When learning something, you sho
[Microcontroller]
STM32 library function assertion
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号