I also encountered this trouble.

This problem due to hidapi specifications.
LPC link has three interfaces.

"LPCSIO": mi_03
"LPC-LINK2 CMSIS-DAP": mi_00 -> I want to use this Interface!!
"LPC-LINK2 DATA PORT": mi_04

But hid_open() is used first found interface(mi_03).

I tried followed patch to openocd.(not use hid_open())
And I confirmed CMSIS-DAP can work with LPCLINK2.
Please try it.


diff --git a/src/jtag/drivers/cmsis_dap_usb.c b/src/jtag/drivers/cmsis_dap_usb.c
index ee1cb533..90e429c8 100644
--- a/src/jtag/drivers/cmsis_dap_usb.c
+++ b/src/jtag/drivers/cmsis_dap_usb.c
@@ -273,11 +273,14 @@ static int cmsis_dap_usb_open(void)
                        /* check serial number matches if given */
                        if (cmsis_dap_serial != NULL) {
                                if ((cur_dev->serial_number != NULL) && 
wcscmp(cmsis_dap_serial, cur_dev->serial_number) == 0) {
+                                       dev = hid_open_path(cur_dev->path);
                                        serial_found = true;
                                        break;
                                }
-                       } else
+                       } else {
+                               dev = hid_open_path(cur_dev->path);
                                break;
+                       }
 
                        found = false;
                }
@@ -304,7 +307,8 @@ static int cmsis_dap_usb_open(void)
                return ERROR_FAIL;
        }
 
-       dev = hid_open(target_vid, target_pid, target_serial);
+       if (dev == NULL)
+               dev = hid_open(target_vid, target_pid, target_serial);
 
        if (dev == NULL) {
                LOG_ERROR("unable to open CMSIS-DAP device 0x%x:0x%x", 
target_vid, target_pid);


---

** [tickets:#255] LPC-Link2 Not Working as CMSIS-DAP**

**Status:** new
**Milestone:** 0.9.0
**Created:** Mon Nov 04, 2019 01:35 AM UTC by Donald Bailey
**Last Updated:** Mon Nov 04, 2019 01:35 AM UTC
**Owner:** nobody


Hi,

I'm working on a project with the NXP LPC824 using VisualGDB and OpenOCD. Using 
the LPCXpresso824-MAX dev board I had no trouble programming and debugging 
using OpenOCD. I have recently built my first prototype PCB for this project 
and purchased an LPC-Link2 to use as a CMSIS-DAP debugger with it. However, I 
am unable to get the LPC-Link2 to work with OpenOCD. I keep getting a 
"CMSIS-DAP command CMD_INFO failed" error.

I have flashed the CMSIS-DAP firmware to the LPC-Link2, reinstalled the 
drivers, and followed any other troubleshooting tips I could find, but with no 
success. The LPC-Link2 works when flashed with the Segger J-Link firmware and 
also with the CMSIS-DAP firmware when debugging through MCUXpresso, so it does 
not appear to be a problem with the probe or the firmware but rather something 
specific to OpenOCD. There is nothing wrong with the target board because, as a 
workaround, I have removed the target MCU from the LPCXpresso824-MAX and am 
using its external debug header to debug the target MCU on my PCB.

I am using the version of OpenOCD that comes with VisualGDB (0.10.0) but I have 
also tried the 0.10.0 version that is from the MSYS2 repositories I am on 
Windows 10.

Here is the output of my version of OpenOCD with the LPC-Link2 with debug 
turned on.
```
openocd.exe -f interface/cmsis-dap.cfg -c "debug_level 4"
Open On-Chip Debugger 0.10.0 (2019-08-28) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
User : 14 6 options.c:60 configuration_output_handler(): debug_level: 4
User : 15 9 options.c:60 configuration_output_handler():
Info : 16 13 server.c:311 add_service(): Listening on port 6666 for tcl 
connections
Info : 17 16 server.c:311 add_service(): Listening on port 4444 for telnet 
connections
Debug: 18 19 command.c:143 script_debug(): command - init init
Debug: 20 21 command.c:143 script_debug(): command - target target init
Debug: 22 23 command.c:143 script_debug(): command - target target names
Debug: 23 26 target.c:1431 handle_target_init_command(): Initializing targets...
Debug: 24 59 cmsis_dap_usb.c:251 cmsis_dap_usb_open(): Cannot read product 
string of device 0x46d:0xc232
Debug: 25 65 cmsis_dap_usb.c:251 cmsis_dap_usb_open(): Cannot read product 
string of device 0x46d:0xc231
Debug: 26 1075 cmsis_dap_usb.c:409 cmsis_dap_usb_xfer(): error reading data: 
(null)
Error: 27 1081 cmsis_dap_usb.c:503 cmsis_dap_cmd_DAP_Info(): CMSIS-DAP command 
CMD_INFO failed.
Debug: 28 1088 command.c:630 run_command(): Command 'init' failed with error 
code -107
User : 29 1103 command.c:695 command_run_line():
```

Any ideas? I have tried the NXP forums and StackExchange but noone seems to 
know anything.

Regards,
Donald


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to