Open tleggas opened 1 year ago
Can you please provide the exception log? pyocd list -vv -Odebug.traceback
should do it.
What version of pyocd, is it 0.35.1?
Are permissions configured in udev to allow access to the device?
Just a guess, but it seems like the error may be coming from the pyusb package that wraps libusb.
This might be related to the fact that the LPC Link2 firmware uses CMSIS-DAPv1, using the USB HID class. Since HID drivers are handled specially in both Windows and Linux, they aren't quite the same as regular vendor-specific USB devices. I've also had trouble using LPC Link2 with Windows and macOS apparently because it has multiple HID interfaces, which seems to confuse some USB drivers.
(I should mention that I'm not a Windows users, and haven't ever used WSL2 or usbipd. Although I'm quite sure other people have used WSL2 + usbipd, but probably for vendor-specific/bulk devices like STLink or CMSIS-DAPv2.)
I am using 0.35.1.
Here is the exception log:
$pyocd list -vv -Odebug.traceback
0000222 C array index out of range [__main__]
Traceback (most recent call last):
File "/home/tleggas/.local/lib/python3.10/site-packages/pyocd/__main__.py", line 161, in run
status = cmd.invoke()
File "/home/tleggas/.local/lib/python3.10/site-packages/pyocd/subcommands/list_cmd.py", line 94, in invoke
ConnectHelper.list_connected_probes()
File "/home/tleggas/.local/lib/python3.10/site-packages/pyocd/core/helpers.py", line 123, in list_connected_probes
ConnectHelper._print_probe_list(allProbes)
File "/home/tleggas/.local/lib/python3.10/site-packages/pyocd/core/helpers.py", line 283, in _print_probe_list
board_info = probe.associated_board_info
File "/home/tleggas/.local/lib/python3.10/site-packages/pyocd/probe/cmsis_dap_probe.py", line 219, in associated_board_info
with _TemporaryOpen(self._link):
File "/home/tleggas/.local/lib/python3.10/site-packages/pyocd/probe/cmsis_dap_probe.py", line 62, in __enter__
self._device.open()
File "/home/tleggas/.local/lib/python3.10/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
return func(self, *args, **kwargs)
File "/home/tleggas/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 761, in open
self._packet_count = self.identify(self.ID.MAX_PACKET_COUNT)
File "/home/tleggas/.local/lib/python3.10/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
return func(self, *args, **kwargs)
File "/home/tleggas/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 895, in identify
value = self._protocol.dap_info(item)
File "/home/tleggas/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/cmsis_dap_core.py", line 185, in dap_info
if resp[0] != Command.DAP_INFO:
IndexError: array index out of range
I believe I have these rules set up properly. Here is what is in /etc/udev/rules.d/
-rwxr-xr-x 1 root root 553 May 31 14:51 49-stlinkv2-1.rules
-rwxr-xr-x 1 root root 460 May 31 14:51 49-stlinkv2.rules
-rwxr-xr-x 1 root root 1034 May 31 14:51 49-stlinkv3.rules
-rwxr-xr-x 1 root root 92 May 31 14:51 49-vtlinkii.rules
-rwxr-xr-x 1 root root 718 May 31 14:51 49-wch-link.rules
-rwxr-xr-x 1 root root 2899 May 31 14:51 50-cmsis-dap.rules
-rwxr-xr-x 1 root root 453 May 31 14:51 50-picoprobe.rules
-rwxr-xr-x 1 root root 63312 May 1 17:36 70-snap.snapd.rules
Thanks for the quick reply!
Thanks for the log.
The "C" part on the error message confused me. 😆 That just means it's a critical log message. It doesn't have anything to do with C code, so it's not coming from pyusb/libusb.
Basically this means that the response packet from the first command is empty. In other words, USB is not communicating correctly. Why that's happening, I unfortunately can't say since I don't know anything about usbipd on WSL2. Sorry I'm not able to be helpful!
I'll see if I can find my LPC LinkII and test again on Windows and Linux, and maybe install WSL2. This could narrow it down to LPC LinkII compatibility versus usbipd issues. But I can't really say how long it will take.
(Your udev rules are set up correctly since it's able to communicate with the device, at least from a permissions perspective.)
Thanks for your help. I will keep working to find a solution and post results if I come to any conclusions.
Sorry I don't have a solution for you right now. If you do find something, I can add it to the documentation.
Hello I am having the same problem, running on Kubuntu 22.04
0000390 C index out of range [__main__]
Traceback (most recent call last):
File "/home/husam/.local/lib/python3.10/site-packages/pyocd/__main__.py", line 161, in run
status = cmd.invoke()
File "/home/husam/.local/lib/python3.10/site-packages/pyocd/subcommands/list_cmd.py", line 94, in invoke
ConnectHelper.list_connected_probes()
File "/home/husam/.local/lib/python3.10/site-packages/pyocd/core/helpers.py", line 123, in list_connected_probes
ConnectHelper._print_probe_list(allProbes)
File "/home/husam/.local/lib/python3.10/site-packages/pyocd/core/helpers.py", line 283, in _print_probe_list
board_info = probe.associated_board_info
File "/home/husam/.local/lib/python3.10/site-packages/pyocd/probe/cmsis_dap_probe.py", line 221, in associated_board_info
with _TemporaryOpen(self._link):
File "/home/husam/.local/lib/python3.10/site-packages/pyocd/probe/cmsis_dap_probe.py", line 64, in __enter__
self._device.open()
File "/home/husam/.local/lib/python3.10/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
return func(self, *args, **kwargs)
File "/home/husam/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 765, in open
self._packet_count = self.identify(self.ID.MAX_PACKET_COUNT)
File "/home/husam/.local/lib/python3.10/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
return func(self, *args, **kwargs)
File "/home/husam/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 899, in identify
value = self._protocol.dap_info(item)
File "/home/husam/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/cmsis_dap_core.py", line 185, in dap_info
if resp[0] != Command.DAP_INFO:
IndexError: index out of range
I added print(resp) this is the output:
b'\x00\x01\x01.0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
b''
I am using an Arduino micro running this code https://github.com/myelin/arduino-cmsis-dap/tree/master as a debugger, added in the udev rules. It works well with OpenOCD Unfortunately I don't have any other device to test with
I noticed after running any pyocd commands OpenOCD refuses to start until I reset the Arduino
I am using WSL2 with Ubuntu. To pass the USB devices to WSL I am using usbipd to attach the device so that it can be recognized when calling lsusb. After ensuring that the device is available in WSL, I try running pyocd list to see if my device is available. I am using an LPC Link2 Debugger with LPC54102 MCU.