Study Materials
Video Tutorial
Li Xiang stm32 video tutorial 49 episodes http://pan.baidu.com/s/1kTyt03P
Atom teaches you how to use STM32 http://pan.baidu.com/s/1gd25r6F
Liu Yang STM32 (good) http://pan.baidu.com/s/1mgkeNsG
http://www.iqiyi.com/u/1005856393 http://yun.baidu.com/share/home?uk=2853967793 http://www.zxkjmcu.com/
Reference Documentation
STM32 Function Description (Chinese).pdf http://download.csdn.net/detail/leytton/7630851
STM32 library function LED light example source code.zip http://download.csdn.net/detail/leytton/7630863
STM32F10x Microcontroller Reference Manual (10th Edition, December 2009).pdf http://download.csdn.net/detail/leytton/7668435
Development board information
http://download.csdn.net/detail/leytton/7732219
Puzhong Technology MCU Development Board STM32 Circuit Diagram (Schematic Diagram).pdf http://download.csdn.net/detail/leytton/7732229
STM32 program download wiring diagram
Note:
1. If the program cannot be downloaded automatically, you can download the program by manually resetting it. The button operation method is: press and
hold the RSK button and press ISPK with another finger, then release the RSTK button first and then release the ISPK button. After completion, click
the "Download" button of the download software to complete the program download.
2. After the download is complete, disconnect the short-circuit cap BOTT1 so that some programs can run normally.
3. If the program does not run after downloading, you can try pressing the RSTK key on the ARM (Leytton: discovered by accident)
Tips: When programming library functions, compilation is slow. ReBuild will compile all files in the entire project. If you have only modified one file, just click Build (F7) to compile again. This will only compile the current file and the speed will be very fast.
GPIO port corresponding pins
Main function source code explanation
/*******************************************************************************
*
* Software function: GPIO flashing light experiment (software delay mode)
*
*******************************************************************************/
#include "stm32f10x.h"
#include
#include "delay.h"
/*************************************************
函数: void RCC_Configuration(void)
Function: Reset and clock control Configuration
Parameters: None
Returns: None
**************************************************/
void RCC_Configuration(void)
{
ErrorStatus HSEStartUpStatus; //Define the external high-speed crystal startup status enumeration variable
RCC_DeInit(); //Reset RCC external device registers to default values
RCC_HSEConfig(RCC_HSE_ON); //Turn on the external high-speed crystal oscillator
HSEStartUpStatus = RCC_WaitForHSEStartUp(); //Wait for the external high-speed clock to be ready
if(HSEStartUpStatus == SUCCESS) //The external high-speed clock is ready
{
FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable); // Enable the FLASH pre-read buffer function to speed up the reading of FLASH. Required usage in all programs. Location: in the RCC initialization sub-function, after the clock starts
FLASH_SetLatency(FLASH_Latency_2); //Flash operation delay
RCC_HCLKConfig(RCC_SYSCLK_Div1); //Configure AHB (HCLK) clock equal to == SYSCLK
RCC_PCLK2Config(RCC_HCLK_Div1); //Configure APB2(PCLK2) clock==AHB clock
RCC_PCLK1Config(RCC_HCLK_Div2); //Configure APB1(PCLK1) clock == AHB1/2 clock
RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9); //Configure PLL clock == external high-speed crystal clock * 9 = 72MHz
RCC_PLLCmd(ENABLE); //Enable PLL clock
while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) //Wait for PLL clock to be ready
{
}
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); //Configure system clock = PLL clock
while(RCC_GetSYSCLKSource() != 0x08) //Check if PLL clock is used as system clock
{
}
}
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO, ENABLE); //Enable GPIOB and AFIO clocks
}
/*************************************************
Function: void GPIO_Configuration(void)
Function: GPIO configuration
Parameters: None
Returns: None
**************************************************/
void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure; //Define GPIO initialization structure
/* Configure PE.0,PE.1,PE.2,PE.3,PE.4,PE.5,PE.6,PE.7 as Output push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 ; //Select the GPIO pin to be set. Use the operator "|" to select multiple pins at once GPIO_Pin_0-15 GPIO_Pin_All
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //GPIO_Speed is used to set the speed of the selected pin GPIO_Speed
//GPIO_Speed_10MHz maximum output rate 10MHz; PIO_Speed_2MHz maximum output rate 2MHz; GPIO_Speed_50MHz maximum output rate 50MHz
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //GPIO_Mode is used to set the working state of the selected pin
/*GPIO_Mode_AIN analog input GPIO_Mode_IN_FLOATING floating input
GPIO_Mode_IPD Pull-down input GPIO_Mode_IPU Pull-up input
GPIO_Mode_Out_OD Open-drain output GPIO_Mode_Out_PP Push-pull output
GPIO_Mode_AF_OD Multiplexed open-drain output GPIO_Mode_AF_PP Multiplexed push-pull output*/
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
/*************************************************
Function: int main(void)
Function: main function
Parameters: None
Returns: None
**************************************************/
int main(void)
{
RCC_Configuration();
GPIO_Configuration();
delay_init(72);
while(1)
{
GPIO_SetBits(GPIOB,GPIO_Pin_0); //Set the specified data port bit
delay_ms(500);
GPIO_ResetBits(GPIOB,GPIO_Pin_0); //Clear the specified data port bit
delay_ms(500);
}
}
Previous article:STM32 MCU (2) External interrupt
Next article:Serial port watchdog experiment
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- USB Type-C® and USB Power Delivery: Designed for extended power range and battery-powered systems
- RAQ #223: How to measure and determine soft-start timing without a soft-start equation?
- RAQ #223: How to measure and determine soft-start timing without a soft-start equation?
- GigaDevice's full range of automotive-grade SPI NOR Flash GD25/55 wins ISO 26262 ASIL D functional safety certification
- GigaDevice's full range of automotive-grade SPI NOR Flash GD25/55 wins ISO 26262 ASIL D functional safety certification
- New IsoVu™ Isolated Current Probes: Bringing a New Dimension to Current Measurements
- New IsoVu™ Isolated Current Probes: Bringing a New Dimension to Current Measurements
- Infineon Technologies Launches ModusToolbox™ Motor Kit to Simplify Motor Control Development
- Infineon Technologies Launches ModusToolbox™ Motor Kit to Simplify Motor Control Development
- STMicroelectronics IO-Link Actuator Board Brings Turnkey Reference Design to Industrial Monitoring and Equipment Manufacturers
- EEWORLD University Hall----Texas Instruments field transmitter output interface/fieldbus solution
- Design of Portable Weather Instrument Based on MSP430 Microcontroller
- Linearized Microwave Power Modules for Communications
- Questions about MBR3060
- EEWORLD University ---- Top 5 Simple Electronic projects
- Thank you for being here, thank you EEWORLD Admin-okhxyyo and Orange Kai
- What reference books are useful for beginners?
- Recommended solutions to reduce Wi-Fi interference
- Design of automatic focusing and image acquisition module based on PXA255
- GSM network testing instrument and testing method thereof