Getting started with STM32F4 Discovery and Keil C 5 Tutorial

on Friday, February 14, 2014
Here is a very good detail review about STM32F407 Discovery. It goes through all the capabilities of the STM32 family, components of the board, compiler consideration. I choose Keil as my compiler; I see many others use Coocox and GCC.

You should download and read the UM1472 - User manual - Discovery kit for STM32F407/417 lines. Read from the beginning, go through the Quick Start, Hardware Layout. It shows you how to test the board with pre-programmed code. Carefully read the ST-Link/V2 section, you will need it later. And don't forget to pay attention on some warning led, indication for overcurrent. Now you can plug the board to a USB port and follow through the Quick Start.

Next step, we will install STM32F407 Discovery Driver on a Win 7 machine. 
1. Download and install STM32 - ST Link Utility (STSW-LINK004).
2. Plug the board in the computer. If your computer recognizes the board, drivers were installed successfully. If not, go to step 3.
3. A wrong driver was installed. You need to remove it to give the way for the correct driver. Go to Computer>Manage devices> Remove the Pre-installed ST Link driver ( Google how to do it).
4. Unplug the boad > Then plug it in a gain > Done!

It's time to install the toolchain for Keil

1. Download and install Keil. The 4.7 version will have the STM32F4 Discovery Board example

2. If you install Keil 4.7 => Skip to Step 3. Keil 4.7 comes with pre-install STM devices and examples. If you install Keil 5, then install STMicroelectronics STM32F4 Series Device Support, Drivers and Examples  ( look for stm32f4 library with example pack)

3. Open windows explore, open the project at

4. Uncheck blinky folder property read only tick. Default property is read only to protect the file. Uncheck it for keil C to create axf file.

5. Open Keil, then open the example project (Blinky.uvproj) => Build all => Download
You should see 4 Leds are blinking at the same time.

You should check out this video tutorial on how to set up Discovery for Keil C. It used Keil 4.7; if you don't have 4.7, things may be very different as I experienced. To set up a Keil C project from stratch, you must read this application note. It's also a Keil C 101.


Post a Comment