Skip to content

Getting started

Geraldo Lucas Pugialli de Paiva edited this page Jan 11, 2021 · 35 revisions

Software requirements

This project is originally developed using STM32CubeMX for code initialization and System Workbench for STM32 for coding, which offer free licenses for all STM32 microcontrollers and are fully compatible with Windows, Mac and Linux.

In order to use the libraries and examples provided in this page, it is necessary to have both softwares fully installed in your computer. For further information about each software, refer to the STM32CubeMX documentation page and System Workbench for STM32 documentation page.

Dependencies

Thle Alarm Clock library uses the 4ilo/HD44780-Stm32HAL LCD libraries lcd.c and lcd.h properly revised to fit the application, which are already included in the library files. Furthermore, ST HAL library is necessary for GPIO, ADC and RTC initialization, and the correct pin and peripheral initialization using the STM32CubeMX software and also must be properly added and configured for use in System Workbench for STM32. The procedures are described below for the NUCLEO-F103RB Board and the LCD Shield. When necessary, the steps must be altered for the specific devices used.

Configuration procedures

STM32CubeMX

After opening the STMCubeMX software, click on the "ACCESS TO BOARD SELECTOR" button, as shown below.

Type the "NUCLEO-F103RB" board name in the upper left corner part number. The corresponding board will appear on the lower right corner.

Click on the "Start Project" button in the upper right corner, as shown below.

A pop-up will appear asking for the default peripheral initialization for the selected board. Click "Yes" to automatically perform clock, debug interface and on-board GPIO configuration for the NUCLEO-F103RB.

A new screen will open with the microcontroller dysplayed on the right and a menu on the left. The first step will be the pin functionality selection. As an example, we will configure PA0 as an analog input pin. First, click on the pin displayed on the microcontroller image.

A pop-up menu will appear with the possible attributions to the selected pin. Select "AD1_IN0", which corresponds to connect the pin to an Analog to Digital Converter input, more specifically, the input 0 from the ADC1 peripheral.

Repeat the process for the following pins and corresponding attributions:

Pin Attributions
PA8 GPIO_Output
PA9 GPIO_Output
PB4 GPIO_Output
PB5 GPIO_Output
PB6 GPIO_Output
PB10 GPIO_Output
PC7 GPIO_Output

Click on "Timers" > "RTC" and make the same configuration as shown.

Then, click on the upper tab named "Clock Configuration" and check the highlighted fields to correspond the selections and values.

Click on "Project Manager" and insert the name of the project in the first field, select the destination folder for the project in the second field and select the Toolchain IDE as "SW4STM32".

Click on "Code Generator" and make sure the select items correspond to the image below.

Click on "GENERATE CODE".

Click on "Open Project" and the System Workbench for STM32 software will open and import the corresponding project from STM32CubeMX.

System Workbench for STM32

Download the library files from the link and extract the "library" folder.

In the "example" project, click on "File" > "Import"

Library use

Clone this wiki locally