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

Failures when testing programmers with pyocd and the puya py32 #1523

Open
prosper00 opened this issue Mar 31, 2023 · 17 comments
Open

Failures when testing programmers with pyocd and the puya py32 #1523

prosper00 opened this issue Mar 31, 2023 · 17 comments

Comments

@prosper00
Copy link

prosper00 commented Mar 31, 2023

Summary

      I recently bought a stack of puya py32 mcu’s after reading this article

       I’ve been testing them out using the SDK here

       I noticed that many of my daplinks and other probes fail to connect
       to this mcu with pyocd [and openocd, though I didn’t test it as
       thoroughly] when using the pack file provided by the vendor here

       I have a stack of different probes and mcu’s running daplink
       firmwares, and only one of them works OK. Most of the
       daplinks fail with:

pyocd.core.exceptions.TransferError: Unexpected ACK value (5) returned by probe

Method

      To ensure the probes are working OK, I tested each on an STM32F103C8
      mcu, as well as with a Puya PY32F002AL15. I figured the STM should be a
      good control test, as it’s a very well supported and commonplace mature
      product.

      I’m running pycod 0.34.3.dev36 – though I did also test .34.3 release as
      well with identical results.

      My OS is Ubuntu lunar (dev), on linux 5.18.13

      I prepared a firmware for each mcu, and programmed it with the following
      commands:

STM32:

$ pyocd erase --chip -t stm32f103c8; pyocd load -t stm32f103c8 ./miniblink.bin

PY32:

$ pyocd load ./Build/example-blink.hex -t py32f002x5 --config ./Misc/pyocd.yaml

      (the config file simply loads the pack file from the vendor)

$ cat pyocd.yaml
pack:
\- Misc/Puya.PY32F0xx_DFP.1.1.3.pack

Results table

Probe STM32 PY32
DAPLinks
jixin.pro DAPLINK works works
rp2040 picoprobe-cmsis-v1.0.2 works Unexpected ACK value (5)
rp2040 DapperMime works Unexpected ACK value (5)
DAPLink clear works Unexpected ACK value (5)
WCHLink Unexpected ACK value (5) Unexpected ACK value (5)
CH552 CMSIS-DAP works TransferTimeoutError
STLinks
STLinkV2 – baite STLink error (9): Get IDCODE error STLink error (9): Get IDCODE error
STLinkV2 - metal works STLink error (9): Get IDCODE error
JLinks
JlinkOB – baite works Memory transfer fault (Unspecified error.)
JlinkOB 072 – baite works RecursionError: maximum recursion depth exceeded

Details: Programmers.odt
Details from each probe are in the comments below

@prosper00
Copy link
Author

prosper00 commented Mar 31, 2023

jixin.pro DAPLINK

[Mar31 08:36] usb 3-2.2: new full-speed USB device number 89 using xhci_hcd
[  +0.146097] usb 3-2.2: New USB device found, idVendor=c251, idProduct=f001, bcdDevice= 1.00
[  +0.000006] usb 3-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0.000002] usb 3-2.2: Product: CMSIS-DAP_LU
[  +0.000002] usb 3-2.2: Manufacturer: jixin.pro
[  +0.000001] usb 3-2.2: SerialNumber: LU_2022_8888
[  +0.134068] cdc_acm 3-2.2:1.0: ttyACM1: USB ACM device
[  +0.014176] hid-generic 0003:C251:F001.00D4: hiddev2,hidraw5: USB HID v1.00 Device [jixin.pro CMSIS-DAP_LU] on usb-0000:05:00.3-2.2/input2
$ pyocd --version
0.34.3.dev36
$ pyocd list
  #   Probe/Board              Unique ID      Target  
------------------------------------------------------
  0   jixin.pro CMSIS-DAP_LU   LU_2022_8888   n/a     

STM32

$ pyocd erase --chip -t stm32f103c8; pyocd load -t stm32f103c8 ./miniblink.bin
0000942 I Erasing chip... [eraser]
0001164 I Chip erase complete [eraser]
0000971 I Loading /home/bdroy/STM32-base/libopencm3-examples/examples/stm32/f1/stm32-maple/miniblink/miniblink.bin [load_cmd]
[==================================================] 100%
0001498 I Erased 1024 bytes (1 sector), programmed 1024 bytes (1 page), skipped 0 bytes (0 pages) at 1.90 kB/s [loader]

PY32

$ pyocd load ./Build/example-blink.hex -t py32f002x5 --config ./Misc/pyocd.yaml
0000770 I Loading /home/bdroy/py32-base/Example-LL-GPIO-32f002AL15-2/Build/example-blink.hex [load_cmd]
[==================================================] 100%
0001655 I Erased 4096 bytes (1 sector), programmed 1152 bytes (9 pages), skipped 0 bytes (0 pages) at 1.27 kB/s [loader]

