STM32F103C8T6 ARM minimum system development board
board: STM32F103C8T6 - "blue pill"
DirtyJTAG
STM32 JTAG PA0 TDI PA1 TDO PA2 TCK PA3 TMS PA4 TRST PA5 SRST
Links
STM32duino wiki: Blue Pill, JeeLabs: Let's start with a Blue Pill, SD cards with FAT files, Tying SPI and DMA together, A microSD, slave SPI and DMA, blogs STM32 Blue Pill ARM development board first look: from Arduino to bare metal programming, Sunspot Experiments with the Arduno IDE connected to a generic ARM board - containing an STM32F103C8T6, Arduino STM32, usb-framework, dapboot, Loading a Bootloader on the STM32 Blue Pill, ulisp-stm32,
other links: Mecrisp (Forth), Bluepill Diagnostics - Mecrisp-based clone / fake detection software. Rust blue-pill-quickstart, Rust for STM32 Blue Pill with Visual Studio Code, Rust on STM32F103 Blue Pill with Probe-run tooling, Rust on STM32: Getting started, Using Rust for a simple hardware project, Rust and STM32 ARM - Getting Started part 1, part 2, part 3, Rust Embedded BluePill Workshop Notes,
forum: Arduino for STM32,
projects: BluePillSound, DirtyJTAG, pill_6502 - pill_6502: 8-bit 6502 CPU and 6850 ACIA emulation on the STM32 blue pill to run Microsoft BASIC from 1977, 9names/pill_6502, Building an Amazing $10 Oscilloscope with an STM32 blue pill, LCD touchscreen, and STM32-O-Scope software, Triple USB-to-serial adapter using STM32 blue pill (pill_serial), Converting an STM32F103 board to a Black Magic Probe, bldc-strip, U2F-TOKEN firmware for STM32F103 and EFM32HG boards, stm32f103_projects: SD_info, stm32-ws2812, STM32 Frequency Meter with USB, grbl_usb_stm32F103c8t6, i2c-star (a clone of I2C-Tiny-USB), specci48 - stm32f103c8t6 spectrum emulator, stm32-sump, fluke8050a-forth - Fluke 8050A Multimeter LCD Display Project, FASTUSBasp, sWiitch controller, SWIM_Programmer (for STM8), GNUK: Open Source GPG/SSH hardware key storage,
more projects: MattisLind/ArdSCSino-stm32,
Thingiverse: STM32 blue pill case (blackmagic programmer), stm32multiserial case, Blue Pill STM32F103 USB-only Housing, Bluepill case,
local links
local links: bb, c1, c2, e1, z30b, Greaseweazle,
back to microcontrollers page.
History
2021-11-07: I re-created this page on my self-hosted web server.
2021-06-13: c2 - flashing another Bluepill (clone, white rectangular RESET button) again. Connections are (as always) RX - A9, TX - A10, GND - GND, VCC - 3.3V, BOOT0 set to 1. It shows up as /dev/cuaU0 again.
tingo@kg-core2$ stm32flash -w firmware/firmware.bin /dev/cuaU0 stm32flash 0.6 http://stm32flash.sourceforge.net/ Using Parser : Raw BINARY 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 address 0x0800cf54 (100.00%) Done.
just have to insert it into the BlueSCSI board, and we are ready.
2021-05-26: c2 - try to program another Bluepill (clone this time, white RESET button). Connect as before RX from serial adapter to A9 on Bluepill, TX to A10, GND to GND, VCC to 3.3V. Set BOOT0 to 1. Check devices after plugging in the usb to serial adapter:
tingo@kg-core2$ ll /dev/cua[ACU]* /dev/tty[ACU]* crw-rw---- 1 uucp dialer - 0x2d9 May 26 21:49 /dev/cuaU0 crw-rw---- 1 uucp dialer - 0x2da May 26 21:49 /dev/cuaU0.init crw-rw---- 1 uucp dialer - 0x2db May 26 21:49 /dev/cuaU0.lock crw------- 1 root wheel - 0x2d6 May 26 21:49 /dev/ttyU0 crw------- 1 root wheel - 0x2d7 May 26 21:49 /dev/ttyU0.init crw------- 1 root wheel - 0x2d8 May 26 21:49 /dev/ttyU0.lock
so /dev/cuaU0 should work.
tingo@kg-core2$ stm32flash /dev/cuaU0 stm32flash 0.6 http://stm32flash.sourceforge.net/ 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
I had to press RESET before the device would respond.
tingo@kg-core2$ stm32flash -w firmware/firmware.bin /dev/cuaU0 stm32flash 0.6 http://stm32flash.sourceforge.net/ Using Parser : Raw BINARY 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 address 0x0800cf54 (100.00%) Done.
programming seems to work.
2021-05-23: c1 - try another Bluepill, this time with stm32flash from ports. This one is from a bag I have labeled "FAKES". It has a metal reset button, the text "RESET" is next to it vertical to the A11 pin.
tingo@kg-core1$ stm32flash -w id-swdcom/bluepill-diagnostics-v1.631.bin /dev/ttyU0 stm32flash 0.6 http://stm32flash.sourceforge.net/ Using Parser : Raw BINARY 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 address 0x0800fd00 (100.00%) Done.
good for some reason, it wouldn't attach on c1, /var/log/messages just shows
May 23 20:26:47 kg-core1 kernel: ugen3.4: <Unknown > at usbus3 (disconnected) May 23 20:26:47 kg-core1 kernel: uhub_reattach_port: could not allocate new device May 23 20:27:03 kg-core1 kernel: usbd_setup_device_desc: getting device descriptor at addr 4 failed, USB_ERR_SHORT_XFER
and no device shows up
tingo@kg-core1$ ll /dev/tty[ACU]* ls: /dev/tty[ACU]*: No such file or directory
testing on c2 instead
tingo@kg-core2$ ll /dev/tty[ACU]* crw------- 1 root wheel - 0x2d6 May 23 20:28 /dev/ttyU0 crw------- 1 root wheel - 0x2d7 May 23 20:28 /dev/ttyU0.init crw------- 1 root wheel - 0x2d8 May 23 20:28 /dev/ttyU0.lock
device ok, try screen
tingo@kg-core2$ screen /dev/ttyU0 115200
pressing 'm' ..., huh, I don't have access to /dev/tty* devices, ok use cua instead
tingo@kg-core2$ screen /dev/cuaU0 115200
yes, that works. Tests h - test doesn't complete, just print a 'P', then lots of wrong values like
00010AD0 $FF?: $04 00010AD2 $FF?: $1E 00010AD4 $FF?: $
then it hangs and I have to reset it. other tests
65536 flash is declared in the Flash size register at 0x1FFFF7E0 DBGMCU_IDCODE [@ 0xE0042000] = 0x20036410 STM32F103C8 authentication FAILED one or more tests: ---------------------------------------------------- PASS - Declared flash = 65536 Bytes FAIL - DBGMCU_IDCODE is readable with no SWD/Jtag connected FAIL - Second 64KB flash block not verified or not tested FAIL - JDEC manufacturer id NOT STMicroelectronics Jdec Continuation Code: 0x05 Jdec Identity Code: 0x55 JDEC manufacturer id: UNKNOWN, consult readme 'JDEC Codes' table
from extra menu
UNIQUE DEVICE ID: ----------------- BITS-95:64 | 0x160707E2 | .... BITS-63:32 | 0x16001228 | ...( BITS-31:0 | 0x046F78DC | .ox. Unique Serial Number = 0x04686D16
interesting device.
2021-05-23: c1 - connected up a Bluepill to a FTDI based usb serial adapter (white - RX to A9, grey - TX to A10, black to GND, red to 5V, BOOT0 jumpered to 1) and programmed it with bluepill diagnostics
tingo@kg-core1$ ~/work/stm32flash/stm32flash -w id-swdcom/bluepill-diagnostics-v1.631.bin /dev/ttyU0 stm32flash - http://stm32flash.googlecode.com/ Using Parser : Raw BINARY Serial Config: 57600 8E1 Version : 0x22 Option 1 : 0x00 Option 2 : 0x00 Device ID : 0x0410 (Medium-density) RAM : 20KiB (512b reserved by bootloader) Flash : 128KiB (sector size: 4x1024) Option RAM : 15b System RAM : 2KiB Wrote address 0x0800fd00 (100.00%) Done. Resetting device... done.
now to test with screen
tingo@kg-core1$ screen /dev/ttyU0 115200
and pressing 'm' gives
--------- Main Menu --------- h - test second Half of the 128KB flash declared for this chip f - how much Flash is declared in the Flash Size Register ? d - Print DBGMCU_IDCODE a - STM32F103C8T6 Authenticity test, don't use with SWD/JTAG. Requires test h once to complete j - Jdec manufacturer id e - Extra menu q - Quit menu, enter the Forth command line m - Main menu
interesting
h - test second Half of the 128KB flash declared for this chip: PASSED 131072 flash is declared in the Flash size register at 0x1FFFF7E0 DBGMCU_IDCODE [@ 0xE0042000] = 0x20036410 Jdec Continuation Code: 0x04 Jdec Identity Code: 0x3B JDEC manufacturer id: CKS or APM STM32F103C8 authentication FAILED one or more tests: ---------------------------------------------------- FAIL - Declared flash not 65536 FAIL - DBGMCU_IDCODE is readable with no SWD/Jtag connected PASS - Second 64KB flash block verified FAIL - JDEC manufacturer id NOT STMicroelectronics
from extra menu
UNIQUE DEVICE ID: ----------------- BITS-95:64 | 0x004E4B43 | .NKC BITS-63:32 | 0x4D38122D | M8.- BITS-31:0 | 0x01051B01 | .... Unique Serial Number = 0x4C73426F
these boards have the label "RESRT" (instead of "RESET") and "STM32*" just above A10 - A12
2020-02-03: z30b - upgrading another Blue Pill, using a CP2102 based usb serial adapter this time. white (RX from serial adapter) to A9, grey (TX from serial adapter) to A10, black to GND, pink / red-ish to 5V. BOOT0 jumpered. For some reason, I had to switch RX and TX, and then press the RESET button on the blue Pill - then it works
tingo@z30b:~/work/greaseweazle/Greaseweazle-v0.11$ stm32flash -b 921600 /dev/ttyUSB0 stm32flash 0.5 http://stm32flash.sourceforge.net/ Interface serial_posix: 921600 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
program it
tingo@z30b:~/work/greaseweazle/Greaseweazle-v0.11$ stm32flash -b 921600 /dev/ttyUSB0 -vw ./Greaseweazle-F1-v0.11.hex stm32flash 0.5 http://stm32flash.sourceforge.net/ Using Parser : Intel HEX Interface serial_posix: 921600 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 0x0800405c (100.00%) Done.
ok.
2020-01-31: bb - connect up a Blue Pill, ready to be upgraded. white (RX from serial adapter) to A9, green (TX from serial adapter) to A10, black to GND and red to 5V. BOOT0 jumpered. Then I try with stm3flash:
tingo@kg-bsbox:~/work/greaseweazle/Greaseweazle-v0.11$ stm32flash -b 921600 /dev/ttyUSB0 stm32flash 0.5 http://stm32flash.sourceforge.net/ Interface serial_posix: 921600 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
ok, so upgrade it already
tingo@kg-bsbox:~/work/greaseweazle/Greaseweazle-v0.11$ stm32flash -b 921600 /dev/ttyUSB0 -vw ./Greaseweazle-F1-v0.11.hex stm32flash 0.5 http://stm32flash.sourceforge.net/ Using Parser : Intel HEX Interface serial_posix: 921600 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 0x0800405c (100.00%) Done.
done. Reset BOOT0 jumper.
2020-01-06: I tested and programmed two more devices with Greaseweazle 0.7
2020-01-06: flash the proper firmware: set BOOT0 = 1, reset device, then
tingo@kg-bsbox:~/work/greaseweazle/Greaseweazle-v0.7$ stm32flash -b 921600 /dev/ttyUSB5 -vw ./Greaseweazle-F1-v0.7.hex stm32flash 0.5 http://stm32flash.sourceforge.net/ Using Parser : Intel HEX Interface serial_posix: 921600 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 0x08003d24 (100.00%) Done.
ok, set BOOT0 = 0, disconnect it from usb serial adapter, connect via usb, it shows up in /var/log/messages
Jan 6 14:01:09 kg-bsbox kernel: [4244830.038580] usb 1-3.3: new full-speed USB device number 11 using xhci_hcd Jan 6 14:01:09 kg-bsbox kernel: [4244830.143393] usb 1-3.3: New USB device found, idVendor=1209, idProduct=0001, bcdDevice= 1.00 Jan 6 14:01:09 kg-bsbox kernel: [4244830.143399] usb 1-3.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Jan 6 14:01:09 kg-bsbox ker nel: [4244830.143402] usb 1-3.3: Product: Greaseweazle Jan 6 14:01:09 kg-bsbox kernel: [4244830.143405] usb 1-3.3: Manufacturer: Keir Fraser Jan 6 14:01:09 kg-bsbox kernel: [4244830.151638] cdc_acm 1-3.3:1.0: ttyACM0: USB ACM device
and as a usb device
tingo@kg-bsbox:~$ ls -l /dev/tty[ACU]* crw-rw----+ 1 root dialout 166, 0 Jan 6 14:01 /dev/ttyACM0 crw-rw----+ 1 root dialout 188, 0 Jan 6 13:21 /dev/ttyUSB0 crw-rw----+ 1 root dialout 188, 1 Jan 6 13:21 /dev/ttyUSB1 crw-rw----+ 1 root dialout 188, 2 Jan 6 13:21 /dev/ttyUSB2 crw-rw----+ 1 root dialout 188, 3 Jan 6 13:21 /dev/ttyUSB3 crw-rw----+ 1 root dialout 188, 5 Jan 6 13:57 /dev/ttyUSB5
cool.
2020-01-06: test the device (I reset the BOOT0 to 0 (zero) first)
[13:50:38:993] ** Blinky Test ** [13:50:39:039] ** Keir Fraser <keir.xen@gmail.com> [13:50:39:039] ** https://github.com/keirf/Greaseweazle [13:50:39:039] Serial = 3026:0001:1232:5338:4b35:004e [13:50:39:039] Flash Size = 64kB [13:50:39:039] Device ID = 0x0410 [13:50:39:039] Revision = 0x2003 [13:50:39:039] **WARNING**: 10xx8/B device returned valid IDCODE! Fake? [13:50:39:039] Testing I2C1... OK [13:50:39:039] Testing I2C2... OK [13:50:39:039] Testing SPI1... OK [13:50:39:039] Testing SPI2... OK [13:50:39:039] Testing TIM1... OK [13:50:39:039] Testing TIM2... OK [13:50:39:039] Testing TIM3... OK [13:50:39:039] Testing TIM4... OK [13:50:39:039] DMA Test #1... OK [13:50:39:039] DMA Test #2... OK [13:50:39:039] DMA Test #3... OK [13:50:39:039] DMA Test #4... OK [13:50:39:039] Testing 64kB Flash... OK [13:50:39:055] Enable TIM4 IRQ... .OK [13:50:39:055] Testing 20kB SRAM (endless loop)................
looks ok, except for the IDCODE part
2020-01-06: flash a device
tingo@kg-bsbox:~/work/greaseweazle/Greaseweazle-v0.7$ stm32flash -b 921600 /dev/ttyUSB5 -vw alt/Blinky_Test-v0.7.hex stm32flash 0.5 http://stm32flash.sourceforge.net/ Using Parser : Intel HEX Interface serial_posix: 921600 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 0x0800115c (100.00%) Done.
good.
2020-01-06: testing the shipment of Blue Pills from AliExpress, these have CS32F103's which are clones. Connecting up to GND, +5V, A9 (tx) and A10 (rx), set BOOT0 = 1 and try it
tingo@kg-bsbox:~/work/greaseweazle/Greaseweazle-v0.7$ stm32flash -b 921600 /dev/ttyUSB5 stm32flash 0.5 http://stm32flash.sourceforge.net/ Interface serial_posix: 921600 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
and 115200
tingo@kg-bsbox:~/work/greaseweazle/Greaseweazle-v0.7$ stm32flash -b 115200 /dev/ttyUSB5 stm32flash 0.5 http://stm32flash.sourceforge.net/ Interface serial_posix: 115200 8E1 Failed to init device.
interesting - it fails at 115200.
2019-12-13: testing from shipment 2 (UT612544156CN) - no flashing at 921600 bps, flashed ok at 115200. The LED doesn't blink, and serial output says
[18:08:42:120] ** Blinky Test ** [18:08:42:120] ** Keir Fraser <keir.xen@gmail.com> [18:08:42:120] ** https://github.com/keirf/Greaseweazle [18:08:42:120] Serial = 78dc:046f:1228:1600:07e2:1607 [18:08:42:120] Flash Size = 64kB [18:08:42:120] Device ID = 0x0410 [18:08:42:120] Revision = 0x2003 [18:08:42:120] **WARNING**: 10xx8/B device returned valid IDCODE! Fake? [18:08:42:120] Testing I2C1... [Fake Chip?] **FAILED** [18:08:42:120] Testing I2C2... [Fake Chip?] **FAILED** [18:08:42:120] Testing SPI1... OK [18:08:42:120] Testing SPI2... OK [18:08:42:120] Testing TIM1... OK [18:08:42:120] Testing TIM2... OK [18:08:42:120] Testing TIM3... OK [18:08:42:120] Testing TIM4... OK [18:08:42:120] DMA Test #1... [Spurious IRQ: Fake Chip?] **FAILED** [18:08:42:152] DMA Test #2... [Spurious IRQ: Fake Chip?] [Bad Data] **FAILED** [18:08:42:152] DMA Test #3... [Spurious IRQ: Fake Chip?] [Bad Data] **FAILED** [18:08:42:152] DMA Test #4... [Spurious IRQ: Fake Chip?] [Bad Data] **FAILED** [18:08:42:152] Testing 64kB Flash... OK [18:08:42:168] Enable TIM4 IRQ... OK [18:08:42:168] Testing 20kB SRAM (endless loop)...
interesting. Programmed with the main fiormware, it shows up in /var/log/messages
Dec 13 18:21:58 kg-bsbox kernel: [2186868.814688] usb 1-3.3: new full-speed USB device number 38 using xhci_hcd Dec 13 18:21:59 kg-bsbox kernel: [2186868.915659] usb 1-3.3: New USB device found, idVendor=1209, idProduct=0001, bcdDevice= 1.00 Dec 13 18:21:59 kg-bsbox kernel: [2186868.915665] usb 1-3.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Dec 13 18:21:59 kg-bsbox kernel: [2186868.915668] usb 1-3.3: Product: Greaseweazle Dec 13 18:21:59 kg-bsbox kernel: [2186868.915671] usb 1-3.3: Manufacturer: Keir Fraser Dec 13 18:21:59 kg-bsbox kernel: [2186868.924678] cdc_acm 1-3.3:1.0: ttyACM0: USB ACM device
that's something - even if it probably doesn't work
2019-12-13: testing continues - I reset the BOOT0 jumper to zero, disconnect the bluepill from the usb-serial adapter, and connect it via usb. In /var/log/messages:
Dec 13 16:50:48 kg-bsbox kernel: [2181398.354770] usb 1-3.3: new full-speed USB device number 28 using xhci_hcd Dec 13 16:50:48 kg-bsbox kernel: [2181398.455785] usb 1-3.3: New USB device found, idVendor=1209, idProduct=0001, bcdDevice= 1.00 Dec 13 16:50:48 kg-bsbox kernel: [2181398.455790] usb 1-3.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Dec 13 16:50:48 kg-bsbox kernel: [2181398.455793] usb 1-3.3: Product: Greaseweazle Dec 13 16:50:48 kg-bsbox kernel: [2181398.455795] usb 1-3.3: Manufacturer: Keir Fraser Dec 13 16:50:48 kg-bsbox kernel: [2181398.570252] cdc_acm 1-3.3:1.0: ttyACM0: USB ACM device Dec 13 16:50:48 kg-bsbox kernel: [2181398.572231] usbcore: registered new interface driver cdc_acm Dec 13 16:50:48 kg-bsbox kernel: [2181398.572235] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
and it shows up
tingo@kg-bsbox:~$ ls -l /dev/tty[ACU]* crw-rw----+ 1 root dialout 166, 0 Dec 13 16:51 /dev/ttyACM0 crw-rw----+ 1 root dialout 188, 0 Dec 13 16:38 /dev/ttyUSB0 crw-rw----+ 1 root dialout 188, 1 Dec 13 16:38 /dev/ttyUSB1 crw-rw----+ 1 root dialout 188, 2 Dec 13 16:38 /dev/ttyUSB2 crw-rw----+ 1 root dialout 188, 3 Dec 13 16:38 /dev/ttyUSB3 crw-rw----+ 1 root dialout 188, 4 Dec 13 16:22 /dev/ttyUSB4
as /dev/ttyACM0 - nice.
2019-12-13: testing a BluePill from shipment 1(UE827417772CN) Greaseweazle - programming the Blinky firmware, to test this thin. Set BOOT0 = 1, power cycle, the program
tingo@kg-bsbox:/zs/tingo/work/greaseweazle/Greaseweazle-v0.7$ stm32flash -b 115200 -vw alt/Blinky_Test-v0.7.hex /dev/ttyUSB4 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 0x0800115c (100.00%) Done.
testing - reset BOOT0 to zero, power cycle - the LED blinks. On serial port /dev/ttyUSB4 115200, I get
[16:05:03:521] ** Blinky Test ** [16:05:03:521] ** Keir Fraser <keir.xen@gmail.com> [16:05:03:575] ** https://github.com/keirf/Greaseweazle [16:05:03:575] Serial = 2003:0105:122a:4d38:4b43:004e [16:05:03:575] Flash Size = 128kB [16:05:03:575] Device ID = 0x0410 [16:05:03:575] Revision = 0x2003 [16:05:03:575] **WARNING**: 10xx8/B device returned valid IDCODE! Fake? [16:05:03:575] Testing I2C1... OK [16:05:03:575] Testing I2C2... OK [16:05:03:575] Testing SPI1... OK [16:05:03:575] Testing SPI2... OK [16:05:03:575] Testing TIM1... OK [16:05:03:575] Testing TIM2... OK [16:05:03:575] Testing TIM3... OK [16:05:03:575] Testing TIM4... OK [16:05:03:575] DMA Test #1... OK [16:05:03:575] DMA Test #2... OK [16:05:03:575] DMA Test #3... OK [16:05:03:575] DMA Test #4... OK [16:05:03:575] Testing 64kB Flash... OK [16:05:03:651] Enable TIM4 IRQ... .OK [16:05:03:651] Testing 20kB SRAM (endless loop)....
so that looks quite all right, except for the IDCODE thing programming at 921600 bps also work
tingo@kg-bsbox:/zs/tingo/work/greaseweazle/Greaseweazle-v0.7$ stm32flash -b 921600 -vw alt/Blinky_Test-v0.7.hex /dev/ttyUSB4 stm32flash 0.5 http://stm32flash.sourceforge.net/ Using Parser : Intel HEX Interface serial_posix: 921600 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 0x0800115c (100.00%) Done.
nice. program the real firmware
tingo@kg-bsbox:/zs/tingo/work/greaseweazle/Greaseweazle-v0.7$ stm32flash -b 921600 -vw ./Greaseweazle-F1-v0.7.hex /dev/ttyUSB4 stm32flash 0.5 http://stm32flash.sourceforge.net/ Using Parser : Intel HEX Interface serial_posix: 921600 8E1 Failed to init device.
fails on 921600 bps. Works On 115200 bps
tingo@kg-bsbox:/zs/tingo/work/greaseweazle/Greaseweazle-v0.7$ stm32flash -b 115200 -vw ./Greaseweazle-F1-v0.7.hex /dev/ttyUSB4 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 0x08003d24 (100.00%) Done.
tested serveral times, consistent results.
2019-12-12: got two shipments of Blue Pill from eBay; now I have 20.
2019-11-03: found the Greaseweazle project - now a Blue Pill can be used as a flux reader. Very interesting.
2018-10-30: e1 - flashing another BluePill as DirtyJTAG, with stm32flash this time
[tingo@kg-elitebook STM32F103_Blue_Pill]$ stm32flash -w dirtyjtag.bluepill.bin -v /dev/ttyUSB1 stm32flash 0.5 http://stm32flash.sourceforge.net/ Using Parser : Raw BINARY Interface serial_posix: 57600 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 0x08002154 (100.00%) Done.
verify
[tingo@kg-elitebook STM32F103_Blue_Pill]$ stm32loader -f F1 -p /dev/ttyUSB1 Bootloader version 22 Chip id: 0x410 (STM32F10x Medium-density) Device UID: FF50-066E-51528350-87201814 Flash size: 64 KiB
verify with stm32flash
[tingo@kg-elitebook STM32F103_Blue_Pill]$ stm32flash /dev/ttyUSB1 stm32flash 0.5 http://stm32flash.sourceforge.net/ Interface serial_posix: 57600 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
ok.
2018-08-21: e1 - DirtyJTAG - reset the BOOT0 jumper to 0 (zero) again, then connect the Blue Pill via usb to the laptop.
[tingo@kg-elitebook ~]$ lsusb -d 1209:c0ca Bus 003 Device 006: ID 1209:c0ca InterBiometrics
good. Test with UrJTAG
[tingo@kg-elitebook STM32F103_Blue_Pill]$ jtag UrJTAG 2018.06 # Copyright (C) 2002, 2003 ETC s.r.o. Copyright (C) 2007, 2008, 2009 Kolja Waschk and the respective authors UrJTAG is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. There is absolutely no warranty for UrJTAG. warning: UrJTAG may damage your hardware! Type "quit" to exit, "help" for help. jtag> cable dirtyjtag error: libusb error: libusb_open() failed: -3
note to self: fix permissions issue for this device
[tingo@kg-elitebook STM32F103_Blue_Pill]$ sudo jtag UrJTAG 2018.06 # Copyright (C) 2002, 2003 ETC s.r.o. Copyright (C) 2007, 2008, 2009 Kolja Waschk and the respective authors UrJTAG is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. There is absolutely no warranty for UrJTAG. warning: UrJTAG may damage your hardware! Type "quit" to exit, "help" for help. jtag> cable dirtyjtag
so it works.
2018-08-21: e1 - flashing another Blue Pill as DirtyJTAG check it
[tingo@kg-elitebook STM32F103_Blue_Pill]$ stm32loader -f F1 -p /dev/ttyUSB0 Bootloader version 22 Chip id: 0x410 (STM32F10x Medium-density) Device UID: FF48-0674-53578375-81154229 Flash size: 64 KiB
reset, then flash it
[tingo@kg-elitebook STM32F103_Blue_Pill]$ stm32loader -e -w -p /dev/ttyUSB0 dirtyjtag.bluepill.bin Can't init. Ensure that BOOT0 is enabled and reset device
ok, reset again
[tingo@kg-elitebook STM32F103_Blue_Pill]$ stm32loader -e -w -p /dev/ttyUSB0 dirtyjtag.bluepill.bin Bootloader version 22 Chip id: 0x410 (STM32F10x Medium-density) Supply -f [family] to see flash size and device UID, e.g: -f F1 Write 256 bytes at 0x8000000 Write 256 bytes at 0x8000100 Write 256 bytes at 0x8000200 Write 256 bytes at 0x8000300 Write 256 bytes at 0x8000400 Write 256 bytes at 0x8000500 Write 256 bytes at 0x8000600 Write 256 bytes at 0x8000700 Write 256 bytes at 0x8000800 Write 256 bytes at 0x8000900 Write 256 bytes at 0x8000A00 Write 256 bytes at 0x8000B00 Write 256 bytes at 0x8000C00 Write 256 bytes at 0x8000D00 Write 256 bytes at 0x8000E00 Write 256 bytes at 0x8000F00 Write 256 bytes at 0x8001000 Write 256 bytes at 0x8001100 Write 256 bytes at 0x8001200 Write 256 bytes at 0x8001300 Write 256 bytes at 0x8001400 Write 256 bytes at 0x8001500 Write 256 bytes at 0x8001600 Write 256 bytes at 0x8001700 Write 256 bytes at 0x8001800 Write 256 bytes at 0x8001900 Write 256 bytes at 0x8001A00 Write 256 bytes at 0x8001B00 Write 256 bytes at 0x8001C00 Write 256 bytes at 0x8001D00 Write 256 bytes at 0x8001E00 Write 256 bytes at 0x8001F00 Write 256 bytes at 0x8002000 Write 256 bytes at 0x8002100
verify
[tingo@kg-elitebook STM32F103_Blue_Pill]$ stm32loader -f F1 -p /dev/ttyUSB0 Bootloader version 22 Chip id: 0x410 (STM32F10x Medium-density) Device UID: FF48-0674-53578375-81154229 Flash size: 64 KiB
ok.
2018-08-14: c1 - connecting the Blue Pill as DirtyJTAG adapter to my FreeBSD workstation, which runs
tingo@kg-core1$ uname -a FreeBSD kg-core1.kg4.no 10.4-STABLE FreeBSD 10.4-STABLE #1 r329982: Sun Feb 25 20:35:06 CET 2018 root@kg-core1.kg4.no:/usr/obj/usr/src/sys/GENERIC amd64
from /var/log/messages
Aug 14 22:08:12 kg-core1 kernel: ugen3.4: <DirtyJTAG Jean THOMAS> at usbus3 Aug 14 22:08:12 kg-core1 devd: Executing 'logger Unknown USB device: vendor 0x1209 product 0xc0ca bus uhub9' Aug 14 22:08:12 kg-core1 root: Unknown USB device: vendor 0x1209 product 0xc0ca bus uhub9
usbconfig says
root@kg-core1# usbconfig -d ugen3.4 ugen3.4: <DirtyJTAG Jean THOMAS> at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
device descriptor
root@kg-core1# usbconfig -d ugen3.4 dump_device_desc ugen3.4: <DirtyJTAG Jean THOMAS> at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0110 bDeviceClass = 0x00ff <Vendor specific> bDeviceSubClass = 0x0000 bDeviceProtocol = 0x0000 bMaxPacketSize0 = 0x0040 idVendor = 0x1209 idProduct = 0xc0ca bcdDevice = 0x0110 iManufacturer = 0x0001 <DirtyJTAG> iProduct = 0x0002 <Jean THOMAS> iSerialNumber = 0x0003 <no serial :-)> bNumConfigurations = 0x0001
and config descriptor
root@kg-core1# usbconfig -d ugen3.4 dump_curr_config_desc ugen3.4: <DirtyJTAG Jean THOMAS> at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) Configuration index 0 bLength = 0x0009 bDescriptorType = 0x0002 wTotalLength = 0x0020 bNumInterfaces = 0x0001 bConfigurationValue = 0x0001 iConfiguration = 0x0000 <no string> bmAttributes = 0x0080 bMaxPower = 0x0032 Interface 0 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0000 bNumEndpoints = 0x0002 bInterfaceClass = 0x00ff <Vendor specific> bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0040 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0040 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000
ok
2018-08-14: DirtyJTAG - program another Blue Pill check it
[tingo@kg-elitebook STM32F103_Blue_Pill]$ stm32loader -f F1 -p /dev/ttyUSB2 Bootloader version 22 Chip id: 0x410 (STM32F10x Medium-density) Device UID: FF52-066E-50568050-87203745 Flash size: 64 KiB
(using the RESET button on the Blue Pill also works)
[tingo@kg-elitebook STM32F103_Blue_Pill]$ stm32loader -e -w -f F1 -p /dev/ttyUSB2 -v dirtyjtag.bluepill.bin Bootloader version 22 Chip id: 0x410 (STM32F10x Medium-density) Device UID: FF52-066E-50568050-87203745 Flash size: 64 KiB Write 256 bytes at 0x8000000 Write 256 bytes at 0x8000100 Write 256 bytes at 0x8000200 Write 256 bytes at 0x8000300 Write 256 bytes at 0x8000400 Write 256 bytes at 0x8000500 Write 256 bytes at 0x8000600 Write 256 bytes at 0x8000700 Write 256 bytes at 0x8000800 Write 256 bytes at 0x8000900 Write 256 bytes at 0x8000A00 Write 256 bytes at 0x8000B00 Write 256 bytes at 0x8000C00 Write 256 bytes at 0x8000D00 Write 256 bytes at 0x8000E00 Write 256 bytes at 0x8000F00 Write 256 bytes at 0x8001000 Write 256 bytes at 0x8001100 Write 256 bytes at 0x8001200 Write 256 bytes at 0x8001300 Write 256 bytes at 0x8001400 Write 256 bytes at 0x8001500 Write 256 bytes at 0x8001600 Write 256 bytes at 0x8001700 Write 256 bytes at 0x8001800 Write 256 bytes at 0x8001900 Write 256 bytes at 0x8001A00 Write 256 bytes at 0x8001B00 Write 256 bytes at 0x8001C00 Write 256 bytes at 0x8001D00 Write 256 bytes at 0x8001E00 Write 256 bytes at 0x8001F00 Write 256 bytes at 0x8002000 Write 256 bytes at 0x8002100 Read 256 bytes at 0x8000000 Read 256 bytes at 0x8000100 Read 256 bytes at 0x8000200 Read 256 bytes at 0x8000300 Read 256 bytes at 0x8000400 Read 256 bytes at 0x8000500 Read 256 bytes at 0x8000600 Read 256 bytes at 0x8000700 Read 256 bytes at 0x8000800 Read 256 bytes at 0x8000900 Read 256 bytes at 0x8000A00 Read 256 bytes at 0x8000B00 Read 256 bytes at 0x8000C00 Read 256 bytes at 0x8000D00 Read 256 bytes at 0x8000E00 Read 256 bytes at 0x8000F00 Read 256 bytes at 0x8001000 Read 256 bytes at 0x8001100 Read 256 bytes at 0x8001200 Read 256 bytes at 0x8001300 Read 256 bytes at 0x8001400 Read 256 bytes at 0x8001500 Read 256 bytes at 0x8001600 Read 256 bytes at 0x8001700 Read 256 bytes at 0x8001800 Read 256 bytes at 0x8001900 Read 256 bytes at 0x8001A00 Read 256 bytes at 0x8001B00 Read 256 bytes at 0x8001C00 Read 256 bytes at 0x8001D00 Read 256 bytes at 0x8001E00 Read 256 bytes at 0x8001F00 Read 256 bytes at 0x8002000 Read 256 bytes at 0x8002100 Verification OK
ok. And it shows up in lsusb when connected (remember to set BOOT0 to 0 first) sh [tingo@kg-elitebook ~]$ lsusb -d 1209:c0ca Bus 003 Device 018: ID 1209:c0ca InterBiometrics
ok. 2018-08-14: DirtyJTAG - I unplug the Blue Pill, put the BOOT0 jumper back to normal (=0) and connect it via usb. lsusb says ```sh [tingo@kg-elitebook ~]$ lsusb -d 1209:c0ca Bus 003 Device 012: ID 1209:c0ca InterBiometrics
nice. How about UrJTAG then?
2018-08-14: DirtyJTAG - JTAG pinout
STM32 JTAG PA0 TDI PA1 TDO PA2 TCK PA3 TMS PA4 TRST PA5 SRST
2018-08-14: DirtyJTAG - getting firmware from the releases page, follow instructions, set BOOT0 jumper to 1,connect a serial adapter (MicroFTX) to the Blue Pill
MicroFTX Blue Pill +V (5V) SWD_3.3 GND SWD_GND TX A10 RX A9
note: you need to reset the Blue Pill between each stm32loader operation flash firmware
[tingo@kg-elitebook STM32F103_Blue_Pill]$ stm32loader -e -w -p /dev/ttyUSB2 -v dirtyjtag.bluepill.bin Bootloader version 22 Chip id: 0x410 (STM32F10x Medium-density) Supply -f [family] to see flash size and device UID, e.g: -f F1 Write 256 bytes at 0x8000000 Write 256 bytes at 0x8000100 Write 256 bytes at 0x8000200 Write 256 bytes at 0x8000300 Write 256 bytes at 0x8000400 Write 256 bytes at 0x8000500 Write 256 bytes at 0x8000600 Write 256 bytes at 0x8000700 Write 256 bytes at 0x8000800 Write 256 bytes at 0x8000900 Write 256 bytes at 0x8000A00 Write 256 bytes at 0x8000B00 Write 256 bytes at 0x8000C00 Write 256 bytes at 0x8000D00 Write 256 bytes at 0x8000E00 Write 256 bytes at 0x8000F00 Write 256 bytes at 0x8001000 Write 256 bytes at 0x8001100 Write 256 bytes at 0x8001200 Write 256 bytes at 0x8001300 Write 256 bytes at 0x8001400 Write 256 bytes at 0x8001500 Write 256 bytes at 0x8001600 Write 256 bytes at 0x8001700 Write 256 bytes at 0x8001800 Write 256 bytes at 0x8001900 Write 256 bytes at 0x8001A00 Write 256 bytes at 0x8001B00 Write 256 bytes at 0x8001C00 Write 256 bytes at 0x8001D00 Write 256 bytes at 0x8001E00 Write 256 bytes at 0x8001F00 Write 256 bytes at 0x8002000 Write 256 bytes at 0x8002100 Read 256 bytes at 0x8000000 Read 256 bytes at 0x8000100 Read 256 bytes at 0x8000200 Read 256 bytes at 0x8000300 Read 256 bytes at 0x8000400 Read 256 bytes at 0x8000500 Read 256 bytes at 0x8000600 Read 256 bytes at 0x8000700 Read 256 bytes at 0x8000800 Read 256 bytes at 0x8000900 Read 256 bytes at 0x8000A00 Read 256 bytes at 0x8000B00 Read 256 bytes at 0x8000C00 Read 256 bytes at 0x8000D00 Read 256 bytes at 0x8000E00 Read 256 bytes at 0x8000F00 Read 256 bytes at 0x8001000 Read 256 bytes at 0x8001100 Read 256 bytes at 0x8001200 Read 256 bytes at 0x8001300 Read 256 bytes at 0x8001400 Read 256 bytes at 0x8001500 Read 256 bytes at 0x8001600 Read 256 bytes at 0x8001700 Read 256 bytes at 0x8001800 Read 256 bytes at 0x8001900 Read 256 bytes at 0x8001A00 Read 256 bytes at 0x8001B00 Read 256 bytes at 0x8001C00 Read 256 bytes at 0x8001D00 Read 256 bytes at 0x8001E00 Read 256 bytes at 0x8001F00 Read 256 bytes at 0x8002000 Read 256 bytes at 0x8002100 Verification OK
nice. Reset and check
[tingo@kg-elitebook STM32F103_Blue_Pill]$ stm32loader -f F1 -p /dev/ttyUSB2 Bootloader version 22 Chip id: 0x410 (STM32F10x Medium-density) Device UID: FF48-066D-53578375-81162223 Flash size: 64 KiB
it says 64K flash size
2018-08-14: I soldered pins on a couple of BluePills.
2018-08-03: I created this page.
2018-08-02: package arrived into my mailbox.
2018-07-13: from a seller on eBay, I ordered 10 x STM32F103C8T6 ARM STM32 Minimum System Development Board Module For Arduino (401389247457) total price was USD 20.60, shipping included.