-
Notifications
You must be signed in to change notification settings - Fork 76
Description
I have a CMSIS-DAP dongle from Aliexpress. It's based on CH32F103C8T6, supposedly a drop-in replacement of STM32F103C8T6, so I've been trying to adapt the bluepill and the stlinkv2-dongle for building a working dap42 firmware for it. The firmware gets recognized by my Windows 11 laptop, but I cannot get it to work with openocd:
$ openocd.exe -f interface/interface-dap42.cfg -f target/stm32f1x.cfg
...
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: UART via USB COM port supported
Info : CMSIS-DAP: FW Version = 2.1.0
Info : CMSIS-DAP: Serial# = 0F4100202EBC6B23CDAB70BB
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Error: Error connecting DP: cannot read IDR
I was able to use the stock firmware the dongle came with (which is now erased), so I assume my laptop, openocd install, and the dongle hardware are all fine. I made the following pin changes in DAP/CMSIS_DAP_config.h. Are there perhaps other changes needed for a new board?
#define SWCLK_GPIO_PORT GPIOB
#define SWCLK_GPIO_PIN GPIO10
#define SWDIO_GPIO_PORT GPIOB
#define SWDIO_GPIO_PIN GPIO11
As a side, is the pin mapping correct for ST-Link v2? I saw it's identical as for blue pill, but it's different from what's stated here, which agrees with my own tracing.
For reference, the CH32F103C8T6 has the following header/pin mapping:
TX: PA9
RX: PA10
TCK/CK: PB10
TMX/IO: PB11
DIO: PA13/SWDIO
CLK: PA14/SWCLK
GND: V_SS
3.3V: VDD
5V: USB VCC

