当前位置:网站首页>Blue Bridge Cup embedded (F103) -1 STM32 clock operation and led operation method
Blue Bridge Cup embedded (F103) -1 STM32 clock operation and led operation method
2022-07-08 01:18:00 【Youyu hesitant squid】
Blue Bridge Cup (F103)-1.STM32 Clock operation and LED Operation method
One 、STM32 Clock introduction
1. file location :
Open the resource packet → open 5- Competition board chip information → open STM32_CN.pdf
2. Introduction of clock tree (P56 Clock block diagram )
HSE OSC High speed external clock signal , In the Blue Bridge Cup F103rbt6 Develop on-board external crystal oscillator HSE=8MHz, Then a selector can choose 8MHz Or frequency division /2 by 4MHz, We choose 8MHz, Through the frequency multiplier , Frequency multiplier selection ×9 Make it work at the maximum output frequency 72MHz. Last pass AHB Prescaler output to peripheral .APB1 The maximum is 36MHz,APB2 The maximum is 72MHz.
3. Introduction of system structure (P25 System structure )
Mainly understand reset and clock control (RCC) Connect AHB The system bus , The bridge 1 by APB2, From the above ,APB2 For high frequency , The maximum clock frequency is 72MHz. The bridge 2 by APB1, For low frequency , The maximum clock frequency is 36Hz.
Mainly understand APB1( low speed ) and APB2( High speed ) Attached to APB equipment , Common peripherals are as follows :
APB1:I2C1,I2C2,UART4,UART5,SPI2,SPI3,RTC,TIM2~TIM7
APB2;ADC 1~3,USART1,SPI1,TIM1,TIM8,GPIO A ~ G,EXT1,AFIO
4. Turn on the peripheral clock with the library function
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);// Turn on GPIOC Peripheral clock
Two 、LED Operation method
1.LED initialization
Procedure steps :
LED initialization : Turn on the peripheral clock → Structure initialization → initialization GPIO
The code is as follows :
void LED_Init(void)
{
GPIO_InitTypeDef GPIO_structure;// Declared structure
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);/ Turn on the peripheral clock
GPIO_structure.GPIO_Pin = GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|
GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;// Initialization pin
GPIO_structure.GPIO_Speed = GPIO_Speed_50MHz;// Initialize settings GPIO output frequency
GPIO_structure.GPIO_Mode = GPIO_Mode_Out_PP;// Initialize settings GPIO Pattern
GPIO_Init(GPIOC,&GPIO_structure);//GPIO initialization
}
2. Schematic diagram interpretation
(1)LED The circuit principle diagram
explain :LED Adopt common anode connection , Output low level is on LED.
Latch M74HC573:
Function explanation :
According to the function description in the data book ,OE(Output Enable) Low power level , Output enable , In the circuit schematic diagram OE The terminal is directly grounded ,74HC573 Always in the enabled state .LE(Latch Enable) For high voltage ,D And Q Also for H or L.
Be careful :
The left and right sides are connected through jumper caps , And STM32 Pin to pin
3. Realize the running water lamp
Procedure steps :
Running water lamp : Lighten up 1 individual LED→ Define an array → Use circulation to make LED Turn on .
The code is as follows :
void LED_contorl(void)
{
u16 LED_ctrl;
u8 LED_locate;
u16 LED_code[8]={
0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
for(LED_locate=0;LED_locate<8;LED_locate++)
{
LED_ctrl=LED_code[LED_locate];
GPIO_ResetBits(GPIOC,LED_ctrl<<8);
Delay_Ms(500);
GPIO_SetBits(GPIOC,LED_ctrl<<8);
}
}
边栏推荐
- New library launched | cnopendata China Time-honored enterprise directory
- Chapter improvement of clock -- multi-purpose signal modulation generation system based on ambient optical signal detection and custom signal rules
- Su embedded training - Day9
- 4、策略學習
- Marubeni official website applet configuration tutorial is coming (with detailed steps)
- Know how to get the traffic password
- 4、策略学习
- Y59. Chapter III kubernetes from entry to proficiency - continuous integration and deployment (III, II)
- 2.非线性回归
- AI遮天传 ML-初识决策树
猜你喜欢
Design method and reference circuit of type C to hdmi+ PD + BB + usb3.1 hub (rj45/cf/tf/ sd/ multi port usb3.1 type-A) multifunctional expansion dock
Cs5261type-c to HDMI alternative ag9310 | ag9310 alternative
Common configurations in rectangular coordinate system
How to transfer Netease cloud music /qq music to Apple Music
What does interface testing test?
Capstone/cs5210 chip | cs5210 design scheme | cs5210 design data
6.Dropout应用
Arm bare metal
9.卷积神经网络介绍
Generic configuration legend
随机推荐
4、策略學習
The combination of relay and led small night light realizes the control of small night light cycle on and off
Saving and reading of network model
Definition and classification of energy
133. Clone map
Fundamentals - integrating third-party technology
From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run
How to write mark down on vscode
Ag9310 same function alternative | cs5261 replaces ag9310type-c to HDMI single switch screen alternative | low BOM replaces ag9310 design
8. Optimizer
Prediction of the victory or defeat of the League of heroes -- simple KFC Colonel
5.过拟合,dropout,正则化
Recommend a document management tool mendely Reference Manager
[note] common combined filter circuit
Know how to get the traffic password
String usage in C #
Arm bare metal
Chapter IV decision tree
A speed Limited large file transmission tool for every major network disk
New library online | cnopendata China Star Hotel data