STM32F103 - UART Flash#


Gravação da memória flash no Blue Pill (caso devboard danificada).

Pacotes Debian: sudo apt install -y stm32flash

Arch Linux (AUR): yay -S stm32flash

Configurações físicas na DevBoard:#

  • Mudar o jumper BOOT0 para a posição 1;
  • TX GPIO(A9);
  • RX GPIO(A10);
  • Alimentação.

Obtendo informações#

Comando usado para checas as conexões físicas entre o STM32 <> UART to USB (TTL) <> PC.

>_ stm32flash /dev/ttyUSB0

Interface serial_posix: 57600 8E1
Version      : 0x22
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0410 (STM32F10xxx Medium-density)
- RAM        : Up to 20KiB  (512b reserved by bootloader)
- Flash      : Up to 128KiB (size first sector: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB

Gravando na Flash#

>_ stm32flash -w stm32-vserprog.hex -v -g 0x0 /dev/ttyUSB0

Using Parser : Intel HEX
Location     : 0x8000000
Size         : 10524
Interface serial_posix: 57600 8E1
Version      : 0x22
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0410 (STM32F10xxx Medium-density)
- RAM        : Up to 20KiB  (512b reserved by bootloader)
- Flash      : Up to 128KiB (size first sector: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
Write to memory
Erasing memory
Wrote and verified address 0x0800291c (100.00%) Done.

Starting execution at address 0x08000000... done.