Why Use STM32?
Prior to the 22-23 competition season, the only microcontrollers used on the car were NERduinos, which use utilize Teensy 4.1 (ARM Cortex-M7 at 600 MHz, 7936K Flash, 1024K RAM). While these are excellent microprocessorshave served us well, they’re both difficult to acquire and fairly expensive ($40).
(ARM Cortex-M7 at 600 MHz, 7936K Flash, 1024K RAM), they’re both
If you want ~$32 apiece). The STM32 series from STMicroelectronics presents a massive array of chips spanning a wide spectrum of cost/performance ratios, meaning that we can almost always find something that matches the task at hand in both price and functionality. The STM32 line includes MCUs ranging from ARM Cortex M0 to Cortex M7, as well as MPUs. They can also support a wide range of peripheral devices (including CAN, which is the most important for us), and all STM32s are supported by the STM32Cube Development Environment, making it very easy to switch between chips and re-use code.
STM32 Features
The following lists include most of the features available through microcontrollers in the STM32 series:
IO Count: 6-140
Program Memory Size: 8KB-2MB
RAM size: 2KB - 640KB
Speed: 24-550MHz
Connectivity: CANbus, EBI/EMI, Ethernet, Memory Card, I²C, IrDA, LINbus, MDIO, MMC/SD/SDIO, QSPI, SAI, SPDIF, SPI, SWPMI, UART/USART, USB OTG
Peripherals: Brown-out Detect/Reset, DMA, I²S, LCD, POR, PWM, WDT Bluetooth, SmartCard
ADC/DAC: up to 42 12-bit ADC channels, 7 12-bit DAC channels
STM32 Circuit Design
To figure out what arrangement of decoupling caps are required, refer to the recommended design guidelines in the spec sheet for the particular chip chosen. Another good resource is the design files provided by STM32 for all of their Nucleo Dev Boards (You can find the design files for the NUCLEO-G431KB here). The 17D Steering wheel PCB is, at time of writing, the only completed and tested NER PCB using an STM32, and could also provide a good reference.
STM32 Layout/PCB Design
Programming the STM32
The current strategy for programming STM32s is to use an Adafruit 2548 ST-Link V2 Programmer to program the boards over SWD (ARM Serial Wire Debug) protocol.
STM32CubeIDE
Learning Resources
The best resource I’ve found so far is the Digkey Series by Shawn Hymel
If you’re looking for a really in-depth walk through of the entire Altium design cycle for an STM32 board, this video is an excellent resource:
Iframe | ||||||
---|---|---|---|---|---|---|
|
and very in-depth resource:
Widget Connector | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|