- At first: Get sure you have "stm32flash" installed. http://stm32flash.sourceforge.net/
- The hardware preparation is the same as on Windows. I've mounted pins for the serial port first and then shorted the two jumper pads (circled red). After that connect your UART adapter. If possible, jumper it to use 3.3V logic. I strongly recommend a FTDI FT232 based adapter! The UART pins can be left on the board after updating and I think about getting some 1.27mm pin headers and female headers to make jumper plugs for the solder bridges.
- After preparing the hardware, create a new directory for the job (I called it "firmware") and download the firmware you want to flash into this directory.
- Now it is time to open a terminal window and change into the directory where you placed the firmware
Code: Select all
$ cd firmware/ $ ls 113-15001-061.rar
- "RAR" is a pretty uncommon archive format on a Linux system, but "bsdtar" is able to extract this
Code: Select all
$ bsdtar -vxf 113-15001-061.rar x 113-15001-061.hex $ ls 113-15001-061.hex 113-15001-061.rar
- Connect your USB cable of your UART adapter and find out the device name
Code: Select all
$ ls -l /dev/ttyUSB* crw-rw---- 1 root uucp 188, 0 Jul 16 13:26 /dev/ttyUSB0
- Time to check the connection.
The following is a good connection test:And this is a bad connection test:Code: Select all
$ stm32flash -b 115200 /dev/ttyUSB0 stm32flash 0.5 http://stm32flash.sourceforge.net/ Interface serial_posix: 115200 8E1 Version : 0x22 Option 1 : 0x00 Option 2 : 0x00 Device ID : 0x0410 (STM32F10xxx Medium-density) - RAM : 20KiB (512b reserved by bootloader) - Flash : 128KiB (size first sector: 4x1024) - Option RAM : 16b - System RAM : 2KiB
I had this error message with one of my UART adapters based on an Prolific chipset (probably a clone chip?). The error went away as soon as I used my FT232 based adapter.Code: Select all
$ stm32flash -b 115200 /dev/ttyUSB0 stm32flash 0.5 http://stm32flash.sourceforge.net/ Interface serial_posix: 115200 8E1 Failed to init device.
- Now as we are sure we are connected to the bootloader, we have to Read-Unprotect the flash. You only have to do this the first time you update firmware!
Code: Select all
$ stm32flash -b 115200 -k /dev/ttyUSB0 stm32flash 0.5 http://stm32flash.sourceforge.net/ Interface serial_posix: 115200 8E1 Version : 0x22 Option 1 : 0x00 Option 2 : 0x00 Device ID : 0x0410 (STM32F10xxx Medium-density) - RAM : 20KiB (512b reserved by bootloader) - Flash : 128KiB (size first sector: 4x1024) - Option RAM : 16b - System RAM : 2KiB Read-UnProtecting flash Done.
- Now it is time to do the actual firmware flash
Code: Select all
$ stm32flash -b 115200 -v -w 113-15001-061.hex /dev/ttyUSB0 stm32flash 0.5 http://stm32flash.sourceforge.net/ Using Parser : Intel HEX Interface serial_posix: 115200 8E1 Version : 0x22 Option 1 : 0x00 Option 2 : 0x00 Device ID : 0x0410 (STM32F10xxx Medium-density) - RAM : 20KiB (512b reserved by bootloader) - Flash : 128KiB (size first sector: 4x1024) - Option RAM : 16b - System RAM : 2KiB Write to memory Erasing memory Wrote and verified address 0x0800cce4 (100.00%) Done.
- Done! Now remove the solder bridges and enjoy your new firmware.
Step by Step: How to flash firmware from Linux
Step by Step: How to flash firmware from Linux
In the following, I want to describe how it is possible to successfully flash firmware into the DSO Shell oscilloscope on a system running Linux.