STM32F407 discovery board IDE/STM32F407 discovery Keil MDK
STM32F407 discovery Keilinstallation and setup
IDE (Integrated Development Environment) is an application program used to provide a program development environment, generally including code editors, compilers, debuggers, and graphical user interfaces. It integrates code writing, analysis , compilation, debugging and other functions integrated development software service suite. This article introduces the development environment building of the STM32 F407 discovery.
There is an optional STM32F407 discovery board IDE/development environment written on the back of the STM32F407 Discovery Kit you purchased. What we introduce here is to use Keil.
Keil is a paid software, and STM32 development board should choose the Keil MDK version. First, you need to find a Keil online. Here we use the Keil MDK 5.2.0 version. After the download is complete, there is such an installation package:
Double-click Keil MDK 520 installation package to open it and install it. If it needs admin rights, give it admin rights. There will be some prompts to install the driver, click OK.
Generally speaking, just click Open and continue to the next step without any additional operations. After the installation is complete, there will be an icon like this on the desktop, which is the software we just installed:
After opening, the software interface is as follows:
We can change the indentation of the code like this. Open STM32F407 discovery Keil ‘s settings here:
After the operation, you will see this dialog box, set the place where the red frame is drawn:
Go back to our main interface and open the package management here:
As you can see, there is no STM32F407 model under our “All Devices”. Therefore, you need to download the STM32F4 package about keil (named “Keil.STM32F4xx_DFP.2.13.0.pack”), and add it in this location of the package manager (that is, select the file you downloaded to open):
Wait for the blue progress in the lower right corner to end, and our package will be added. After adding it should look like this:
Configuration STM32F407 discovery board projects file
The next step is to configure the STM32F407 discovery board projects file. This step is more complicated. We will configure the template project, and you can directly download and use it. Unzip the template you downloaded into a folder:
Open it with STM32F407 discovery Keil, after opening, there is a high probability that you will see this prompt:
This prompt does not affect our use, it is caused by version problems. Pay attention to the output window marked in red, scroll up, and notice this message:
This is the reason for the warning. The solution is very simple, just delete the error.
First, open the file where the red line is drawn. According to the prompt, its location (that is, the paragraph before the last ‘\’) is:
C:\Program Files (x86)\Keil5\ARM\PACK\Keil\STM32F4xx_DFP\2.13.0\
Note that the location of the file varies from PC to PC, please follow your prompt information.
Open this location and enter the address at the top of the explorer:
Then we should be able to see this file:
Open it with Notepad, then find the part that prompts in Message, and delete them:
Re-open our STM32F407 discovery board projects file, at this point, the annoying warning should be gone, it looks like this:
The main.c in the red box is the entry point of our main program, and the int main function is there. The blue one is called the code group, which acts as a group.
In this template, the files under Source correspond to the files under the Source folder, the files under HAL correspond to the files under Library, and the files under CMSIS correspond to the files under the CMSIS folder.
If you are new to it, of course you don’t need to care about Library and CMSIS, you just need to know that our program is written in main.c.
Double-click main.c to open:
It can be seen that it is an empty program. We have prepared all the header files in the dark red box that need #include. If you want to write a new c source file in the future, please #include “pch.h” first.
So far, the STM32F407 discovery board projects has been successfully opened.
STM32F407 discovery board projects compile
Next, let’s compile the STM32F407 discovery board projects . This step is very simple:
Simply click the compile button with the left mouse button. Compilation means that the STM32F407 discovery board IDE decides which files to compile by itself, and it will be faster. Recompilation means that all files are compiled and linked. Of course, the first compilation is actually all files participating in compilation and linking. After compiling (it should take a few minutes), you should see below and this means that our code compiled successfully:
Burn the program to the STM32F407 discovery board
Finally, we have to burn the program to the STM32F407 discovery board from ST. We need to do STM32F407 discovery programming on the computer, and then download it to the STM32F407 discovery kit through the downloader.
Step 1: Connect your STM32F407 discovery board to the computer.
Step 2: Download the ST-LINK STM32F407 discovery board driver.
Generally, there is no such STM32F407 discovery board driver on our computer. If it is not installed, STM32F407 discovery Keil cannot recognize it. You can go to ST official website to download. Unzip it all to a folder (be sure to unzip it all, don’t just open it in the compressed package), generally our computer is 64-bit, so double-click the left mouse button to run this:
The installation process is still to agree to the license agreement and then continue to the next step. If a confirmation dialog box pops up halfway, click OK.
Then, turn off STM32F407 discovery Keil and turn it back on again. In the same way, open our template project and operate as follows:
Then we select ST-LINK, after the selection is complete, click “Settings” on the side:
If you see something similar to the following, it means that everything is normal, we can download the program, and even debug the program:
Step 3: Download the program
The download procedure is very simple, just click the button in the red box with the left mouse button:
If the download is complete, you will see:
This shows that our program has been downloaded successfully. Then, press the reset button of the STM32F407 discovery development board. Here we experiment with a program that turns on an LED light.
STM32F407 discovery LEDs lighting program
Let’s test a program that turns on STM32F407 discovery LEDs light, you can put it in the main function:
If you don’t know how to put it, look at the picture below
Then, compile first, and then download (see the picture above if you don’t know how to operate). Finally, press the reset button of the STM32F407 discovery board, did you see a light on the STM32F407 discovery board light up?
STM32F407 discovery board buy online
Our STM32F407 discovery board from st is a genuine development board product with stable and reliable quality, and its information is very rich and complete. The Keil MDK and Keil.STM32F4xx_DFP.2.13.0.pack mentioned in this article, template project files, ST-LINK STM32F407 discovery board driver and more development board routines we will provide all.
There are also STM32F407 discovery schematic pdf, STM32F407 discovery kit user manual, STM32F407 discovery board tutorial, STM32F407 discovery board examples, STM32F407 discovery board projects, etc. After you purchase, we will organize and send them to you for your development board Programming helps.
You are welcome to click our homepage to view more kinds of development boards, and communicate with us about STM32F407 discovery kit price, STM32F407 discovery kit datasheet and more details.