当前位置:网站首页>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);
}
}
边栏推荐
- Use "recombined netlist" to automatically activate eco "APR netlist"
- Vscode is added to the right-click function menu
- 6.Dropout应用
- Ag9311maq design 100W USB type C docking station data | ag9311maq is used for 100W USB type C to HDMI with PD fast charging +u3+sd/cf docking station scheme description
- Two methods for full screen adaptation of background pictures, background size: cover; Or (background size: 100% 100%;)
- Recommend a document management tool Zotero | with tutorials and learning paths
- 2. Nonlinear regression
- Su embedded training - Day5
- 10.CNN应用于手写数字识别
- C# ?,?.,?? .....
猜你喜欢
Recommend a document management tool Zotero | with tutorials and learning paths
Chapter VIII integrated learning
USB type-C mobile phone projection scheme | USB type-C docking station scheme | TV / projector type-C converter scheme | ag9300ag9310ag9320
利用GPU训练网络模型
High quality USB sound card / audio chip sss1700 | sss1700 design 96 kHz 24 bit sampling rate USB headset microphone scheme | sss1700 Chinese design scheme explanation
Common effects of line chart
For the first time in China, three Tsinghua Yaoban undergraduates won the stoc best student thesis award
Basic implementation of pie chart
General configuration title
Two methods for full screen adaptation of background pictures, background size: cover; Or (background size: 100% 100%;)
随机推荐
130. Zones environnantes
2. Nonlinear regression
Serial port receives a packet of data
Complete model verification (test, demo) routine
13. Model saving and loading
Authorization code of Axure rp9
Macro definition and multiple parameters
Ag9310 for type-C docking station scheme circuit design method | ag9310 for type-C audio and video converter scheme circuit design reference
1.线性回归
General configuration tooltip
Apt get error
Leetcode notes No.21
Study notes of single chip microcomputer and embedded system
Generic configuration legend
Measure the voltage with analog input (taking Arduino as an example, the range is about 1KV)
Two methods for full screen adaptation of background pictures, background size: cover; Or (background size: 100% 100%;)
General configuration toolbox
New library online | cnopendata China Star Hotel data
Kuntai ch7511b scheme design | ch7511b design EDP to LVDS data | pin to pin replaces ch7511b circuit design
From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run