Skip to main content
Version: 2.8

Removing STM32 Readout Protection

Some boards, such as the Wio-E5, ship with flash readout protection (RDP level 1) enabled. STM32CubeProgrammer connects but cannot read, verify, or write flash. Removing the protection clears it but erases the whole chip, including the factory firmware.

warning

Removing RDP mass-erases the chip and resets the MCUMCU (Microcontroller Unit). The microcontroller that runs the firmware on a device. The hardware tables list the MCU for each supported board.. On a board whose BOOT0 pin is not reachable, such as the Wio-E5, remove RDP over SWD, connecting under reset (mode=UR, or Connect Under Reset in the GUI) so the programmer keeps control after the erase. With the firmware erased and no BOOT0 pin, nothing can re-enter the ROM bootloader for a UARTUART (Universal Asynchronous Receiver-Transmitter). A serial interface used to communicate with a device over its pins or through a USB-to-serial bridge. connection.

GUI — STM32CubeProgrammer​

  1. Connect over SWDSWD (Serial Wire Debug). A two-pin debug and programming interface, used on STM32 devices to enter bootloader mode and flash firmware. with Connect Under Reset. Only on a board that exposes BOOT0 can you instead connect over UARTUART (Universal Asynchronous Receiver-Transmitter). A serial interface used to communicate with a device over its pins or through a USB-to-serial bridge. with the board in the ROM bootloader.
  2. Choose Read Unprotect (MCUMCU (Microcontroller Unit). The microcontroller that runs the firmware on a device. The hardware tables list the MCU for each supported board.) from the target menu.
  3. Wait for the mass erase to finish, then reconnect.
  4. Flash the Meshtastic firmware as described in Flashing over SWD, or Flashing over UART after re-entering the ROM bootloader with BOOT0.

CLI — STM32CubeProgrammer​

STM32CubeProgrammer's -rdu (read unprotect) removes RDP and mass-erases the chip. Over SWDSWD (Serial Wire Debug). A two-pin debug and programming interface, used on STM32 devices to enter bootloader mode and flash firmware., connecting under reset:

STM32_Programmer_CLI -c port=SWD mode=UR -rdu

mode=UR needs the programmer's nRST line wired to the board; see Flashing over SWD for the mode=HOTPLUG fallback. On a board that exposes BOOT0, you can instead run -rdu over the UARTUART (Universal Asynchronous Receiver-Transmitter). A serial interface used to communicate with a device over its pins or through a USB-to-serial bridge. bootloader, then use BOOT0 to re-enter the bootloader and flash firmware:

STM32_Programmer_CLI -c port=/dev/ttyUSB0 br=115200 -rdu