Electronics project notes/STM32 notes

From Helpful
Jump to: navigation, search
This is for beginners and very much by a beginner.

It's intended to get an intuitive overview for hobbyist needs. It may get you started, but to be able to do anything remotely clever, follow a proper course or read a good book.


Some basics and reference: Volts, amps, energy, power · Ground · batteries · resistors · changing voltage · transistors · fuses · diodes · varistors · capacitors · inductors · transformers · baluns · amplifier notes · frequency generation · skin effect


And some more applied stuff:

IO: Input and output pins · wired local IO · wired local-ish IO · · · · Shorter-range wireless (IR, ISM RF) · RFID and NFC · bluetooth · 802.15 (including zigbee) · 802.11 (WiFi) · cell phone

Sensors: General sensor notes, voltage and current sensing · Knobs and dials · Pressure sensing · Temperature sensing · humidity sensing · Light sensing · Movement sensing · Capacitive sensing · Touch screen notes

Actuators: General actuator notes, circuit protection · Motors and servos · Solenoids

Some stuff I've messed with: Avrusb500v2 · GPS · Hilo GPRS · JY-MCU · DMX · Thermal printer ·


Noise stuff: Stray signals and noise · sound-related noise names · electronic non-coupled noise names · electronic coupled noise · ground loop · strategies to avoid coupled noise · Sampling, reproduction, and transmission distortions


Audio notes: See avnotes

Microcontroller and computer platforms Arduino and AVR notes · ESP series notes · STM32 series notes · · · ·


Less sorted: device voltage and impedance, audio and otherwise · electricity and humans · Common terms, useful basics, soldering · PLL · pulse modulation · signal reflection · resource metering · SDR · Project boxes · Unsorted stuff

See also Category:Electronics.

STM32 are a licensed[1] bunch of series of Cortex-M based devices.

Many individual models over various series, but (currently) broadly with speeds somewhere between 20 and 200MHz, and with SRAM and flash up to a few hundred KB.


A bunch of pre-made boards, including


Voltage and current

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

Regularly run at 3.3V (down to 2V), generally considered a 3.3V device.

A subset of pins are 5V tolerant (when you disable pullup/pulldown), others are not.


You can get a good estimate of current from STM32CubeMX, configuring the peripherals things you'll use, and e.g. how much lower than the maximum the CPU takes by running it idle more of the time.



Models and boards

Starting to understand model codes

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

1 letter: Type/market

F - Foundation / general purpose (probably the most common?)
L - Low-power
G - Mainstream
H - High performance
W - Wireless

1 digit: Core

0 - Cortex M0
1 - Cortex M3
2 - Cortex M3
3 - Cortex M4
4 - Cortex M4
7 - Cortex M7

(These two combine as a series. Not all exist, see series list below)


2 digits: Product line within the series - so the meaning varies per series

e.g. for F1
00 - 24MHz, motor control
01 - 36MHz
02 - 48MHz, USB
03 - 72MHz, USB, CAN, motor control
05, 07 - 72MHz, Ethernet, CAN, USB OTG
e.g. for F4 (most have USB, many have crypto and rng) (verify) TODO: finish this list
01 - 84MHz
05/15 - 168MHz, 2 DACs,
07/17 - 168MHz, 2 DACs, Ethernet, camera interface
10 - 100MHz, DAC
11 - 100MHz, 5 SPI
12 - 100MHz,
13/23 - 100MHz, more serial ports than most
27/37 - 180MHz, memory controller
29/39 - 180MHz, memory controller
46 - 180MHz, memory controller
69/79 - 180MHz, LCD-TFT and MPI-DSI


1 letter: pin count (will roughly correlate with package type), e.g.

C - 48 (or 49)
R - 64 (or 66)
V - 100
O - 90
Z - 144
(the list is longer, omitted for brevity)

1 letter/number: Flash size (within a line this is strongly correlated to RAM(verify)), e.g.

4 - 16KiB Flash (RAM e.g. 6KiB for F1)
6 - 32KiB Flash (RAM e.g. 10KiB for F1)
8 - 64KiB Flash (RAM e.g. 20KiB for F1)
B - 128KiB Flash (RAM e.g. 20KiB for F1, 64KiB for F4)
C - 256KiB Flash (RAM e.g. 48KiB for F1, 64KiB for F4)
D - 384KiB Flash (RAM e.g. 96KiB for F4)
E - 512KiB Flash (RAM e.g. 96KiB for F4)
F - 768KiB Flash
G - 1024KiB Flash (RAM e.g. 96KiB for F4)
H - 1536KiB Flash
I - 2048KiB Flash
(the list is longer, omitted for brevity)


