Project description

May 1, 2023 ยท View on GitHub

This document contains the detailed project description.

Prerequisites

The prerequisites and the toolchain are detailed in Mastering STM32 written by Carmine Noviello.

Mandatory tools:

Note: Flash loader demonstrator can also be used for downloading but it is outdated.

The version numbers are stored in docs/toolchain_versions.md. Some issues which are not detailed in Mastering STM32 and might be encountered during the use of the toolchain are detailed in docs/toolchain_issues.md.

Optional tools:

Note: STSW-LINK007 is used to upgrade the firmware of the ST-LINK for OpenOCD if necessary.

Mandatory HWs:

Optional HWs:

Note: flash can be accessed without SWD using other interfaces. Refer to www.st.com for more information.

STM32CubeMX

The basic configuration is generated with STM32CubeMX. The following peripherals are configured:

  • UART - USB-UART adapter <-- Blue Pill
  • SPI - Blue Pill <--> nRF24L01+
  • TIM - required for delay function
  • GPIO - required for CE, SS and LED pins
  • SYS - SWD is required for ST-LINK/V2 flashing and debugging

A basic 72MHz SYSCLK is configured currently.

The UART parameters:

  • baud rate: 115200bits/s
  • word length: 8 bits (including parity)
  • parity: none
  • stop bits: 1

The blue_pill_config.ioc project file contains the necessary configuration. The CubemX project is stored in config/cubemx.

Eclipse

An STM32F1xx C project has been created using the ARM Cortex-M C/C++ Project template (with the proper memory sizes and CMSIS). The files generated by CubeMX are copied to the proper folders of the Eclipse project by running tools/cubemx_importer.py:

python cubemx_importer.py <eclipse_project_path> <cubemx_project_path> [<stm32doxyfile_path>]

The STM32F103xB macro is defined for building. Optimization level is set to -O3. The manually implemented code is polling based and is added directly to the main function.

Includes:

#include "util.h"
#include "rf_scanner.h"

Init functions:

util_init();
rf_scanner_init();

Step functions:

rf_scanner_step();
blink_led();

Building

The project can be built in the Eclipse GUI or from command line:

cd <path>\stm32-rf-scanner\src\Debug
make all

Pin description

CE and SPI connections:

pinBlue PillnRF24L01+
CEPB13
SSPB04
SCKPA55
MOSIPA76
MISOPA67

UART and SWD pins:

pinBlue Pill
TXPA2
SWDIOPA13
SWCLKPA14

The ST-LINK/V2 has to be connected to the SWD interface. Both HWs require 3.3V and common ground. The UART logic level is 3.3V also, so the USB-UART adapter has to be configured this way. Most of them has a jumper for this purpose.

Downloading

The binary file can be downloaded using STM32CubeProgrammer or OpenOCD and GDB ARM.

STM32CubeProgrammer:

  • Both the .elf and .hex files can be selected for downloading.

OpenOCD and GDB ARM:

  • OpenOCD has to be configured as an external tool in Eclipse and a debug configuration has to be also created.
  • Only the .elf file can be used for downloading because the symbols are required for debugging.

Measurement

The measured data is sent out via UART and can be observed with an USB-UART adapter.

Measurement results are stored in the meas folder.