devanlai / dap42 Goto Github PK
View Code? Open in Web Editor NEWCMSIS-DAP debugger firmware for STM32F042Fx and STM32F103xx
License: Other
CMSIS-DAP debugger firmware for STM32F042Fx and STM32F103xx
License: Other
Hello,
Following the instructions here: https://github.com/devanlai/dap42/blob/master/FLASHING.md#dap103-stlinkv2-clone-dongle
I'm not able to flash my stlink v2 clone. I've tried both mac os and linux with the same result.
> openocd -f interface/cmsis-dap.cfg -f target/stm32f1x.cfg \
-c "init; reset halt" \
-c "stm32f1x unlock 0; reset halt" \
-c "flash erase_sector 0 0 last" \
-c "program DAP103-dapboot-combined-stlink.bin verify reset exit 0x08000000"
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Error: unable to find a matching CMSIS-DAP device
> lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 8087:0025 Intel Corp. Wireless-AC 9260 Bluetooth Adapter
Bus 002 Device 004: ID 046d:c542 Logitech, Inc. M185 compact wireless mouse
Bus 002 Device 005: ID 2109:2817 VIA Labs, Inc. USB2.0 Hub
Bus 002 Device 009: ID 0483:3748 STMicroelectronics ST-LINK/V2
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 2109:0817 VIA Labs, Inc. USB3.0 Hub
any help very much appreciated.
Newer MCUXpresso versions (>= v11.4.x) need a slightly different entry:
0x1209, 0xDA42, 64, 1, 0, 0, 0, "", 0x0000, -1, -1
I was attempting to add full JTAG into this,however I got this from openocd -d
:
Debug: 432 3354 adi_v5_jtag.c:572 jtagdp_transaction_endcheck(): jtag-dp: CTRL/STAT 0xf0000021
Error: 433 3354 adi_v5_jtag.c:580 jtagdp_transaction_endcheck(): JTAG-DP STICKY ERROR
Debug: 434 3356 target.c:1561 target_call_event_callbacks(): target event 0 (gdb-halt)
User : 435 3356 target.c:2740 handle_target(): Polling target stm32f103cb.cpu failed, trying to reexamine
Debug: 436 3356 target.c:1561 target_call_event_callbacks(): target event 21 (examine-start)
Debug: 437 3356 arm_adi_v5.c:603 dap_dp_init():
Debug: 438 3360 arm_adi_v5.c:637 dap_dp_init(): DAP: wait CDBGPWRUPACK
Debug: 439 3360 arm_adi_v5.h:428 dap_dp_poll_register(): DAP: poll 4, mask 0x20000000, value 0x20000000
Debug: 440 3366 arm_adi_v5.c:644 dap_dp_init(): DAP: wait CSYSPWRUPACK
Debug: 441 3366 arm_adi_v5.h:428 dap_dp_poll_register(): DAP: poll 4, mask 0x80000000, value 0x80000000
Debug: 442 3382 arm_adi_v5.c:785 dap_find_ap(): Found AHB-AP at AP index: 0 (IDR=0x14770011)
Debug: 443 3393 arm_adi_v5.c:712 mem_ap_init(): MEM_AP Packed Transfers: enabled
Debug: 444 3393 arm_adi_v5.c:723 mem_ap_init(): MEM_AP CFG: large data 0, long address 0, big-endian 0
Debug: 445 3401 adi_v5_jtag.c:572 jtagdp_transaction_endcheck(): jtag-dp: CTRL/STAT 0xf0000021
Error: 446 3401 adi_v5_jtag.c:580 jtagdp_transaction_endcheck(): JTAG-DP STICKY ERROR
Error: 447 3409 arm_adi_v5.c:489 mem_ap_read(): Failed to read memory at 0xe000ed04
Debug: 448 3409 target.c:2310 target_read_u32(): address: 0xe000ed00 failed
User : 449 3409 target.c:2748 handle_target(): Examination failed, GDB will be halted. Polling again in 3100ms
What is going on?
Hi!
Tried to use openocd-0.12 with a RP2040, this is what happens:
$ openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Warn : An adapter speed is not selected in the init scripts. OpenOCD will try to run the adapter at the low speed (100 kHz)
Warn : To remove this warnings and achieve reasonable communication speed with the target, set "adapter speed" or "jtag_rclk" in the init scripts.
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: FW Version = 1.0
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 100 kHz
Error: CMSIS-DAP command 0x1d not implemented
Error: CMSIS-DAP command SWD_Sequence failed.
Info : SWD DPIDR 0x0bc12477, DLPIDR 0x00000001
Error: CMSIS-DAP command 0x1d not implemented
Error: CMSIS-DAP command SWD_Sequence failed.
Info : Read incorrect DLPIDR 0xf0000001 (possibly CTRL/STAT value)
Error: CMSIS-DAP command 0x1d not implemented
Error: CMSIS-DAP command SWD_Sequence failed.
IMHO, integrating the DAP_SWD_Sequence function from newer CMSIS-DAP seems easy, will try to do it.
Have Fun!
I successfully use dap42 on a general STM32F103 board (BluePill exactly).
I guess nothing prevents JTAG be on for it. Thanks.
I tested DAP42 debug KV56, found unable to recognize the M7 kernel chip, is not the firmware does not support?
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.0
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
in procedure 'program'
in procedure 'init' called at file "embedded:startup.tcl", line 506
in procedure 'ocd_bouncer'
** OpenOCD init failed **
shutdown command invoked
Hello,
readme.md tells "Bulk endpoints for higher throughput" but make compiles a HID probe. Is it possible to compile dap42 for bulk transfer?
Thanks
Hi,
This is not really an issue but I am trying to use dap42 on an Blue Pill board with no side headers. Therefore, I would like to use the 4 pin front header (labeled swdio and swclk). I tried to redefine the GPIO PINs to use them instead of PB13/14 by modifying the file src/stm32f103/bluepill/DAP/CMSIS_DAP_config.h as follows:
From:
#define SWCLK_GPIO_PORT GPIOB
#define SWCLK_GPIO_PIN GPIO13
#define SWDIO_GPIO_PORT GPIOB
#define SWDIO_GPIO_PIN GPIO14
#define nRESET_GPIO_PORT GPIOB
#define nRESET_GPIO_PIN GPIO0
#define LED_CON_GPIO_PORT GPIOC
#define LED_CON_GPIO_PIN GPIO13
#define LED_RUN_GPIO_PORT GPIOC
#define LED_RUN_GPIO_PIN GPIO13
#define LED_ACT_GPIO_PORT GPIOC
#define LED_ACT_GPIO_PIN GPIO13
#define SWDIO_GPIO_PIN_NUM 14
TO:
#define SWCLK_GPIO_PORT GPIOA
#define SWCLK_GPIO_PIN GPIO14
#define SWDIO_GPIO_PORT GPIOA
#define SWDIO_GPIO_PIN GPIO13
#define nRESET_GPIO_PORT GPIOB
#define nRESET_GPIO_PIN GPIO0
#define LED_CON_GPIO_PORT GPIOC
#define LED_CON_GPIO_PIN GPIO13
#define LED_RUN_GPIO_PORT GPIOC
#define LED_RUN_GPIO_PIN GPIO13
#define LED_ACT_GPIO_PORT GPIOC
#define LED_ACT_GPIO_PIN GPIO13
#define SWDIO_GPIO_PIN_NUM 13
But it's not working. When I try, I get:
openocd -f /data2/dap42/openocd/interface-dap42.cfg -c 'transport select swd' -f target/nrf52.cfg
Open On-Chip Debugger 0.11.0-rc2+dev-00002-g427552c-dirty (2021-01-31-10:09)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'adapter driver' not 'interface'
swd
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 1.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Error: Error connecting DP: cannot read IDR
What am I missing?
Bạn có thể cho mình xin schematic dạng pdf hoặc png của bản dùng stm32f042f6p6. Cảm ơn bạn nhiều.
Hello,
What a great project!
Attempting to build Win10/Ubuntu 17.10 I get ...
C:\Users\randa\Desktop\CMSIS-Dap\dap42-master>make
BUILD DAP42.bin
USB/cdc.c: In function 'cdc_set_config':
USB/cdc.c:224:60: warning: passing argument 2 of 'cmp_usb_register_control_class_callback' from incompatible pointer type
cmp_usb_register_control_class_callback(INTF_CDC_DATA, cdc_control_class_request);
^
In file included from USB/cdc.c:25:0:
USB/composite_usb_conf.h:102:13: note: expected 'usbd_control_callback' but argument is of type 'int (*)(struct usbd_device *, struct usb_setup_data *, uint8_t , uint16_t *, void ()(struct usbd_device *, struct usb_setup_data ))'
extern void cmp_usb_register_control_class_callback(uint16_t interface,
^
USB/cdc.c:225:60: warning: passing argument 2 of 'cmp_usb_register_control_class_callback' from incompatible pointer type
cmp_usb_register_control_class_callback(INTF_CDC_COMM, cdc_control_class_request);
^
In file included from USB/cdc.c:25:0:
USB/composite_usb_conf.h:102:13: note: expected 'usbd_control_callback' but argument is of type 'int ()(struct usbd_device *, struct usb_setup_data *, uint8_t , uint16_t *, void ()(struct usbd_device *, struct usb_setup_data ))'
extern void cmp_usb_register_control_class_callback(uint16_t interface,
^
USB/composite_usb_conf.c: In function 'cmp_usb_set_config':
USB/composite_usb_conf.c:525:9: warning: passing argument 4 of 'usbd_register_control_callback' from incompatible pointer type
cmp_usb_dispatch_control_class_request);
^
In file included from USB/usb_common.h:25:0,
from USB/composite_usb_conf.h:22,
from USB/composite_usb_conf.c:27:
../libopencm3/include/libopencm3/usb/usbd.h:136:12: note: expected 'usbd_control_callback' but argument is of type 'int ()(struct usbd_device *, struct usb_setup_data *, uint8_t , uint16_t *, void ()(struct usbd_device *, struct usb_setup_data *))'
extern int usbd_register_control_callback(usbd_device usbd_dev, uint8_t type,
^
USB/dfu.c: In function 'dfu_set_config':
USB/dfu.c:89:55: warning: passing argument 2 of 'cmp_usb_register_control_class_callback' from incompatible pointer type
cmp_usb_register_control_class_callback(INTF_DFU, dfu_control_class_request);
^
In file included from USB/dfu.c:24:0:
USB/composite_usb_conf.h:102:13: note: expected 'usbd_control_callback' but argument is of type 'int ()(struct usbd_device *, struct usb_setup_data *, uint8_t , uint16_t *, void ()(struct usbd_device *, struct usb_setup_data ))'
extern void cmp_usb_register_control_class_callback(uint16_t interface,
^
USB/hid.c: In function 'hid_set_config':
USB/hid.c:177:9: warning: passing argument 4 of 'usbd_register_control_callback' from incompatible pointer type
hid_control_standard_request);
^
In file included from USB/hid.c:21:0:
../libopencm3/include/libopencm3/usb/usbd.h:136:12: note: expected 'usbd_control_callback' but argument is of type 'int ()(struct usbd_device *, struct usb_setup_data *, uint8_t , uint16_t *, void ()(struct usbd_device *, struct usb_setup_data *))'
extern int usbd_register_control_callback(usbd_device usbd_dev, uint8_t type,
^
USB/hid.c:179:55: warning: passing argument 2 of 'cmp_usb_register_control_class_callback' from incompatible pointer type
cmp_usb_register_control_class_callback(INTF_HID, hid_control_class_request);
^
In file included from USB/hid.c:24:0:
USB/composite_usb_conf.h:102:13: note: expected 'usbd_control_callback' but argument is of type 'int ()(struct usbd_device *, struct usb_setup_data *, uint8_t , uint16_t *, void ()(struct usbd_device *, struct usb_setup_data *))'
extern void cmp_usb_register_control_class_callback(uint16_t interface,
^
CAN/can.c: In function 'can_reconfigure':
CAN/can.c:143:9: error: too many arguments to function 'can_filter_id_mask_32bit_init'
can_filter_id_mask_32bit_init(CAN1,
^
In file included from CAN/can.c:19:0:
../libopencm3/include/libopencm3/stm32/can.h:658:6: note: declared here
void can_filter_id_mask_32bit_init(uint32_t nr, uint32_t id,
^
make[1]: *** [CAN/can.o] Error 1
make: *** [DAP42.bin] Error 2
I built against the latest openlibcm3...
Best,
Randy
Hello,
looks like I do something wrong, as I can't flash dap42 to an blue-pill.
Bus 003 Device 007: ID 1209:db42
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.10
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x1209
idProduct 0xdb42
bcdDevice 1.11
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x001b
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 254
bInterfaceSubClass 1
bInterfaceProtocol 2
iInterface 4 DAPBoot DFU
Device Firmware Upgrade Interface Descriptor:
bLength 9
bDescriptorType 33
bmAttributes 11
Will Detach
Manifestation Intolerant
Upload Supported
Download Supported
wDetachTimeout 255 milliseconds
wTransferSize 1024 bytes
bcdDFUVersion 1.10
Binary Object Store Descriptor:
bLength 5
bDescriptorType 15
wTotalLength 0x001d
bNumDeviceCaps 1
Platform Device Capability:
bLength 24
bDescriptorType 16
bDevCapabilityType 5
bReserved 0
PlatformCapabilityUUID {3408b638-09a9-47a0-8bfd-a0768815b665}
WebUSB:
bcdVersion 1.00
bVendorCode 1
iLandingPage 1 https://devanlai.github.io/webdfu/dfu-util/
can't get debug descriptor: No such file or directory
Device Status: 0x0000
(Bus Powered)
I have built DAP103-BLUEPILL-DFU.bin, as this should be the right binary, when a DFU bootloader is present.
I went in the ./src subdirectory, and started there make TARGET=STM32F103-BLUEPILL-DFUBOOT dfuse-flash
, here is the first thing, where I am struggeling: It looks like, that DAP42.bin is hardcoded, and the TARGET definition is not honored.
dfu-util -d 1209:da42,0483:df11 -a 0 -s 0x08000000:leave -D DAP42.bin
This leads to an dfu-util error:
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2020 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Invalid DFU suffix signature
A valid DFU suffix will be required in a future dfu-util release!!!
No DFU capable USB device available
However a dfu-util -l
shows:
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2020 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Found DFU: [1209:db42] ver=0111, devnum=7, cfg=1, intf=0, path="3-5.4.6", alt=0, name="DAPBoot DFU", serial="194425875177485752FF7306"
The error stays the same, when I use 'DAP103-BLUEPILL-DFU.bin' as the binary.
Same happens, when I correct the USB VID/PID address in 1209:db42,0483:df11, as this is the PID, the device appears in the device-manager.
Playing with all parameters I came up to this short command:
'dfu-util.exe -d 1209:db42 -a 0 -D DAP103-BLUEPILL-DFU.bin' , the first, where dfu-util succeded, but with an error:
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2020 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Invalid DFU suffix signature
A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 1209:db42
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download [=========================] 100% 13652 bytes
Download done.
state(7) = dfuMANIFEST, status(0) = No error condition is present
unable to read DFU status after completion
After this, the device is dead: Nothing happens, when un and re-plugging, even not a single USB-error. Its just completly dead.
I need to go back, set the BOOT0-jumper and reflash the bootloader.
Thats where I stand now clueless.
Just to make it very convenient when flashing.
Command to flash ST-Link v2 clones using a CMSIS-DAP adaptor using OpenOCD:
openocd -f interface/cmsis-dap.cfg -f target/stm32f1x.cfg \
-c init \
-c "reset halt" \
-c "stm32f1x unlock 0" \
-c reset halt" \
-c "flash erase_sector 0 0 last" \
-c "flash write_bank 0 dap103.bin 0" \
-c "flash verify_bank 0 dap103.bin 0" \
-c "reset run" -c "exit"
Might as well link the pinout too:
http://embdev.net/wikifiles_en/thumb/0/09/Stlink-clone-pinout.JPG/800px-Stlink-clone-pinout.JPG
Or, if viewed from the top (LED and MCU side) of the board,
(USB header) SWDIO GND SWCLK 3v3 (10-pin programming header)
Are there any plans to implement hardware control lines for the USB to serial port on dap42? I looked over the source and it seems to only require adding a callback to cdc_setup(), or am I missing something? Having controllable RTS and DTR is very useful when programming an MCU over serial bootloader as they can be used to reset and/or put the MCU into programming mode.
(Great project BTW, I've found it very useful when I want a quick and dirty ARM debugger and USB serial port)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.