@prosper00
Copy link
Author

rp2040 picoprobe-cmsis-v1.0.2

[Mar30 21:35] usb 3-2.2: new full-speed USB device number 74 using xhci_hcd
[  +0.152667] usb 3-2.2: New USB device found, idVendor=2e8a, idProduct=000c, bcdDevice= 1.01
[  +0.000006] usb 3-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0.000002] usb 3-2.2: Product: Picoprobe CMSIS-DAP
[  +0.000002] usb 3-2.2: Manufacturer: Raspberry Pi
[  +0.000001] usb 3-2.2: SerialNumber: DE616C82571F2D33
[  +0.071227] cdc_acm 3-2.2:1.1: ttyACM1: USB ACM device
$ pyocd list
  #   Probe/Board                        Unique ID          Target  
--------------------------------------------------------------------
  0   Raspberry Pi Picoprobe CMSIS-DAP   DE616C82571F2D33   n/a 

STM32

$ pyocd erase --chip -t stm32f103c8; pyocd load -t stm32f103c8 ./miniblink.bin 
0000942 I Erasing chip... [eraser]
0001164 I Chip erase complete [eraser]
0000971 I Loading /home/bdroy/STM32-base/libopencm3-examples/examples/stm32/f1/stm32-maple/miniblink/miniblink.bin [load_cmd]
[==================================================] 100%
0001498 I Erased 1024 bytes (1 sector), programmed 1024 bytes (1 page), skipped 0 bytes (0 pages) at 1.90 kB/s [loader]

PY32

