wuxx / pico-lab

Apache License 2.0
14 stars 2 forks source link

unable to find a matching CMSIS-DAP device #5

Open wdevore opened 2 years ago

wdevore commented 2 years ago

I can't seem to load the basic Blinky example via the board's DAPlink. I can upload to the Pico directly just fine but not with the baseboard. This is the error i get:

EXT: hex
Open On-Chip Debugger 0.11.0-g228ede4-dirty (2022-08-14-21:19)
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>'.
Info : Hardware thread awareness created
Info : Hardware thread awareness created
Info : RP2040 Flash Bank Command
Warn : could not read product string for device 0x05e3:0x0617: Input/Output Error
Error: unable to find a matching CMSIS-DAP device

I noticed that the product-string (above) doesn't match what ``dmesg says (below):

[106627.636133] hub 2-1.4:1.0: USB hub found
[106627.636690] hub 2-1.4:1.0: 4 ports detected
[106628.010569] usb 1-1.2: new full-speed USB device number 29 using xhci_hcd
[106628.169780] usb 1-1.2: New USB device found, idVendor=0d28, idProduct=0204, bcdDevice= 1.00
[106628.169795] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[106628.169802] usb 1-1.2: Product: DAPLink CMSIS-DAP
[106628.169806] usb 1-1.2: Manufacturer: ARM
[106628.169811] usb 1-1.2: SerialNumber: 0700000100420019390000084e50364aa5a5a5a597969908
[106628.188714] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[106628.189387] scsi host7: usb-storage 1-1.2:1.0
[106628.190443] cdc_acm 1-1.2:1.1: ttyACM0: USB ACM device
[106628.192954] hid-generic 0003:0D28:0204.0019: hiddev0,hidraw1: USB HID v1.00 Device [ARM DAPLink CMSIS-DAP] on usb-0000:00:14.0-1.2/input3

I tried manually putting the serial number in the cmsis config file but that didn't help.

Thoughts? I'm on a Linux box.

Thanks.

wuxx commented 2 years ago

hello, try add sudo before your command

wuxx commented 2 years ago
Instructions for linux using openocd 0.11.0

1 when compiling, you need to add support for cmsis-dap 
 $./configure --enable-cmsis-dap
2 add 2 lines to cmsis-dap.cfg
cmsis_dap_backend hid
transport select swd
3 command for reference
$sudo ./src/openocd -s tcl -f tcl/interface/cmsis-dap.cfg -f tcl/target/stm32f1x.cfg
wdevore commented 1 year ago

After researching more I found what I think is a mistake in the cmsis-dap.cfg file. It appears to have spaces in the cmsis parameter:

cmsis_ dap_ backend hid and it should be cmsis_dap_backend hid

Once I fixed that it seems to find my device based on the serial number:

sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "program test_project.elf verify reset exit"
Open On-Chip Debugger 0.11.0-g228ede4-dirty (2022-09-24-15:24)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
swd
Info : Hardware thread awareness created
Info : Hardware thread awareness created
Info : RP2040 Flash Bank Command
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: FW Version = 0256
Info : CMSIS-DAP: Serial# = 0700000100420019390000084e50364aa5a5a5a597969908
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Error: CMSIS-DAP command CMD_DAP_SWJ_CLOCK failed.
Error: No Valid JTAG Interface Configured.

Yet it still fails!

This is my .cfg file:

#
# ARM CMSIS-DAP compliant adapter
#
# http://www.keil.com/support/man/docs/dapdebug/
#

adapter driver cmsis-dap

# Optionally specify the serial number of CMSIS-DAP usb device.
#cmsis_dap_serial 02200201E6661E601B98E3B9
#cmsis_dap_serial 0700000100420019390000084e50364aa5a5a5a597969908

cmsis_dap_backend hid
transport select swd

Why does it error on both the CLOCK and JTAG when the .cfg file says swd ????

I even tried stm32f1x.cfg as the target and it still fails:

sudo openocd -f interface/cmsis-dap.cfg -f target/stm32f1x.cfg -c "program test_project.elf verify reset exit"
[sudo] password for iposthuman: 
Open On-Chip Debugger 0.11.0-g228ede4-dirty (2022-09-24-15:24)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
swd
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: FW Version = 0256
Info : CMSIS-DAP: Serial# = 0700000100420019390000084e50364aa5a5a5a597969908
Info : CMSIS-DAP: Interface Initialised (SWD)
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
Error: Error connecting DP: cannot read IDR
Info : DAP init failed
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked
wuxx commented 1 year ago

Hello, please check the wiring and power supply, The log shows that the DAP itself is OK, but the target chip is not detected (usually a wiring problem)

AlexanderHD27 commented 1 year ago

hello, try add sudo before your command

This works for me. Is there a group I could add the my user to (in my case it's impractical running openocd as root)? It seems like (at least in my case) a permission problem.