March 9, 2025

Olimex STM32-E407 -- using ST-Link

One end of the board has a 20 pin JTAG connector. It works just fine to connect only 3 wires to a SWD type ST-Link gadget, making the connection as follows:

pin 7 (TMS) to blue wire (STlink SWDIO)
pin 9 (TCK) to yellow wire (STlink SWCLK)
pin 14 (GND) to green (GND)
STlink orange (3v) not connected

Try it!

I power up the board using 12 volts on the barrel connector. A red LED near the power connector lights up. Also a green LED next to the SD card slot lights up.

I plug the ST-Link into USB and see the usual:

Mar  9 21:39:42 trona kernel: usb 2-1.1: new full-speed USB device number 70 using ehci-pci
Mar  9 21:39:42 trona kernel: usb 2-1.1: New USB device found, idVendor=0483, idProduct=3748, bcdDevice= 1.00
Mar  9 21:39:42 trona kernel: usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Mar  9 21:39:42 trona kernel: usb 2-1.1: Product: STM32 STLink
Mar  9 21:39:42 trona kernel: usb 2-1.1: Manufacturer: STMicroelectronics
Mar  9 21:39:42 trona kernel: usb 2-1.1: SerialNumber: Rÿs#006exUTV(%g

Then I use the Makefile in my Hydra project ---

make ocd
openocd -f /usr/share/openocd/scripts/interface/stlink.cfg -f /usr/share/openocd/scripts/target/stm32f4x.cfg
Open On-Chip Debugger 0.12.0
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select '.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 2000 kHz
Info : STLINK V2J17S4 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.256011
Info : [stm32f4x.cpu] Cortex-M4 r0p1 processor detected
Info : [stm32f4x.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f4x.cpu on 3333
Info : Listening on port 3333 for gdb connections
This is great, it detected some kind of stm32f4x processor. I use "telnet localhost 4444" and try:
halt
[stm32f4x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x080017a8 msp: 0x200065c8
reg
===== arm v7m registers
(0) r0 (/32): 0x00000000
(1) r1 (/32): 0x200065e0
(2) r2 (/32): 0x00000001
(3) r3 (/32): 0x00000001
(4) r4 (/32): 0x00000000
(5) r5 (/32): 0x00000000
(6) r6 (/32): 0x00000000
(7) r7 (/32): 0x00000009
(8) r8 (/32): 0x00000000
(9) r9 (/32): 0x00000000
(10) r10 (/32): 0x00000000
(11) r11 (/32): 0x00000000
(12) r12 (/32): 0x0000000c
(13) sp (/32): 0x200065c8
(14) lr (/32): 0x080048ef
(15) pc (/32): 0x080017a8
(16) xPSR (/32): 0x61000000
(17) msp (/32): 0x200065c8
(18) psp (/32): 0x00000000
This looks good. Then
dump_image e407_orig.bin 0 0x100000
dumped 1048576 bytes in 22.654322s (45.201 KiB/s)


Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org