Raspberry Pi, Aliexpress blue-pill and openocd bootloader upload

philius
Posts: 2
Joined: Mon Aug 22, 2016 11:06 pm

Raspberry Pi, Aliexpress blue-pill and openocd bootloader upload

Postby philius » Wed Sep 07, 2016 12:15 am

Just like "Turn a Raspberry PI 2 into a JTAG dongle"http://www.stm32duino.com/viewtopic.php?f=37&t=940 I'm using a Raspberry Pi 2, gpio and openocd, along with very helpful instructions from Adafruit/Lady Ada https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi/overview
Here's my set-up:
Image
Image markup command not working? Here's the link: https://www.dropbox.com/s/qajbvuw4xx2g0g2/stm32-raspberry-pi.jpg?dl=0

There were some differences in the chip being programmed - mine is an stm32f103c8t6.
I had to read the documentation supplied with openocd but to build openocd.pdf you need to

Code: Select all

sudo apt-get install texinfo texlive

Then

Code: Select all

make docs


Here's the openocd.cfg I used:

Code: Select all

source [find interface/raspberrypi2-native.cfg]
transport select swd

set CHIPNAME stm32f1x
source [find target/stm32f1x.cfg]

reset_config  srst_nogate

adapter_nsrst_delay 100
adapter_nsrst_assert_width 100

flash banks
adapter_khz 300
init
targets
reset halt
stm32f1x unlock 0
reset
init
targets
program generic_boot20_pc13.bin verify exit 0x08000000
stm32f1x lock 0
reset
shutdown


and here's the output:

Code: Select all

# openocd
Open On-Chip Debugger 0.10.0-dev-00371-g81631e4 (2016-09-04-23:07)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
BCM2835 GPIO nums: swclk = 25, swdio = 24
BCM2835 GPIO config: srst = 18
srst_only separate srst_gates_jtag srst_push_pull connect_deassert_srst
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
srst_only separate srst_nogate srst_push_pull connect_deassert_srst
cortex_m reset_config sysresetreq
srst_only separate srst_nogate srst_push_pull connect_deassert_srst
adapter_nsrst_delay: 100
adapter_nsrst_assert_width: 100
#0 : stm32f1x.flash (stm32f1x) at 0x08000000, size 0x00000000, buswidth 0, chipwidth 0
adapter speed: 300 kHz
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : SWD only mode enabled (specify tck, tms, tdi and tdo gpios to add JTAG mode)
Info : clock speed 300 kHz
Info : SWD DPIDR 0x1ba01477
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f1x.cpu       cortex_m   little stm32f1x.cpu       halted
stm32f1x.cpu: target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x1ffff020 msp: 0x200001fc
Info : device id = 0x20036410
Info : flash size = 64kbytes
stm32x unlocked.
INFO: a reset or power cycle is required for the new settings to take effect.
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f1x.cpu       cortex_m   little stm32f1x.cpu       running
stm32f1x.cpu: target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x1ffff020 msp: 0x200001fc
** Programming Started **
auto erase enabled
wrote 7168 bytes from file generic_boot20_pc13.bin in 0.456441s (15.336 KiB/s)
** Programming Finished **
** Verify Started **
verified 7104 bytes in 0.113342s (61.209 KiB/s)
** Verified OK **
shutdown command invoked

I still can't upload a sketch from Arduino - no dfu-util listing, usb-serial fails to get ack-byte.

User avatar
RogerClark
Posts: 5470
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Raspberry Pi, Aliexpress blue-pill and openocd bootloader upload

Postby RogerClark » Wed Sep 07, 2016 12:49 am

Did you see the Known issues section here http://wiki.stm32duino.com/index.php?title=Blue_Pill


Return to “Black Magic Probe & other”

Who is online

Users browsing this forum: No registered users and 2 guests