PyOCD cannot connect to ARM SWDAP probe with STM32F767ZI target.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 560
- Avg merge
- 1h 41m
- Merged PRs (30d)
- 3
Description
I'm an OpenOCD defector, making my first steps in the world of PyOCD. But I can't get my microcontroller board to work. Please help.
1. Setup
1.1 Probe
I've got the official SWDAP probe from ARM (bought at L-Tek https://www.l-tek.com/web-shop/l-tek-swdap-interface/):

I flashed the latest 0254_lpc11u35_0x0000.bin DAPLink firmware to my probe (see https://github.com/ARMmbed/DAPLink/releases). So the SWDAP probe is up-to-date.
1.2 Microcontroller board
I've got a self-made board with an STM32F767ZI microcontroller. The board is powered from a USB-micro connector (which is for power only, no data). I've got a 10-pin Cortex Debug connector for SWD flashing and debugging:

I connect the SWDAP probe to my board with the ribbon cable that was shipped with my SWDAP probe.
1.3 Desktop
My desktop computer runs 64-bit Windows 10 with the latest Python 3.8. I just installed PyOCD today. I did not use pip install but I cloned the PyOCD GitHub and issued the command:
$ python setup.py install
So I got the latest development version of PyOCD. I also put the libusb dll next to python.exe in my Python 3.8 installation folder, as requested in the installation instructions.
2. Running PyOCD
2.1 Find probe
First I check if PyOCD finds the probe:
$ pyocd list
# Probe Unique ID
---------------------------------------------------------------------------
0 ARM CMSIS-DAP v1 000000800a0c882800000000000000000000000097969902
So that seems allright.
2.2 Download pack for STM32F767ZI
Unfortunately the STM32F767ZI microcontroller is not in the builtin targets. I issued the command pyocd list --targets and couldn't find it. So I download the corresponding pack Keil.STM32F7xx_DFP.2.12.0.pack from http://www.keil.com/dd2/pack/.
2.3 Start GDB server
I issue the following command to make PyOCD connect to my microcontroller and start a GDB server:pyocd gdbserver --target=stm32f767zi --pack="C:/ ... /packs/Keil.STM32F7xx_DFP.2.12.0.pack"
PyOCD immediately prints out:
0000874:INFO:board:Target type is stm32f767zi
So I believe it's time to start the GDB client.
2.4 Start GDB client
I open another Windows console, and issue the command:
$ arm-none-eabi-gdb
(gdb) target remote localhost:3333
localhost:3333: No connection could be made because the target machine actively refused it.
(gdb)
I've got no luck here.
After a few seconds, I notice the following output in the first console (the one running PyOCD):
# Note: this is output from the first console - the one running PyOCD
# -------------------------------------------------------------------
0020877:CRITICAL:__main__:Read timed out
Traceback (most recent call last):
File "C:\Python38\lib\site-packages\pyocd-0.23.1.dev10-py3.8.egg\pyocd\probe\cmsis_dap_probe.py", line 151, in open
self._link.open()
File "C:\Python38\lib\site-packages\pyocd-0.23.1.dev10-py3.8.egg\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 580, in open
self._packet_count = self._protocol.dap_info(self.ID.MAX_PACKET_COUNT)
File "C:\Python38\lib\site-packages\pyocd-0.23.1.dev10-py3.8.egg\pyocd\probe\pydapaccess\cmsis_dap_core.py", line 135, in dap_info
resp = self.interface.read()
File "C:\Python38\lib\site-packages\pyocd-0.23.1.dev10-py3.8.egg\pyocd\probe\pydapaccess\interface\pywinusb_backend.py", line 162, in read
raise DAPAccessIntf.DeviceError("Read timed out")
pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.DeviceError: Read timed out
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Python38\lib\site-packages\pyocd-0.23.1.dev10-py3.8.egg\pyocd\__main__.py", line 343, in run
self._COMMANDS[self._args.cmd](self)
File "C:\Python38\lib\site-packages\pyocd-0.23.1.dev10-py3.8.egg\pyocd\__main__.py", line 571, in do_gdbserver
with session:
File "C:\Python38\lib\site-packages\pyocd-0.23.1.dev10-py3.8.egg\pyocd\core\session.py", line 291, in __enter__
self.open()
File "C:\Python38\lib\site-packages\pyocd-0.23.1.dev10-py3.8.egg\pyocd\core\session.py", line 367, in open
self._probe.open()
File "C:\Python38\lib\site-packages\pyocd-0.23.1.dev10-py3.8.egg\pyocd\probe\cmsis_dap_probe.py", line 163, in open
six.raise_from(self._convert_exception(exc), exc)
File "<string>", line 3, in raise_from
pyocd.core.exceptions.ProbeError: Read timed out
3. Conclusion
I tried several times to get the connection working. But I keep getting the same 0020877:CRITICAL:__main__:Read timed out error (with the whole traceback after it). In fact, it doesn't matter if I do or don't start the GDB client. PyOCD throws this error after perhaps 10 or 20 seconds - no matter what I do.
Note:
The problem is not related to my board. I've flashed this board successfully with other probes using OpenOCD. So the hardware is OK.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported command with the ARM CMSIS-DAP v1 probe and STM32F767ZI pack, then trace the timeout through pyocd/probe/cmsis_dap_probe.py, pyocd/probe/pydapaccess/dap_access_cmsis_dap.py, and pywinusb_backend.py. Done means identifying and fixing the cause so gdbserver starts without the reported Read timed out error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools, embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100