STM32F103 LL Tutorial 1 – Software Tools Installation

STM32 LL Library

STM32 Low Level (LL) library is a new library for programming the STM32 series. The LL library offering a fast light-weight expert-oriented layer which is closer to hardware than the Hardware Abstraction Layer (HAL) library. The LL and HAL are complementary and cover a wide range of applications requirements. You can mix LL code with HAL code. You can select how each peripheral will be handled, i.e. with LL or HAL. For example, you can use LL for light-weight peripherals such as GPIO or UART, and use HAL for peripherals that need heavy software configuration such as USB or Ethernet. The LL library can also be used in standalone mode (without HAL library). The LL library works by writing directly into the peripheral registers, therefore the code is more efficient and compact. The LL library replaces the Standard Peripheral (SPL) library, which has been discontinued by ST. On the other hand, the HAL library is less efficient than the LL library, but allows easy code migration between various STM32 series. Both of the LL and HAL can be generated by using STM32CubeMX.

STM32CubeMX

STM32F103

STM32F103 is an STMicroelectronics’s 32-bit microcontroller based on the ARM Cortex-M3 processor. The processor clock speed is up to 72 MHz. It has 64 Kbytes of flash memory and 20 Kbytes of SRAM. There are several development boards for this microcontroller available on the market. In this tutorial, I will use the STM32 “Blue Pill” development board, as shown in the following figure. It has 40 pins that fits into a breadboard. It has 2× 12-bit ADCs, 7× timers, and Up to 9 communication interfaces (3× USART, 2× I2C, 2× SPI, 1× CAN, 1× USB).

STM32F103

Software Tools Installation

To develop a program for STM32F103 using LL, you need several software tools. The list of the software tools is described as the following. These software can be downloaded from ST and Keil official website.

  • Java SE Runtime Environment (jre-8u121-windows-x64.exe) version 8u121 or later, this software is required for installing the STM32CubeMX.
  • STM32CubeMX (en.stm32cubemx.zip) version 4.26.1 or later, this software is used for generating the STM32 initialization code.
  • STM32CubeF1 (en.stm32cubef1.zip) version 1.6.0 or later, this file contains the LL and HAL library for the STM32F1 family.
  • STSW-LINK009 (en.stsw-link009.zip) version 2.0.0 or later, this software is the USB driver for ST-LINK, ST-LINK/V2, and ST-LINK/V2-1 programmer.
  • Keil MDK 5 IDE (MDK523.EXE) version 5.23 or later, this software is the IDE for programming the STM32.
  • Keil MDK 5 Legacy Support (MDKCM523.EXE) version 5.23 or later, this software is used for backward compatibility with MDK 4 and older devices.
  • Keil MDK 5 Software Packs (Keil.STM32F1xx_DFP.2.2.0.pack) version 2.2.0 or later, this file contains additional software components and support for STM32F1 family.

Software tools

The installation process starts with Java SE Runtime Environment. If Java is already installed on your computer, then you can skip this process. After that, install STM32CubeMX followed by installing STM32CubeF1 library. The step-by-step how to install the STM32CubeMX and STM32CubeF1 library is described as the following:

  • Extract and run the STM32CubeMX installer file.
  • Follow the installation process, and select the installation path.

CubeMX installation path

  • Wait until the installation process completed.
  • Run the STM32CubeMX software, and go to Help → Manage Embedded Software Packages menu.
  • In Embedded Software Packages Manager window, click From Local… button, and select the STM32CubeF1 library.

STM32CubeF1

  • Wait until the installation process completed.

After the STM32CubeMX and STM32CubeF1 library are installed, the next step is to install Keil MDK 5 IDE, Legacy Support, and Software Packs. The step-by-step how to install the Keil MDK 5 IDE, Legacy Support, and Software Packs is described as the following:

  • Run the Keil MDK 5 IDE installer file.
  • Follow the installation process, and select the destination folders. You can use the default destination folders, or use other folders, but make sure the folders’ name doesn’t contain any space.

Keil destination folder

  • Install device software, and wait until the installation process completed.

Keil driver

  • Run the Keil MDK 5 Legacy Support installer file.
  • Follow the installation process, and select the destination folder. The destination folder must be the same as the IDE destination folder.

Legacy destination folder

  • Wait until the installation process completed.
  • Run the Keil MDK 5 IDE, and click Pack Installer button from toolbar menu.

Pack installer

  • In Pack Installer window, go to File → Import… menu, and select the Keil MDK 5 Software Packs.
  • Wait until the installation process completed.

ST-LINK Programmer

To download the binary code to the STM32, we need a flash programmer. In this tutorial, I will use ST-LINK/V2 programmer, as shown in the following figure. Before we can use this programmer, we should install the USB driver. The step-by-step how to install the USB driver is described as the following:

ST-Link v2

  • Extract the ST-LINK driver.
  • Go to Device Manager, right click on STM32 STLink, and select Update Driver Software… menu.

Driver STLink

  • Select Browse my computer for driver software option, and select the ST-LINK driver’s folder: en.stsw-link009.
  • Install the driver and wait until the installation process completed.

Install driver

In this tutorial, you have learned how to install the software tools that are required for developing STM32 program. In the next tutorial, I will explain how to create the first program.

Go to the part 2 of the tutorial.

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *