nRF52840 Programming issues with CMSIS-DAP / pyOCD

Hello,

I'm trying to use the SKB501 Module from Skylab, containing a nRF52840.

Programming and Erasing the Chip with an Elpotronic Programmer works fine.

But Programming and Erasing just works once with a CMSIS-DAP Programmer. I tried a CMSIS-DAP from AliExpress (https://aliexpress.com/item/1005003843743542.html) and also the picoprobe firmware for RP2040, which also provides a CMSIS-DAP interface.

After erasing the flash with the Elpotronic Programmer, I can program the module one time with pyOCD together with one of the CMSIS-DAP Programmers. After this one time programming process, I can't reprogram or erase the device. I get the following error:

➜  minimal git:(f8f1133823) ✗ west build -b nrf52840_mdk -t flash
-- west build: running target flash
[0/1] Flashing nrf52840_mdk
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner pyocd
-- runners.pyocd: Flashing file: /home/user/ncs/zephyr/samples/basic/minimal/build/zephyr/zephyr.hex
0001160 C No ACK received [__main__]
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/probe/cmsis_dap_probe.py", line 440, in read_dp
    result = self._link.read_reg(reg_id, now=now)
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1066, in read_reg
    return read_reg_cb()
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1060, in read_reg_cb
    res = transfer.get_result()
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 157, in get_result
    self.daplink.flush()
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 870, in flush
    self._read_packet()
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1146, in _read_packet
    decoded_data = cmd.decode_data(raw_data)
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 478, in decode_data
    data = self._decode_transfer_block_data(data)
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 447, in _decode_transfer_block_data
    self._check_response(data[3])
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 368, in _check_response
    raise DAPAccessIntf.TransferError("No ACK received")
pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.TransferError: No ACK received

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

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/subcommands/load_cmd.py", line 96, in invoke
    with session:
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/core/session.py", line 391, in __enter__
    self.open()
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/core/session.py", line 529, in open
    self._board.init()
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/board/board.py", line 139, in init
    self.target.init()
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/core/soc_target.py", line 147, in init
    seq.invoke()
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/utility/sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/coresight/dap.py", line 443, in _connect
    connector.connect()
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/coresight/dap.py", line 252, in connect
    self._idr = self.read_idr()
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/coresight/dap.py", line 281, in read_idr
    dpidr = self._probe.read_dp(DP_IDR, now=True)
  File "/home/user/.local/lib/python3.10/site-packages/pyocd/probe/cmsis_dap_probe.py", line 443, in read_dp
    raise self._convert_exception(error) from error
pyocd.core.exceptions.TransferError: No ACK received
FATAL ERROR: command exited with status 1: pyocd flash -e sector -t nrf52840 /home/user/ncs/zephyr/samples/basic/minimal/build/zephyr/zephyr.hex
FAILED: zephyr/cmake/flash/CMakeFiles/flash /home/user/ncs/zephyr/samples/basic/minimal/build/zephyr/cmake/flash/CMakeFiles/flash 
cd /home/user/ncs/zephyr/samples/basic/minimal/build && /usr/bin/cmake -DTARGET=flash -DDEPENDENCIES="" -P /home/user/ncs/zephyr/cmake/flash/check_runner_dependencies.cmake && /usr/bin/cmake -E env /usr/bin/python3.10 -m west flash
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/user/ncs/zephyr/samples/basic/minimal/build --target flash

Any idea how to fix this? Is the nRF52840 not compatible with CMSIS-DAP Programmers?

The Pinout of the SKB501 Module is as following. GND is connected to GND, VCC is connected to 3.3V. SWDIO/SWDCLK is connected to the programmer. RESET is connected with 10k to VCC. Do I need to connect more pins, or can I leave the remaining pins floating?

Parents Reply
  • Ok, I think my direction with that the module was locked is wrong.

    The real issue was that this module doesn't have a 32k Crystal. Thus, running FW which relies on this crystal will put it into a kind of locked state.

    The elpotronic programmer was still able to program it reliable as it also controls the power supply and thus was able to program it before the module tried to switch to the 32k crystal.

    Adding these configs to prj.conf helped:

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

Children
No Data
Related