9 years, 8 months ago.

OpenOCD with Freescale K22F: Unable to open CMSIS-DAP device.


I'm trying to use OpenOCD with a K22F board from Freescale. The mbed.htm says "Version 0203", and the usb device descriptors lead me to believe that the interface chip is loaded with mBed's code rather than Freescale's OpenSDA interface code.

Therefore what I am expecting to happen is that I plug it in, a CMSIS-DAP USB HID device is presented to Windows, and OpenOCD finds it and connects to it.

Unfortunately this happens:

$ openocd-0.8.0 --debug 3 -f ../scripts/kinetis.cfg
Open On-Chip Debugger 0.8.0 (2014-04-28-08:39)
Info : 35 87 transport.c:118 allow_transports(): only one transport option; auto select 'cmsis-dap'
Debug: 36 92 adi_v5_cmsis_dap.c:246 cmsis_dap_select(): CMSIS-ADI: cmsis_dap_select
Debug: 37 97 command.c:401 register_command(): command 'cmsis-dap' is already registered in '<global>' context
Debug: 38 103 command.c:366 register_command_handler(): registering 'ocd_cmsis-dap'...
Error: 39 117 cmsis_dap_usb.c:216 cmsis_dap_usb_open(): unable to open CMSIS-DAP device
Error: 40 121 adi_v5_cmsis_dap.c:266 cmsis_dap_select(): unable to init CMSIS-DAP driver
Error: 41 127 transport.c:83 transport_select(): Error selecting 'cmsis-dap' astransport
Debug: 42 132 command.c:628 run_command(): Command failed with error code -4
User : 43 136 command.c:666 command_run_line(): Runtime Error: ../scripts/kinetis.cfg:3:
in procedure 'script'
at file "embedded:startup.tcl", line 58
in procedure 'interface' called at file "../scripts/kinetis.cfg", line 3

USBView.exe output appears correct:

[Port2]  :  USB Mass Storage Device

Device Power State:               PowerDeviceD0

       ---===>Device Information<===---
English product name: "MBED CMSIS-DAP"

Current Config Value:              0x01  -> Device Bus Speed: Full
Device Address:                    0x0C
Open Pipes:                           2

          ===>Device Descriptor<===
bLength:                           0x12
bDescriptorType:                   0x01
bcdUSB:                          0x0110
bDeviceClass:                      0x02  -> This is a Communication Device
bDeviceSubClass:                   0x00
bDeviceProtocol:                   0x00
bMaxPacketSize0:                   0x08 = (8) Bytes
idVendor:                        0x0D28 = ARM Ltd
idProduct:                       0x0204
bcdDevice:                       0x0100
iManufacturer:                     0x01
     English (United States)  "MBED"
iProduct:                          0x02
     English (United States)  "MBED CMSIS-DAP"
iSerialNumber:                     0x03
     English (United States)  "02310203E81B7E4115E78388"
bNumConfigurations:                0x01


Freescale agree that this does not work and suggest to replace the interface chip firmware with j-link stuff. See cop-out answer here: https://community.freescale.com/thread/329710

In the actual code it is because libusb's `hid_open()` function fails. Unfortunately the code doesn't attempt to retrieve the reason, and I'm not inclined to compile OpenOCD myself.

Does anyone know why this does not work?

Hi Tim, can you replace openOCD by pyOCD in KDS ? Or use eclipse for example?

Although I plugged today k22 adn do a simple test in pyOCD, it failed on flashing the binary, have to look at it why it failed.

They customizes openOCD in KDS (my believe), so I would download the latest openOCD and test it there but might not support k22.

posted by Martin Kojtal 27 Oct 2014

They provided an answer that openOCD does not currently support K22 debugging. via link https://community.freescale.com/docs/DOC-101792 . So what's your question here?

posted by Martin Kojtal 27 Oct 2014

It's "not supported" because it doesn't work. Clearly it *should* work, and I'm trying to find out why it doesn't.

posted by Tim H 27 Oct 2014
Be the first to answer this question.