Skip to main content

// application note

AN0003 Programming STM32 microcontrollers over SPI with the Binho Pulsar

The system bootloader programmed into the ROM of STM32 microcontrollers offers an SPI interface on many families, allowing internal flash memory to be erased, programmed and verified with no debug probe attached. This application note describes that interface, the connections required between a Binho Pulsar USB host adapter and the target, and the procedure for programming a device. It gives particular attention to the framing rule that separates a working host implementation from one that corrupts data, and to a method of driving reset from spare chip selects when no general-purpose pins are free. Measured results are given for an STM32H503 on a NUCLEO-H503RB board.

Products
Binho SupernovaBinho PulsarBinho Atira
Protocols
SPI
Topics
STM32 Bootloader Flashing
Revision
Rev 1.1 · September 3, 2026

// outcomes

What you'll walk away with

This document describes:

  • the structure of the SPI system bootloader protocol, including the acknowledgement handshake and the rule that governs how a reply is read
  • the connections required between a Binho Pulsar and an STM32 target, including a method of driving NRST and BOOT0 from spare chip selects
  • the procedure for identifying, erasing, programming and verifying a device
  • a method for confirming from outside the programming tool that the target is running the newly programmed image
  • the accompanying reference utility, which drives either a Pulsar or a Supernova

It does not cover programming over UART, USB, CAN, I2C or I3C; option-byte programming; readout protection, which the ROM bootloader on the tested part does not offer over this interface; or production programming fixtures. For I3C see AN0001, and for I2C see AN0002.

// background

Background

The system bootloader programmed into the ROM of every STM32 microcontroller provides a means of programming internal flash memory over a serial interface, without a debug probe and without any user code present on the device. The interfaces offered by the bootloader vary by device and are listed per part number in AN2606.

SPI appears on that list for many families. It is the fastest of the three interfaces this series has covered when writing, and it is the one whose host implementation is easiest to get subtly wrong. The reason is a single design decision: the value the target sends when it has nothing to say is an ordinary data value, not a reserved one. A host that treats it as padding passes every identification command and then corrupts flash reads.

This note is the SPI counterpart to AN0001, which covers I3C, and AN0002, which covers I2C. The command set is nearly the same on all three. What differs is the framing, and on this bus the framing is what matters.

// applicable devices

Applicable devices

The SPI system bootloader is not specific to one family. The pins it uses differ per part and per SPI instance, and all of them are given in AN2606. They are not the pins a board routes to an Arduino-style SPI header, which is an application mapping of the same peripheral.

Family Example part Bootloader SPI interfaces Basis
STM32H5 STM32H503 SPI1, SPI2, SPI3 Tested for this document
STM32H5 STM32H563 Per AN2606 AN2606, not tested
STM32G0, G4 none Per AN2606 AN2606, not tested
STM32L4, L5 none Per AN2606 AN2606, not tested
STM32U5 none Per AN2606 AN2606, not tested

Only the STM32H503 was exercised on hardware, and only its SPI2 instance. The pins and the supported command list must be read from AN2606 for the part in hand before any of this document's commands are issued.

// what's covered

What's covered in the note

  1. 01 Introduction
  2. 02 System overview
  3. 03 Hardware setup
  4. 04 Software setup
  5. 05 Bootloader protocol
  6. 06 Programming procedure
  7. 07 Confirming the update on the target
  8. 08 Reference utility
  9. 09 Measured results
  10. 10 Troubleshooting

The full procedure, measured results, and reference code are in the PDF and the assets archive.

// trusted by engineering teams at

+ hundreds more

// newsletter

Get new application notes

New notes, firmware releases, and tool updates from Binho. No spam, unsubscribe anytime.

Put it on the bench

Every step in AN0003 was run on Binho Supernova, Binho Pulsar and Binho Atira. Get the hardware to reproduce it, or talk to our engineers about your SPI bring-up.