STM32 Getting Started

Publisher:古宝奇缘Latest update time:2016-12-30 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  1. Install the MDK environment and download the third-party software mcuisp of the program.

       Turn the BOOT0 switch to VCC, automatically search the serial port, and start programming. If the program is downloaded successfully, the information in the red box below will be printed out. After the program is downloaded successfully, you need to
turn the BOOT0 switch to GND, and then press our reset button to see the experimental imagination (you can also set it as follows).

       When you start programming the button, the MCUISP will be in a connected state, which will cause the program to fail to download, as shown in the screenshot below. The solution is to just press the reset button on the development board.

   2. Online debugger, JLINK driver installation and MDK environment construction.

   3. How to create a new project template.

     Create a new project, select the chip model, and the next window asks us whether we need to copy the STM32 startup code to the project file. This startup code is applicable to the M3 series. Generally, we click Yes, but we are using the ST library here, and the library file also comes with this startup code. So in order to maintain the integrity of the library, we do not need the startup code that comes with the development environment.

   Create five subfolders in the folder: FWlib (for storing STM32 library files), CMSIS (ARM_C processor software interface), output (for saving files output after software compilation), Listing (for storing some files generated during the compilation process), and USER (for storing project files and user code).
     main.c, stm32f10x_conf.h, stm32f10x_it.h, stm32f10x_it.c, system_stm32f10x.c to the \USER directory. The two files stm32f10x_it.h and stm32f10x_it.c contain interrupt functions, which are empty and do not contain any interrupt service routines. stm32f10x_conf.h is a header file that users need to configure. When we need to use the driver of a certain peripheral in the chip, we only need to include the header file of the driver in this file. The driver of the on-chip peripherals is in the src folder, and the inc folder contains their header files. These three files are files that users need to modify when programming, and other library files generally do not need to be modified. system_stm32f10x.c is a library file that complies with the CMSIS standard provided by ARM. We will move this file to the \CMSIS folder later.

     You need to create a startup folder in CMSIS first to store these startup files written in assembly. Copy core_cm3.c and core_cm3.h to the \CMSIS folder. Copy stm32f10x.h, system_stm32f10x.c, and system_stm32f10x.h to the \CMSIS folder. (These are all STM32 library functions, startup codes, etc.)

     Basically done, right-click the project name to open the "Manage Components" window, or click the "Product" icon on the toolbar. Rename the Target under Project Targets to what you want.

     Then we need to create user groups. Right-click and select Add Group... to create the four user groups we need.

     Next, add files to each user group.

     Finally, set up the software: The project has been basically built. Now let's configure the MDK configuration options. Click the magic wand button in the toolbar and select Output in the pop-up window. Then click Select Folder for Objects... to set the location where the compiled output file will be saved. At the same time, check the Create HEX File and Browse information options. (The path folder we set before)

    Select the "C++" tab, and enter "use_stdperiph_driver,stm3210x_hd" in define. add use_stdperiph_driver is to shield the default search path of the compiler, and use the st library we added to the project instead. add stm32f10x_hd because the chip we use is large capacity. after adding the stm32f10x_hd macro, we can use the registers defined for large capacity in the library file. add use_stdperiph_driver is to shield the default search path of the compiler, and use the st library we added to the project instead. add stm32f10x_hd because the chip we use is large capacity. after adding the stm32f10x_hd macro, we can use the registers defined for large capacity in the library file.

    Click on the Include Paths column and add the search path for library files here, so that the default search path can be blocked. But when the compiler cannot find the path we specify, it will still return to the standard directory to search, just like some ANSI C library files, such as stdin.h and stdio.h. But when the compiler cannot find the path we specify, it will still return to the standard directory to search, just like some ANSI C library files, such as stdin.h and stdio.h.

      

 

The last step is to modify the main.c file.

   #include "stm32f10x.h"   

    int main(void)    
 {    
 while(1);    
 // add your code here ^_^。    
 } At this point, our project template is built.


Keywords:STM32 Reference address:STM32 Getting Started

Previous article:Difference between DSP and STM32
Next article:How to use the DSP library provided by STM32 for FFT

Recommended ReadingLatest update time:2024-11-23 19:19

Things to note when using FPU in stm32
In addition to online tutorials, you should also pay special attention to adding an f after the number when there are floating-point numbers in the calculation. For example, 4.321 is involved in the calculation in the expression. When you do not add f after 4.321, the stm32F405 chip does not know whether it will be tr
[Microcontroller]
STM32 learning notes external interrupt experiment
Purpose: When the button is pressed, the LED light of the PF10 pin is turned on. When the button is pressed again, the LED light of the PF10 pin is turned off. Whether it is pressed or not, the LED light of PF9 pin flashes cyclically; Experimental steps: Experimental Procedure: /****************************
[Microcontroller]
STM32 learning notes external interrupt experiment
STM32 input capture mode setting and receiving data using DMA
Reference: STM32 PWM input mode setting and receiving data using DMA Input capture mode The input stage samples the corresponding TIx input to generate a filtered signal TIxF. Then, an edge detector with polarity selection generates a signal (TIxFPx) which can be used as trigger input by the slave mode control
[Microcontroller]
STM32 input capture mode setting and receiving data using DMA
Design and implementation of smart home system based on STM32
Smart home (also known as smart house) is a safe, efficient, comfortable, convenient and environmentally friendly living environment that takes residence as a platform, combines architecture, network communication, information appliances, equipment automation, and integrates systems, structures, services and managemen
[Microcontroller]
Design and implementation of smart home system based on STM32
Based on STM32 serial port ring buffer queue processing mechanism - entry level (single byte)
1.1 Experimental Introduction   The simplest serial port data processing mechanism is to receive data and send it back as is: successfully receive a number, trigger an interrupt, read the data in the interrupt function, and then immediately. This data processing mechanism is a "non-buffered interrupt mode". Althou
[Microcontroller]
Based on STM32 serial port ring buffer queue processing mechanism - entry level (single byte)
STM32 study notes - real-time clock RTC
  //Through this routine, you can learn how to configure RTC and read count values, as well as how to convert numerical formats  . If you want to control it well, you need to read more materials and programs.             #include  "stm32f10x_lib.h"       vu32  TimeDisplay  =  0; ErrorStatus 
[Microcontroller]
A brief discussion on the address mapping of stm32
For the controller, whether it is a single-chip microcomputer series or a plc series, it controls the high and low levels of the pins to control the peripherals. Usually we use various languages ​​to write control statements, which are similar to assembly and high-level languages. In the early stages of learning 51 si
[Microcontroller]
A brief discussion on the address mapping of stm32
Design and implementation of a portable physical examination device based on STM32
my country is vigorously promoting the construction of a well-off society in an all-round way, and the community health care system is one of the key points. The community medical insurance system in foreign countries is already quite mature, while my country's community health care system is still in its infancy. The
[Microcontroller]
Design and implementation of a portable physical examination device based on STM32
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号