1 letter: Package, e.g.

T - LQFP
(the list is longer, omitted for brevity)

1 number: Temperature

6 - -40C to 85C
7 - -40C to 105C


See also:


It seems the series that exist are currently:

F1 series (launched 2007), Cortex-M3
F2 series (launched 2010), Cortex-M3
L1 series (launched 2010), Cortex-M3
F4 series (launched 2011), Cortex-M4F
F3 series (launched 2012), Cortex-M4F
F0 series (launched 2012), Cortex-M0
F7 series (launched 2014), Cortex-M7F (pin compatible with F4, faster)
L0 series (launched 2014), Cortex-M0+
L4 series (launched 2015), Cortex-M4F
L4+ series (launched 2016)
H7 series (launched 2017), Cortex-M7F
L5 series (launched 2018), Cortex-M33F
G0 series (launched 2018), lower-power variants of L0 (Cortex-M0+)

Also:

WB series
WL series



Examples

Consider

STM32F103C8T6
STM32F103RBT6
STM32F103RCT6
STM32F405RGT6
STM32F407VGT6
STM32F401CEU6
STM32F411CEU6


The first three are F1 series and all F103 line.

The last four are F4 series, and four different lines (F405, F407, F401, F411).


IO featureset will vary between distinct lines, but also note that fewer-pin versions within a line can omit things because they don't have enough pins to expose them, so consult the datasheet.

Datasheets will often be for a line, part of a line , or group a few similar-enough lines basically varying with how similar their features are.


Blue pill notes

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

Blue Pill boards are typically based on the STM32F103C8T6 (a Cortex-M3, STM32F1 series)


If USB doesn't work:

  • R10 problem: R10 on the board is the USB's D+ line pullup, which should be 1.5k -- but is higher on many older blue pill boards
there's a hack in putting something in parallel on external pins (e.g. if the resistor is 10k, adding ~1.8k should work)
  • Many boards do not come with a USB-capable firmware/bootloader(verify)
you will need to flash one over serial
Note that USB code takes ~20KB, so if you don't need it, you may want to skip that
(that said, most people don't need a huge amount of code, so USB is just nice to have)
 BOOT0 BOOT1  
   0     x    on-board flash (the firmware you wrote)
   1     0    system ROM (mostly for programming mode, see ST AN2606)
   1     1    SRAM (certain debugging, sometimes being controlled by something else)

...so most of us only care to set BOOT0, to switch between low=flashing and high=operating (on many versions that't the top jumper left and right, respectively)

Black pill (Blue Pill 2) notes

Black Pill boards are typically based on the STM32F401CCU6 or STM32F411CEU6 (Cortex-M4F, STM32F4 series)

Compared to blue pill, these will have

FPU
higher clock speed (84 and 100MHz)
256 or 512KB flash
64 or 128KB SRAM
USB-C port
a few more IO options (but how much is exposed)

They cost maybe twice as much, which is still not much

Maple

Nucleo

Hardware

IO

Serial ports
5V tolerance

ADC and DAC notes

Many have (12-bit(verify)) ADCs (some multiple)

Some have (12-bit) DACs (max speed in the megasample range, varying with series)


Sound notes

Timer/PWM notes

Setup and programming

STM32Cube
This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

[4] is a group of applications intended to combine to be a complete toolset.

It includes things like

  • STM32CubeMX [5]
win, lin, osx
"initialization code generator"
generates a code to initialize the parts you want, for any known board - basically a template with all the hardware init, and an empty main()
(and does things like calculating power use)
You can then move to STM32CubeIDE, or other IDE/toolchain
  • STM32CubeIDE [6]
win, lin, osx
  • STM32CubeProgrammer [7]
flashing
  • STM32CubeMonitor [8]
run-time monitoring
groups some more specific things (verify)


  • STM32Cube MCU & MPU - specifics per STM32 series [9]
 ?


https://www.youtube.com/watch?v=hyZS2p1tW-g


STM32 Arduino
This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

There are a handful of cores you can use, but mostly it's the following two:

  • Arduino STM32
since 2011 or so,
STM32F1(03?) only, later also added STM32F4(verify)
based on maple code (see also maple mini), not STM's code (because that wasn't released until years later), meaning new features take more work to add
https://github.com/rogerclarkmelbourne/Arduino_STM32
  • STM Core boards
from STM, but came years later (2016, 2017ish)
https://github.com/stm32duino


It seems that since the release of the latter, the former isn't really maintained anymore(verify), and since a number of things differ, it's probably a good idea to choose the latter unless a specific codebase is easier to make work on the former.


There are others, but most were more specific than Arduino STM32


See also:

PlatformIO

Firmware flashing

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)