Tutorials For STM32F103RB: Nicolas Barbot
Tutorials For STM32F103RB: Nicolas Barbot
Tutorials For STM32F103RB: Nicolas Barbot
Nicolas Barbot
2016
Tutorials for STM32F103RB 2
• GPIO
• UART
• Timer
• FLASH
Tutorials for STM32F103RB 3
• Ressources
• Nucleo F103RB
• http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-
tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-nucleo/nucleo-f103rb.html
• This page contains user manual UM1724 describing the hardware of Nucleo boards
• STM32F103RB
• http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-
mcus/stm32f1-series/stm32f103/stm32f103rb.html
• This page contains reference manual RM0008 describing STM32F103RB
• STM32 Cube F1
• http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-
software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef1.html
• This page contains UM1850 describing the HAL library
• Open STM32
• http://www.openstm32.org/HomePage
• Open STM32 is a free Eclipse plugin for programming STM32 MCU (registration needed).
• Eclipse
• https://www.eclipse.org
• Eclipse is the IDE software
Using GPIOs
Using GPIOs 5
• Goals:
• To identify a GPIO pin from the datasheet
• To configure and use GPIO with HAL drivers (input, output, interruption)
• To evaluate the performance of GPIO pin (frequency)
• Requirement
• Create an OpenSTM32 Project
Identify a GPIO pin 6
• In this tutorial, we will configure the STM32 to blink LD2 with a period
of 1 s
Create the Project 7
• You can now drive your GPIO pin with the function HAL_GPIO_WritePin() or
HAL_GPIO_TogglePin().
• Write a infinite loop to blink LD2 every 1 seconds.
• In this exercise, we want to toggle D13 (on the Arduino connector) at the
maximum frequency
• Identify port and pin number of D13
• Create a new project (or modify the previous one)
• Configure the pin corresponding to D13 as an output
• In an infinite loop, toggle D13 (without delay)
• Build the project
• Observe D13 with an oscilloscope and determine the maximum frequency
Activate LED when button is pushed 11