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.

Open:
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.

From Arduino to ARM Cortex M4 (STM32F407 Discovery)

on Wednesday, February 12, 2014
My EEG acquisition project needs more communication channels, processing muscle, speed than the Arduino can offer*. I decided to take this chance to explore the ARM Cortex M4 which is top of the line for MCU. I will never worry about the limitation of the microcontroller again. But, I started to worry about my knowledge to work with it.


In Arduino world, people speak the same language. We use the same IDE, quite similar libraries and boards. The assumption for most documentations, tutorials is that they are for beginners. It's easy to get started and do amazing things in hours! On the other hands, I learn do small projects with STM32 in couples of days or maybe...a week. People use many different IDE (Keil, IAR, Eclipse, Coocox...). Some guru write their own libraries; some use the STM standard peripheral library. Every generation of STM32 (F1,F3,F4). uses different standard libraries. You may find that the F1 library comes with more beginner examples (ex: simple SPI) while the F4 library comes with more complex examples (ex: DMA SPI). I recommend you take a look at F1 library although you work with F4 only because it comes with sample code.

 So far, I enjoy learning STM32F4 in a hard way. It's tough to navigate in its 1700+ reference manual. Once you got the hang of it, you will learn a lot about low level configuration and execution. It's the great thing compare to arduino. *Some other similar systems still use Arduino. For example: OpenBCI uses Arduino for there 8 channels system. They switch to a 16-bit system for the 16 channels version.