$ pyocd load ./Build/example-blink.hex -t py32f002x5 --config ./Misc/pyocd.yaml
0000705 C Unexpected ACK value (5) returned by probe [__main__]
Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 541, in read_dp_result_callback
    value = result()
            ^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1071, in read_reg_cb
    res = transfer.get_result()
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 157, in get_result
    self.daplink.flush()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 881, in flush
    self._read_packet()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1157, in _read_packet
    decoded_data = cmd.decode_data(raw_data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 478, in decode_data
    data = self._decode_transfer_block_data(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 447, in _decode_transfer_block_data
    self._check_response(data[3])
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 370, in _check_response
    raise DAPAccessIntf.TransferError("Unexpected ACK value (%d) returned by probe" % ack)
pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.TransferError: Unexpected ACK value (5) returned by probe

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

Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/subcommands/load_cmd.py", line 98, in invoke
    with session:
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 391, in __enter__
    self.open()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 529, in open
    self._board.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/board/board.py", line 139, in init
    self.target.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/soc_target.py", line 157, in init
    seq.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
                     ^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 446, in _connect
    connector.connect()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 255, in connect
    self._idr = self.read_idr()
                ^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 284, in read_idr
    dpidr = self._dp.read_dp(DP_IDR, now=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 792, in read_dp
    return read_dp_cb()
           ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 780, in read_dp_cb
    result = result_cb()
             ^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 546, in read_dp_result_callback
    raise self._convert_exception(error) from error
pyocd.core.exceptions.TransferError: Unexpected ACK value (5) returned by probe

@prosper00
Copy link
Author

rp2040 DapperMime

[  +0.155295] usb 3-2.2: new full-speed USB device number 76 using xhci_hcd
[  +0.146445] usb 3-2.2: New USB device found, idVendor=cafe, idProduct=4005, bcdDevice= 1.01
[  +0.000005] usb 3-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0.000003] usb 3-2.2: Product: RP2040 CMSIS-DAP
[  +0.000001] usb 3-2.2: Manufacturer: TinyUSB
[  +0.000002] usb 3-2.2: SerialNumber: ED16C62875F1D233
[  +0.112185] hid-generic 0003:CAFE:4005.00A1: hiddev2,hidraw5: USB HID v1.11 Device [TinyUSB RP2040 CMSIS-DAP] on usb-0000:05:00.3-2.2/input0
[  +0.002843] cdc_acm 3-2.2:1.1: ttyACM1: USB ACM device
$ pyocd list
  #   Probe/Board                Unique ID          Target  
------------------------------------------------------------
  0   TinyUSB RP2040 CMSIS-DAP   ED16C62875F1D233   n/a     

STM32

$ pyocd erase --chip -t stm32f103c8; pyocd load -t stm32f103c8 ./miniblink.bin 
0000942 I Erasing chip... [eraser]
0001164 I Chip erase complete [eraser]
0000971 I Loading /home/bdroy/STM32-base/libopencm3-examples/examples/stm32/f1/stm32-maple/miniblink/miniblink.bin [load_cmd]
[==================================================] 100%
0001498 I Erased 1024 bytes (1 sector), programmed 1024 bytes (1 page), skipped 0 bytes (0 pages) at 1.90 kB/s [loader]

PY32

$ pyocd load ./Build/example-blink.hex -t py32f002x5 --config ./Misc/pyocd.yaml
0000757 C Unexpected ACK value (5) returned by probe [__main__]
Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 541, in read_dp_result_callback
    value = result()
            ^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1071, in read_reg_cb
    res = transfer.get_result()
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 157, in get_result
    self.daplink.flush()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 881, in flush
    self._read_packet()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1157, in _read_packet
    decoded_data = cmd.decode_data(raw_data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 478, in decode_data
    data = self._decode_transfer_block_data(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 447, in _decode_transfer_block_data
    self._check_response(data[3])
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 370, in _check_response
    raise DAPAccessIntf.TransferError("Unexpected ACK value (%d) returned by probe" % ack)
pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.TransferError: Unexpected ACK value (5) returned by probe

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

Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/subcommands/load_cmd.py", line 98, in invoke
    with session:
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 391, in __enter__
    self.open()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 529, in open
    self._board.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/board/board.py", line 139, in init
    self.target.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/soc_target.py", line 157, in init
    seq.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
                     ^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 446, in _connect
    connector.connect()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 255, in connect
    self._idr = self.read_idr()
                ^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 284, in read_idr
    dpidr = self._dp.read_dp(DP_IDR, now=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 792, in read_dp
    return read_dp_cb()
           ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 780, in read_dp_cb
    result = result_cb()
             ^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 546, in read_dp_result_callback
    raise self._convert_exception(error) from error
pyocd.core.exceptions.TransferError: Unexpected ACK value (5) returned by probe

@prosper00
Copy link
Author

DAPLink - clear

[ +10.503617] usb 3-1.2: new full-speed USB device number 78 using xhci_hcd
[  +0.146366] usb 3-1.2: New USB device found, idVendor=c251, idProduct=f001, bcdDevice= 1.00
[  +0.000005] usb 3-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0.000003] usb 3-1.2: Product: CMSIS_DAP
[  +0.000001] usb 3-1.2: Manufacturer: CMSIS-DAP by ARM
[  +0.000002] usb 3-1.2: SerialNumber: 202108120001
[  +0.124053] cdc_acm 3-1.2:1.0: ttyACM1: USB ACM device
[  +0.014147] hid-generic 0003:C251:F001.00AF: hiddev2,hidraw5: USB HID v1.00 Device [CMSIS-DAP by ARM CMSIS_DAP] on usb-0000:05:00.3-1.2/input2
$ pyocd list
  #   Probe/Board                  Unique ID      Target  
----------------------------------------------------------
  0   CMSIS-DAP by ARM CMSIS_DAP   202108120001   n/a     

STM32

$ pyocd erase --chip -t stm32f103c8; pyocd load -t stm32f103c8 ./miniblink.bin 
0001030 I Erasing chip... [eraser]
0001270 I Chip erase complete [eraser]
0001030 I Loading /home/bdroy/STM32-base/libopencm3-examples/examples/stm32/f1/stm32-maple/miniblink/miniblink.bin [load_cmd]
[==================================================] 100%
0001612 I Erased 1024 bytes (1 sector), programmed 1024 bytes (1 page), skipped 0 bytes (0 pages) at 1.72 kB/s [loader]

PY32

$ pyocd load ./Build/example-blink.hex -t py32f002x5 --config ./Misc/pyocd.yaml
0000857 C Unexpected ACK value (5) returned by probe [__main__]
Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 541, in read_dp_result_callback
    value = result()
            ^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1071, in read_reg_cb
    res = transfer.get_result()
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 157, in get_result
    self.daplink.flush()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 881, in flush
    self._read_packet()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1157, in _read_packet
    decoded_data = cmd.decode_data(raw_data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 478, in decode_data
    data = self._decode_transfer_block_data(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 447, in _decode_transfer_block_data
    self._check_response(data[3])
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 370, in _check_response
    raise DAPAccessIntf.TransferError("Unexpected ACK value (%d) returned by probe" % ack)
pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.TransferError: Unexpected ACK value (5) returned by probe

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

Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/subcommands/load_cmd.py", line 98, in invoke
    with session:
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 391, in __enter__
    self.open()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 529, in open
    self._board.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/board/board.py", line 139, in init
    self.target.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/soc_target.py", line 157, in init
    seq.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
                     ^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 446, in _connect
    connector.connect()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 255, in connect
    self._idr = self.read_idr()
                ^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 284, in read_idr
    dpidr = self._dp.read_dp(DP_IDR, now=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 792, in read_dp
    return read_dp_cb()
           ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 780, in read_dp_cb
    result = result_cb()
             ^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 546, in read_dp_result_callback
    raise self._convert_exception(error) from error
pyocd.core.exceptions.TransferError: Unexpected ACK value (5) returned by probe

@prosper00
Copy link
Author

WCHLink

[Mar30 21:51] usb 3-1.1: new full-speed USB device number 79 using xhci_hcd
[  +0.152978] usb 3-1.1: New USB device found, idVendor=2a86, idProduct=8011, bcdDevice= 1.00
[  +0.000006] usb 3-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0.000002] usb 3-1.1: Product: WCH-Link
[  +0.000002] usb 3-1.1: Manufacturer: wch.cn
[  +0.000001] usb 3-1.1: SerialNumber: 0001A0000001
[  +0.125069] cdc_acm 3-1.1:1.0: ttyACM1: USB ACM device
[  +0.017109] hid-generic 0003:2A86:8011.00BF: hiddev2,hidraw5: USB HID v1.00 Device [wch.cn WCH-Link] on usb-0000:05:00.3-1.1/input2
$ pyocd list
  #   Probe/Board       Unique ID      Target  
-----------------------------------------------
  0   wch.cn WCH-Link   0001A0000001   n/a  

STM32

$ pyocd erase --chip -t stm32f103c8; pyocd load -t stm32f103c8 ./miniblink.bin 
0000972 C Unexpected ACK value (5) returned by probe [__main__]
Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 541, in read_dp_result_callback
    value = result()
            ^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1071, in read_reg_cb
    res = transfer.get_result()
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 157, in get_result
    self.daplink.flush()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 881, in flush
    self._read_packet()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1157, in _read_packet
    decoded_data = cmd.decode_data(raw_data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 478, in decode_data
    data = self._decode_transfer_block_data(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 447, in _decode_transfer_block_data
    self._check_response(data[3])
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 370, in _check_response
    raise DAPAccessIntf.TransferError("Unexpected ACK value (%d) returned by probe" % ack)
pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.TransferError: Unexpected ACK value (5) returned by probe

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

Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/subcommands/erase_cmd.py", line 92, in invoke
    with session:
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 391, in __enter__
    self.open()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 529, in open
    self._board.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/board/board.py", line 139, in init
    self.target.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/soc_target.py", line 157, in init
    seq.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
                     ^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 446, in _connect
    connector.connect()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 255, in connect
    self._idr = self.read_idr()
                ^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 284, in read_idr
    dpidr = self._dp.read_dp(DP_IDR, now=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 792, in read_dp
    return read_dp_cb()
           ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 780, in read_dp_cb
    result = result_cb()
             ^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 546, in read_dp_result_callback
    raise self._convert_exception(error) from error
pyocd.core.exceptions.TransferError: Unexpected ACK value (5) returned by probe
0000939 C Unexpected ACK value (5) returned by probe [__main__]
Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 541, in read_dp_result_callback
    value = result()
            ^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1071, in read_reg_cb
    res = transfer.get_result()
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 157, in get_result
    self.daplink.flush()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 881, in flush
    self._read_packet()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1157, in _read_packet
    decoded_data = cmd.decode_data(raw_data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 478, in decode_data
    data = self._decode_transfer_block_data(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 447, in _decode_transfer_block_data
    self._check_response(data[3])
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 370, in _check_response
    raise DAPAccessIntf.TransferError("Unexpected ACK value (%d) returned by probe" % ack)
pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.TransferError: Unexpected ACK value (5) returned by probe

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

Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/subcommands/load_cmd.py", line 98, in invoke
    with session:
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 391, in __enter__
    self.open()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 529, in open
    self._board.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/board/board.py", line 139, in init
    self.target.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/soc_target.py", line 157, in init
    seq.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
                     ^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 446, in _connect
    connector.connect()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 255, in connect
    self._idr = self.read_idr()
                ^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 284, in read_idr
    dpidr = self._dp.read_dp(DP_IDR, now=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 792, in read_dp
    return read_dp_cb()
           ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 780, in read_dp_cb
    result = result_cb()
             ^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 546, in read_dp_result_callback
    raise self._convert_exception(error) from error
pyocd.core.exceptions.TransferError: Unexpected ACK value (5) returned by probe

PY32

$ pyocd load ./Build/example-blink.hex -t py32f002x5 --config ./Misc/pyocd.yaml
0000795 C Unexpected ACK value (5) returned by probe [__main__]
Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 541, in read_dp_result_callback
    value = result()
            ^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1071, in read_reg_cb
    res = transfer.get_result()
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 157, in get_result
    self.daplink.flush()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 881, in flush
    self._read_packet()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1157, in _read_packet
    decoded_data = cmd.decode_data(raw_data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 478, in decode_data
    data = self._decode_transfer_block_data(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 447, in _decode_transfer_block_data
    self._check_response(data[3])
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 370, in _check_response
    raise DAPAccessIntf.TransferError("Unexpected ACK value (%d) returned by probe" % ack)
pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.TransferError: Unexpected ACK value (5) returned by probe

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

Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/subcommands/load_cmd.py", line 98, in invoke
    with session:
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 391, in __enter__
    self.open()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 529, in open
    self._board.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/board/board.py", line 139, in init
    self.target.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/soc_target.py", line 157, in init
    seq.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
                     ^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 446, in _connect
    connector.connect()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 255, in connect
    self._idr = self.read_idr()
                ^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 284, in read_idr
    dpidr = self._dp.read_dp(DP_IDR, now=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 792, in read_dp
    return read_dp_cb()
           ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 780, in read_dp_cb
    result = result_cb()
             ^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 546, in read_dp_result_callback
    raise self._convert_exception(error) from error
pyocd.core.exceptions.TransferError: Unexpected ACK value (5) returned by probe

@prosper00
Copy link
Author

prosper00 commented Mar 31, 2023

CH552 CMSIS-DAP

[  +0.278858] usb 3-2.3: new full-speed USB device number 105 using xhci_hcd
[  +0.147635] usb 3-2.3: New USB device found, idVendor=1209, idProduct=c55d, bcdDevice= 1.00
[  +0.000005] usb 3-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0.000003] usb 3-2.3: Product: CH55x CMSIS-DAP
[  +0.000001] usb 3-2.3: Manufacturer: WCH
[  +0.000002] usb 3-2.3: SerialNumber: NR
$ pyocd list
  #   Probe/Board           Unique ID   Target  
------------------------------------------------
  0   WCH CH55x CMSIS-DAP   NR          n/a     

STM32

$ pyocd erase --chip -t stm32f103c8; pyocd load -t stm32f103c8 ./miniblink.bin 
0000991 I Erasing chip... [eraser]
0001217 I Chip erase complete [eraser]
0000945 I Loading /home/bdroy/STM32-base/libopencm3-examples/examples/stm32/f1/stm32-maple/miniblink/miniblink.bin [load_cmd]
[==================================================] 100%
0001482 I Erased 1024 bytes (1 sector), programmed 1024 bytes (1 page), skipped 0 bytes (0 pages) at 1.86 kB/s [loader]

PY32

$ pyocd load ./Build/example-blink.hex -t py32f002x5 --config ./Misc/pyocd.yaml
0000780 I Loading /home/bdroy/py32-base/Example-LL-GPIO-32f002AL15-2/Build/example-blink.hex [load_cmd]
[                                                  ]   0%0001052 C  [__main__]
Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 595, in read_ap_result_callback
    value = result()
            ^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1071, in read_reg_cb
    res = transfer.get_result()
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 157, in get_result
    self.daplink.flush()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 881, in flush
    self._read_packet()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1157, in _read_packet
    decoded_data = cmd.decode_data(raw_data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 480, in decode_data
    data = self._decode_transfer_data(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 386, in _decode_transfer_data
    self._check_response(data[2])
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 366, in _check_response
    raise DAPAccessIntf.TransferTimeoutError()
pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.TransferTimeoutError

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

Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/subcommands/load_cmd.py", line 128, in invoke
    programmer.program(filename,
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/flash/file_programmer.py", line 175, in program
    self._loader.commit()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/flash/loader.py", line 295, in commit
    perf = builder.program(chip_erase=chipErase,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/flash/builder.py", line 511, in program
    flash_operation = self._sector_erase_program_double_buffer(progress_cb)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/flash/builder.py", line 915, in _sector_erase_program_double_buffer
    self.flash.erase_sector(sector.addr)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/flash/flash.py", line 372, in erase_sector
    result = self._call_function_and_wait(self.flash_algo['pc_erase_sector'], address,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/flash/flash.py", line 654, in _call_function_and_wait
    return self.wait_for_completion(timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/flash/flash.py", line 625, in wait_for_completion
    state = self.target.get_state()
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/soc_target.py", line 279, in get_state
    return self.selected_core_or_raise.get_state()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/cortex_m.py", line 918, in get_state
    dhcsr = self.read_memory(CortexM.DHCSR)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/cortex_m.py", line 481, in read_memory
    result = self.ap.read_memory(addr, transfer_size, now)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/ap.py", line 1084, in _read_memory
    result = read_mem_cb()
             ^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/ap.py", line 1062, in read_mem_cb
    res = result_cb()
          ^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 892, in read_ap_cb
    result = result_cb()
             ^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/cmsis_dap_probe.py", line 600, in read_ap_result_callback
    raise self._convert_exception(error) from error
pyocd.core.exceptions.TransferTimeoutError

@prosper00
Copy link
Author

STLinkV2 – baite

[Mar30 21:55] usb 3-1.2: new full-speed USB device number 81 using xhci_hcd
[  +0.146989] usb 3-1.2: New USB device found, idVendor=0483, idProduct=3748, bcdDevice= 1.00
[  +0.000005] usb 3-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0.000003] usb 3-1.2: Product: STM32 STLink
[  +0.000001] usb 3-1.2: Manufacturer: STMicroelectronics
[  +0.000002] usb 3-1.2: SerialNumber: h
$ pyocd list
  #   Probe/Board    Unique ID                  Target  
--------------------------------------------------------
  0   STM32 STLink   68005500110000383530524E   n/a    

STM32

$ pyocd erase --chip -t stm32f103c8; pyocd load -t stm32f103c8 ./miniblink.bin 
0000882 C STLink error (9): Get IDCODE error [__main__]
Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/subcommands/erase_cmd.py", line 92, in invoke
    with session:
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 391, in __enter__
    self.open()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 529, in open
    self._board.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/board/board.py", line 139, in init
    self.target.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/soc_target.py", line 157, in init
    seq.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
                     ^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 442, in _connect
    probe_conn.connect(self._protocol)


  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 172, in connect
    self._connect_probe(protocol)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 189, in _connect_probe
    self._probe.connect(protocol)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/stlink_probe.py", line 182, in connect
    self._link.enter_debug(STLink.Protocol.SWD)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/stlink/stlink.py", line 327, in enter_debug
    self._check_status(response)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/stlink/stlink.py", line 365, in _check_status
    raise exceptions.ProbeError(error_message)
pyocd.core.exceptions.ProbeError: STLink error (9): Get IDCODE error
0000888 C STLink error (9): Get IDCODE error [__main__]
Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/subcommands/load_cmd.py", line 98, in invoke
    with session:
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 391, in __enter__
    self.open()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 529, in open
    self._board.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/board/board.py", line 139, in init
    self.target.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/soc_target.py", line 157, in init
    seq.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
                     ^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 442, in _connect
    probe_conn.connect(self._protocol)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 172, in connect
    self._connect_probe(protocol)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 189, in _connect_probe
    self._probe.connect(protocol)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/stlink_probe.py", line 182, in connect
    self._link.enter_debug(STLink.Protocol.SWD)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/stlink/stlink.py", line 327, in enter_debug
    self._check_status(response)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/stlink/stlink.py", line 365, in _check_status
    raise exceptions.ProbeError(error_message)
pyocd.core.exceptions.ProbeError: STLink error (9): Get IDCODE error

PY32

$ pyocd load ./Build/example-blink.hex -t py32f002x5 --config ./Misc/pyocd.yaml
0000675 C STLink error (9): Get IDCODE error [__main__]
Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/subcommands/load_cmd.py", line 98, in invoke
    with session:
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 391, in __enter__
    self.open()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 529, in open
    self._board.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/board/board.py", line 139, in init
    self.target.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/soc_target.py", line 157, in init
    seq.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
                     ^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 442, in _connect
    probe_conn.connect(self._protocol)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 172, in connect
    self._connect_probe(protocol)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 189, in _connect_probe
    self._probe.connect(protocol)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/stlink_probe.py", line 182, in connect
    self._link.enter_debug(STLink.Protocol.SWD)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/stlink/stlink.py", line 327, in enter_debug
    self._check_status(response)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/stlink/stlink.py", line 365, in _check_status
    raise exceptions.ProbeError(error_message)
pyocd.core.exceptions.ProbeError: STLink error (9): Get IDCODE error

@prosper00
Copy link
Author

STLinkV2 - metal

[Mar30 21:58] usb 3-1.2: new full-speed USB device number 82 using xhci_hcd
[  +0.146746] usb 3-1.2: New USB device found, idVendor=0483, idProduct=3748, bcdDevice= 1.00
[  +0.000006] usb 3-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0.000002] usb 3-1.2: Product: STM32 STLink
[  +0.000002] usb 3-1.2: Manufacturer: STMicroelectronics
[  +0.000001] usb 3-1.2: SerialNumber: \xc2\x85m\x01\x01\x10\x13GS8LN
$ pyocd list
  #   Probe/Board    Unique ID                  Target  
--------------------------------------------------------
  0   STM32 STLink   856D010110134753384C4E00   n/a  

STM32

$ pyocd erase --chip -t stm32f103c8; pyocd load -t stm32f103c8 ./miniblink.bin 
0000910 I Erasing chip... [eraser]
0001086 I Chip erase complete [eraser]
0000885 I Loading /home/bdroy/STM32-base/libopencm3-examples/examples/stm32/f1/stm32-maple/miniblink/miniblink.bin [load_cmd]
[==================================================] 100%
0001286 I Erased 1024 bytes (1 sector), programmed 1024 bytes (1 page), skipped 0 bytes (0 pages) at 2.49 kB/s [loader]

PY32

$ pyocd load ./Build/example-blink.hex -t py32f002x5 --config ./Misc/pyocd.yaml
0000670 C STLink error (9): Get IDCODE error [__main__]
Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/subcommands/load_cmd.py", line 98, in invoke
    with session:
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 391, in __enter__
    self.open()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 529, in open
    self._board.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/board/board.py", line 139, in init
    self.target.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/soc_target.py", line 157, in init
    seq.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
                     ^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 442, in _connect
    probe_conn.connect(self._protocol)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 172, in connect
    self._connect_probe(protocol)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 189, in _connect_probe
    self._probe.connect(protocol)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/stlink_probe.py", line 182, in connect
    self._link.enter_debug(STLink.Protocol.SWD)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/stlink/stlink.py", line 327, in enter_debug
    self._check_status(response)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/stlink/stlink.py", line 365, in _check_status
    raise exceptions.ProbeError(error_message)
pyocd.core.exceptions.ProbeError: STLink error (9): Get IDCODE error

@prosper00
Copy link
Author

JlinkOB – baite

[Mar30 22:06] usb 3-1.2: new full-speed USB device number 84 using xhci_hcd
[  +0.152411] usb 3-1.2: New USB device found, idVendor=1366, idProduct=0101, bcdDevice= 1.00
[  +0.000005] usb 3-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0.000003] usb 3-1.2: Product: J-Link
[  +0.000001] usb 3-1.2: Manufacturer: SEGGER
[  +0.000002] usb 3-1.2: SerialNumber: 000000123456
$ pyocd list
  #   Probe/Board               Unique ID   Target  
----------------------------------------------------
  0   Segger J-Link (unknown)   123456      n/a 

STM32

$ pyocd erase --chip -t stm32f103c8; pyocd load -t stm32f103c8 ./miniblink.bin 
0001397 I Erasing chip... [eraser]
0001636 I Chip erase complete [eraser]
0001375 I Loading /home/bdroy/STM32-base/libopencm3-examples/examples/stm32/f1/stm32-maple/miniblink/miniblink.bin [load_cmd]
[==================================================] 100%
0001998 I Erased 1024 bytes (1 sector), programmed 1024 bytes (1 page), skipped 0 bytes (0 pages) at 1.61 kB/s [loader]

PY32

$ pyocd load ./Build/example-blink.hex -t py32f002x5 --config ./Misc/pyocd.yaml
0001146 C Memory transfer fault (Unspecified error.) [__main__]
Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/jlink_probe.py", line 407, in read_dp
    value = self._link.coresight_read(addr // 4, ap=False)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pylink/jlink.py", line 204, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pylink/jlink.py", line 3388, in coresight_read
    raise errors.JLinkException(res)
pylink.errors.JLinkException: Unspecified error.

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

Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 766, in read_dp
    result_cb = self.probe.read_dp(addr & DPADDR_MASK, now=False)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/jlink_probe.py", line 409, in read_dp
    raise self._convert_exception(exc) from exc
pyocd.core.exceptions.TransferFaultError: Memory transfer fault (Unspecified error.)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/jlink_probe.py", line 418, in write_dp
    self._link.coresight_write(addr // 4, data, ap=False)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pylink/jlink.py", line 204, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pylink/jlink.py", line 3415, in coresight_write
    raise errors.JLinkException(res)
pylink.errors.JLinkException: Unspecified error.

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

Traceback (most recent call last):
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/subcommands/load_cmd.py", line 98, in invoke
    with session:
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 391, in __enter__
    self.open()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/session.py", line 529, in open
    self._board.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/board/board.py", line 139, in init
    self.target.init()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/core/soc_target.py", line 157, in init
    seq.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
                     ^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 446, in _connect
    connector.connect()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 255, in connect
    self._idr = self.read_idr()
                ^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 284, in read_idr
    dpidr = self._dp.read_dp(DP_IDR, now=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 768, in read_dp
    self._handle_error(error, num)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 982, in _handle_error
    self.clear_sticky_err()
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 993, in clear_sticky_err
    self.write_reg(DP_ABORT, ABORT_ORUNERRCLR | ABORT_WDERRCLR | ABORT_STKERRCLR | ABORT_STKCMPCLR)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 514, in write_reg
    self.write_dp(addr, data)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/coresight/dap.py", line 808, in write_dp
    self.probe.write_dp(addr & DPADDR_MASK, data)
  File "/home/bdroy/.local/pipx/venvs/pyocd/lib/python3.11/site-packages/pyocd/probe/jlink_probe.py", line 420, in write_dp
    raise self._convert_exception(exc) from exc
pyocd.core.exceptions.TransferFaultError: Memory transfer fault (Unspecified error.)

@prosper00
Copy link
Author

JlinkOB 072

[ +42.821521] usb 3-1.2: new full-speed USB device number 85 using xhci_hcd
[  +0.146661] usb 3-1.2: New USB device found, idVendor=1366, idProduct=0105, bcdDevice= 1.00
[  +0.000007] usb 3-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0.000002] usb 3-1.2: Product: J-Link
[  +0.000002] usb 3-1.2: Manufacturer: SEGGER
[  +0.000001] usb 3-1.2: SerialNumber: 000020190417
[  +0.047049] cdc_acm 3-1.2:1.0: ttyACM1: USB ACM device
$ pyocd list
  #   Probe/Board      Unique ID   Target  
-------------------------------------------
  0   Segger SAM-ICE   20190417    n/a     

STM32

$ pyocd erase --chip -t stm32f103c8; pyocd load -t stm32f103c8 ./miniblink.bin 
0001365 I Erasing chip... [eraser]
0001577 I Chip erase complete [eraser]
0001374 I Loading /home/bdroy/STM32-base/libopencm3-examples/examples/stm32/f1/stm32-maple/miniblink/miniblink.bin [load_cmd]
[==================================================] 100%
0001908 I Erased 1024 bytes (1 sector), programmed 1024 bytes (1 page), skipped 0 bytes (0 pages) at 1.87 kB/s [loader]

PY32

$ pyocd load ./Build/example-blink.hex -t py32f002x5 --config ./Misc/pyocd.yaml
Exception ignored in sys.unraisablehook: <built-in function unraisablehook>
Exception ignored in sys.unraisablehook: <built-in function unraisablehook>
Exception ignored in sys.unraisablehook: <built-in function unraisablehook>
Exception ignored in sys.unraisablehook: <built-in function unraisablehook>
Exception ignored in sys.unraisablehook: <built-in function unraisablehook>
Exception ignored in sys.unraisablehook: <built-in function unraisablehook>
Exception ignored in sys.unraisablehook: <built-in function unraisablehook>
Exception ignored in sys.unraisablehook: <built-in function unraisablehook>
0001495 C Error: maximum recursion depth exceeded [__main__]

(See the attached .odt doc for the full text - there's like a hundred pages for this one)

@prosper00
Copy link
Author

Something I just discovered: programming works better at 3V3 Vcc. At least some of the probes that weren't working for me actually DO work, but only when running the PY32 at 3.3V. And all probes seem to work with more stability and reliability at 3.3V

@danyhm
Copy link

danyhm commented Aug 5, 2023

@prosper00 I'm having the exact same problem. which programmers did you use to connect?
the vendor mentions a py-link programer which seems like a modified jlink but I couldn't find it anywhere.

I have a st-linkvs but I can't connect to it using neither stlink nor dap link.

@prosper00
Copy link
Author

@prosper00 I'm having the exact same problem. which programmers did you use to connect?
the vendor mentions a py-link programer which seems like a modified jlink but I couldn't find it anywhere.

I have a st-linkvs but I can't connect to it using neither stlink nor dap link.

any of the jlinks generally work, but only when the target is on 3.3V

@prosper00
Copy link
Author

probably, yeah

@Bingo600
Copy link

I have used this board with success: Air32F103CBT6
https://www.aliexpress.com/item/1005004635091721.html

With the air32_daplink_v1.hex , from the below
https://gitee.com/openLuat/luatos-soc-air32f103/tree/master/AIR_Jlink_Keil

I couldn't get the "new" v2 firmware to work.
https://www.eevblog.com/forum/microcontrollers/air105-air32f103-new-chinese-arm-chips/msg5014411/#msg5014411

I programmed the Air32 w. a jlink , specifying taget as : STM32F103CB

@jonnor
Copy link

jonnor commented Apr 7, 2024

I was attempted to flash a Puya PY32F003 on the official development board (PY32F003F18P EVB) with a DAPLink (no brand on it), and got Unexpected ACK value (5). In my case, this was fixed when I plugged in the USB-C. In addition to having 3.3V connected on the DAPLink connector (which I thought would be enough?).
Just thought I would mention it, in case it can save someone else some time :) It was a rather unintuitive error for this case...

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

4 participants