Application analysis of various clock systems of STM32
The clock system is the core of the processor, so before learning all the peripherals of STM32, it is necessary to study the clock system carefully, which is helpful for a deep understanding of STM32. Important clocks: The relationship between PLLCLK, SYSCLK, HCKL, PCLK1, PCLK2 should be clarified; 1. HSI: The high-speed internal clock signal STM32 single-chip internal clock (8M frequency) has poor accuracy 2. HSE: High-speed external clock signal source with high precision (1) HSE external crystal/ceramic resonator (crystal oscillator) (2) HSE user external clock 3. LSE: low-speed external crystal 32.768kHz mainly provides an accurate clock source generally used as RTC clock In STM32, there are five clock sources, which are HSI, HSE, LSI, LSE, and PLL. ①, HSI is a high-speed internal clock, RC oscillator, the frequency is 8MHz. ②, HSE is a high-speed external clock, which can be connected to a quartz/ceramic resonator, or an external clock source, with a frequency range of 4MHz~16MHz. ③, LSI is a low-speed internal clock, RC oscillator, the frequency is 40kHz. ④, LSE is a low-speed external clock, connected to a quartz crystal with a frequency of 32.768kHz. ⑤. PLL is a phase-locked loop frequency multiplication output, and its clock input source can be selected as HSI/2, HSE or HSE/2. The frequency multiplier can be selected from 2 to 16 times, but the maximum output frequency should not exceed 72MHz. Among them, the 40kHz LSI is used by the independent watchdog IWDG, and it can also be selected as the clock source of the real-time clock RTC. In addition, the clock source of the real-time clock RTC can also choose LSE, or 128 frequency division of HSE. The clock source of RTC is selected by RTCSEL[1:0]. There is a full-speed capable USB module in STM32, and its serial interface engine requires a clock source with a frequency of 48MHz. The clock source can only be obtained from the PLL output, which can be selected to be divided by 1.5 or 1. That is, when the USB module is required, the PLL must be enabled, and the clock frequency is configured as 48MHz or 72MHz. In addition, STM32 can also select a clock signal to output to the MCO pin (PA8), which can be selected as the PLL output divided by 2, HSI, HSE, or system clock. System clock SYSCLK, which is the clock source for most of the components in STM32. The system clock can be selected as PLL output, HSI or HSE. The maximum frequency of the system clock is 72MHz, which is divided by the AHB frequency divider and sent to each module for use. Among them, the clock output by the AHB frequency divider is sent to the 5 major modules for use: ①, HCLK clock used by AHB bus, core, memory and DMA. ②. The system timer clock sent to Cortex after frequency division by 8. ③. Directly send the idle running clock FCLK to Cortex. ④, to APB1 frequency divider. The APB1 frequency divider can choose 1, 2, 4, 8, 16 frequency division, and its output is used by APB1 peripherals (PCLK1, the maximum frequency is 36MHz), and the other is sent to the timer (TImer) 2, 3, 4 frequency multiplication device use. The frequency multiplier can choose to multiply by 1 or 2, and the clock output is used by timers 2, 3, and 4. ⑤, to APB2 frequency divider. The APB2 frequency divider can select 1, 2, 4, 8, and 16 frequency division, and its output is used by APB2 peripherals (PCLK2, the maximum frequency is 72MHz), and the other is sent to the timer (TImer) 1 frequency multiplier. The frequency multiplier can choose to multiply by 1 or 2, and the clock output is used by timer 1. In addition, the APB2 frequency divider also has an output for the ADC frequency divider, which is sent to the ADC module after frequency division. The ADC divider can be selected to divide by 2, 4, 6, or 8. Among the above clock outputs, many are enabled and controlled, such as AHB bus clock, core clock, various APB1 peripherals, APB2 peripherals, and so on. When you need to use a module, remember to enable the corresponding clock first. It should be noted that the frequency multiplier of the timer, when the APB frequency division is 1, its frequency multiplication value is 1, otherwise its frequency multiplication value is 2. The devices connected to APB1 (low-speed peripheral) are: power interface, backup interface, CAN, USB, I2C1, I2C2, UART2, UART3, SPI2, window watchdog, TImer2, TImer3, Timer4. Note that although the USB module needs a separate 48MHz clock signal, it should not be the clock for the USB module to work, but only for the serial interface engine (SIE). The clock that the USB module works should be provided by APB1. The devices connected to APB2 (high-speed peripherals) are: UART1, SPI1, Timer1, ADC1, ADC2, all common IO ports (PA~PE), and second-function IO ports. Registers involved: The RCC register structure, RCC_TypeDeff, is defined in the file "stm32f10x_map.h" as follows: typedef struct { vu32 CR; //Enable HSI, HSE, CSS, PLL, etc. vu32 CFGR; //Clock source selection of PLL, etc. and frequency division coefficient setting vu32 CIR; // clear/enable clock ready interrupt vu32 APB2RSTR; //APB2 line peripheral reset register vu32 APB1RSTR; //APB1 line peripheral reset register vu32 AHBENR; //DMA, SDIO and other clock enable vu32 APB2ENR; //APB2 line peripheral clock enable vu32 APB1ENR; //APB1 line peripheral clock enable vu32 BDCR; //Backup domain control register vu32CSR; } RCC_TypeDef; You can learn the clock block diagram and RCC register above, have a general understanding of the STM32 clock system, and then learn it together with the system clock configuration function void Stm32_Clock_Init (u8 PLL) in our "STM32 Incomplete Manual". This article refers to the address: http:// [quote]: Enable control of clock output Many of the above clock outputs are enabled and controlled, such as AHB bus clock, core clock, various APB1 peripherals, APB2 peripherals, etc. When a module needs to be used, the corresponding clock must be enabled first. It should be noted that the frequency multiplier of the timer, when the APB frequency division is 1, its frequency multiplication value is 1, otherwise its frequency multiplication value is 2. The devices connected to APB1 (low-speed peripheral) are: power interface, backup interface, CAN, USB, I2C1, I2C2, UART2, UART3, SPI2, window watchdog, Timer2, Timer3, Timer4. Note that although the USB module needs a separate 48MHz clock signal, it should not be the clock for the USB module to work, but only for the serial interface engine (SIE). The clock that the USB module works should be provided by APB1. The devices connected to APB2 (high-speed peripherals) are: GPIO_A-E, USART1, ADC1, ADC2, ADC3, TIM1, TIM8, SPI1, AFIO Using the HSE clock, the program sets the clock parameter flow: 1. Reset the RCC register to the default value RCC_DeInit; 2. Turn on the external high-speed clock crystal oscillator HSERCC_HSEConfig (RCC_HSE_ON); 3. Wait for the external high-speed clock crystal oscillator to work HSEStartUpStatus = RCC_WaitForHSEStartUp(); 4. Set the AHB clock RCC_HCLKConfig; 5. Set the high-speed AHB clock RCC_PCLK2Config; 6. Set the low-speed AHB clock RCC_PCLK1Config; 7. Set PLLRCC_PLLConfig; 8. Open PLLRCC_PLLCmd(ENABLE); 9. Wait for PLL to work while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) 10. Set the system clock RCC_SYSCLKConfig; 11. Determine whether the PLL is the system clock while (RCC_GetSYSCLKSource() != 0x08) 12. Open the peripheral clock to be used RCC_APB2PeriphClockCmd()/RCC_APB1PeriphClockCmd() The following is the configuration function for RCC in the program of the STM32 software firmware library (using an external 8MHz crystal oscillator) void RCC_Configuration(void) { RCC_DeInit(); RCC_HSEConfig(RCC_HSE_ON);//RCC_HSE_ON——HSE crystal oscillator is turned on (ON) HSEStartUpStatus = RCC_WaitForHSEStartUp(); if (HSEStartUpStatus == SUCCESS) //SUCCESS: HSE crystal oscillator is stable and ready { RCC_HCLKConfig(RCC_SYSCLK_Div1);//RCC_SYSCLK_Div1——AHB clock = system clock RCC_PCLK2Config(RCC_HCLK_Div1); //RCC_HCLK_Div1 -- APB2 clock = HCLK RCC_PCLK1Config(RCC_HCLK_Div2); //RCC_HCLK_Div2 -- APB1 clock = HCLK/2 FLASH_SetLatency(FLASH_Late
Shenzhen WeiKa Technology Co.,Ltd. is a professional e-cigarette manufacturer and enterprise integrating R&D, design, production and sales and service of the electronic cigarette atomizer products, established in 2020.
We are actively developing and producing all kinds of reliable and unique atomizer products. We centre on research, developing, high quality and safety, and focus on better vaping experience in all aspects to our customers. We have advanced production equipment and strict production control system, each process has strict management, from production to delivery have been strictly tested to ensure the classic quality. Zgarvape for the future!
Aurora E-cigarette Cartridge is loved by the majority of consumers for its gorgeous and changeable colors, especially at night or in the dark. Fruits Flavors series, plant flavors series & special flavors series.Up to 16 different flavors for choices. A new design of gradient our disposable vape is impressive. Our vape pen and pods are matched with all the brands on the market. You can use other brand's vape pen with our vape pods. Aurora series Pods systems, the first choice for professional users!
16 Available Flavors (3Pods*2ml):
Amazing Cantaloupe / Coke on the Rocks / Ice Coconut / Ice Lolly / Iced Mung Bean / Longjing Tea / Mango Feast / Mountain Spring / Peach Tempting / Pineapple Juice / Refreshing Melon / Refreshing Mint / Rich Strawberry / Rose Litchi / The Ocean / Watermelon Juice
Aurora Pods 1.0,Pod System Vape,Pos Systems Touch Screen,Empty Disposable Vape Pod System,400Puffs Pod Vape System ZGAR INTERNATIONAL(HK)CO., LIMITED , https://www.zgarvape.com
Aurora Disposable Vape Device Vaping Pod Systems