h10 technical documentation Buy

SWD In-circuit programming using a STLINK-V2 programmer

This article illustrates how to use the popular and cheap STLINK-V2 In-circuit SWD programmer with the the H10 module and Berta H10 board

The STLINK V2 is a very cheap Chinese SWD programmer easily available on Internet.

This is the wiring to connect it to the Berta-H10 J2 PROG connector:

STLINK-V2 pin # Berta-H10 J12 pin # Signal name
2 9 SWDIO
3 8 GND
6 7 SWCLK
1 1 RESET

To use the STLINK V2 it is requested to install opencd on the Linux PC where is installed the H10 SDK by typing these commands:

sudo apt update
sudo apt install openocd

to launch the in-circuit type:

make flash PROGRAMMER=openocd OPENOCD_DEBUG_ADAPTER="stlink-dap"

...
### Flashing Target ###
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
dapdirect_swd
Info : STLINK V2J29S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.284462
Info : Unable to match requested speed 400 kHz, using 240 kHz
Info : Unable to match requested speed 400 kHz, using 240 kHz
Info : clock speed 240 kHz
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x0bc11477
Info : at91samd.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : at91samd.cpu: external reset detected
Info : starting gdb server for at91samd.cpu on 0
Info : Listening on port 36017 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* at91samd.cpu       cortex_m   little at91samd.cpu       reset

target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x000010bc msp: 0x20000200
Info : SAMD MCU: SAMR34J18 (256KB Flash, 32KB RAM)
auto erase enabled
wrote 49664 bytes from file /home/tanzilli/lora3a-projects/lora3a-boards/examples/sensor-node/bin/lora3a-h10/sensor-node.elf in 6.745703s (7.190 KiB/s)

verified 49484 bytes in 1.075185s (44.945 KiB/s)

shutdown command invoked
Done flashing

Links

Home page h10 technical documentation Buy