Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMSIS Dap USB Bulk SWO Doesn't Work #1754

Open
jonathanherbstgrapple opened this issue Jan 14, 2025 · 0 comments
Open

CMSIS Dap USB Bulk SWO Doesn't Work #1754

jonathanherbstgrapple opened this issue Jan 14, 2025 · 0 comments

Comments

@jonathanherbstgrapple
Copy link

jonathanherbstgrapple commented Jan 14, 2025

I have a CMSIS Dap device which supports bulk SWO. When I try to use it with pyOCD I get an exception.

Exception in thread SWVReader:
Traceback (most recent call last):
  File "venv/lib/python3.10/site-packages/pyocd/probe/cmsis_dap_probe.py", line 709, in swo_read
    data = self._link.swo_read()
  File "venv/lib/python3.10/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1041, in swo_read
    return self._interface.read_swo()
  File "venv/lib/python3.10/site-packages/pyocd/probe/pydapaccess/interface/pyusb_v2_backend.py", line 254, in read_swo
    raise DAPAccessIntf.DeviceError(f"Probe {self.serial_number} read thread exited unexpectedly") \
pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.DeviceError: Probe 0123456789 read thread exited unexpectedly

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/jonathan/.pyenv/versions/3.10.12/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "venv/lib/python3.10/site-packages/pyocd/trace/swv.py", line 200, in run
    data = self._session.probe.swo_read()
  File "venv/lib/python3.10/site-packages/pyocd/probe/cmsis_dap_probe.py", line 713, in swo_read
    raise self._convert_exception(exc) from exc
pyocd.core.exceptions.ProbeError: Probe 0123456789 read thread exited unexpectedly

I did some poking and I found that there doesn't seem to be an exception in the swo thread, but the _swo_thread_did_exit variable from PyUSBv2 is set to True when the thread is still running. I think this could happen if the PyUSBv2 instance is closed then reused. If I set _swo_thread_did_exit to false in start_swo this seems to fix the problem, but I'm not sure how this class is supposed to be treated. Should this class support closing and reusing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant