1. Announcements
2. Class time
2.1. PIO and stm32
VSCode, Extensions -> PlatformIO
^^^ adds tools for embedded development and debugging
Specific platform for the STM32: https://github.com/platformio/platform-ststm32
Bare setup:
-
Bottom bar Home button: PlatformIO Home
-
New Project
-
Board: start typing "f3discovery" until there is only one choice left
-
Framework: 8-) at the list.
-
Mbed - from ARM and a neat ecosystem https://os.mbed.com/
-
CMSIS - also from ARM for all ARM-Cortex processors
-
Standard Peripheral Library - from ST
-
libopencm3 - open source library for Cortex-M3 processors
-
STM32Cube - from ST
-
The 'Cube ecosystem also includes STM32CubeIDE which is similar to TI’s Code Composer Studio. (both are based on Eclipse, a popular IDE framework — VS Code is a "competitor" with Eclipse)
-
-
Zephyr RTOS
-
An embedded Linux-focused platform. Rising in popularity and reach. Perhaps explore in ECE 422.
-
-
-
Select Arduino
-
Location: see what the default location is and/or specify one
-
Finish. … first time takes ~forever …
-
When this finally finishes, you will have a blank Project.
Open platformio.ini
(maybe is already)
[env:disco_f303vc]
platform = ststm32
board = disco_f303vc
framework = arduino
Platform, board, and framework configuration. You can write this file yourself since it is just text. The format is "INI" which is easy to read. Sections by [sectionA]
and key = value
pairs. Need this sort of config capability for some custom thing you have? -> use this format and you’re likely to find a library to help you read and write the information!
From the Explorer on the left side, open .vscode/c_cpp_properties.json
.
.json
for JSON formatted file. It is a ubiquitous format and heavily associated with web things. "Everyone uses it", including you. The format is simple.
Notice includePath
for all the places where your #include
statements will see.
Fold the lists using VS Code.
Notice defines
. These are #define
already and you can use them to #ifdef
decide what platform and options your code is being compiled with.
Look at the other files that were created in the folder structure. Read (skim) the README
files.
main.cpp
:
-
Notice the
#include <Arduino.h>
. This is automatically included (if not already present) when using the classic ArduinoIDE. -
… the familiar
setup()
andloop()
-
Write your own Blink example. (steal it from ArduinoIDE !)
…
Bottom row -> Checkmark Build button
Connect your board and "->" Upload button.
2.2. Deep into msp430.h
Find the 16-bit hex values that are eventually resolved from the following symbols:
-
P1OUT
-
P1REN
-
WDTCTL
Use CCS features to open msp430.h
and keep going! all-the-way to something like being able to replace
P1OUT = 0xab;
with
*(volatile unsigned int 0xWXYZ) = 0xab;
(Write 0xab
to this exact memory address)
3. Special Project Ideas
A place to pitch some potential projects for interested parties.
3.1. Save BLE packets to microSD card
This is a long-running project using ESP32 devboards. Each unit:
-
Sniffs Bluetooth LE packets from other devices in the vicinity
-
Adds a timestamp
-
Sends the BLE packet data and metadata to a database

The current version requires a 24/7 WiFi connection.
In order to enable other research projects in conjunction with Civil Engineering - Transportation, the system needs to also log packets without an active network connection.
These devboards have a microSD card connector that is perfect for saving lots of data.

Your task is to take the existing code and modify it to log packets to microSD card. It must do this logging whether or not there is or has ever been an active WiFi connection.
The existing code does connect to the microSD card but the feature is disabled because it conflicts with blinking the on-board LED that blinks once for each packet.