Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 2.73 KB

File metadata and controls

31 lines (20 loc) · 2.73 KB

STM32F429 Blink Lights Using HAL and FreeRTOS

This example was written for the STM32F429 development board. It originally came in the STM32 Cube Firmware v1.18.0 however, I've added a makefile so that it can easily be built without an IDE (see directions below). I've also removed the dependency on the board support package (BSP) and instead communicate directly with the HAL. Although this is a simple program - it just blinks LEDs on the board periodically - its importance is that it shows how to use FreeRTOS with multiple threads in an STM32 project.

 

Foreword

I currently (Winter 2018) use Windows as my main development machine, however, I'm fairly certain the following build steps can be done using a typical Linux distro (with a few minor tweaks) and quite possibly MacOS as well.

 

Prerequisites

  1. An STMF32F429 development board. Currently they can be ordered from the usual sites for around $30 USD plus shipping.
  2. Download and install the GNU Arm Embedded Toolchain
  3. Download and install GNU Make for Windows
  4. Download and install the STM32 ST-Link Utility.
  5. Download and uncompress STM32 Cube Firmware (I'm using v1.18.0)

 

Compiling and Flashing the Program to the Dev Board

  1. Open a GCC Command Prompt. Note that a "GCC Command Prompt" option was installed when installing the GNU Arm Embedded Toolchain and should be available from the Windows Start Menu.
  2. Change to the BlinkLightsHALAndFreeRTOS directory and run "make STM32CubeDir=LocationOfSTM32Cube" subsituting in the location of STM32Cube Firmware package on your machine. This will compile the program into a bin file.
  3. Open the STM32 ST-Link Utility and select "Program" from the "Target" pulldown menu.
  4. Navigate to the BlinkLightsHALAndFreeRTOS directory and select main.bin.
  5. Click "Start" to flash main.bin to the development board. After this is done you should see both of the LEDs blink in differing intervals. See the code in main.c. Each LED is controlled from a separate FreeRTOS thread.