pyocd / pyocd/pyOCD

Cannot flash/debug STM32WL55JC

Open
#1,465 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.5k
Forks
560
Avg merge
1h 41m
Merged PRs (30d)
3

Description

Hello,

When trying to flash a Nucleo WL55JC1 (stm32wl55jci7u) using the command pyocd flash --target STM32WL55JCIx --frequency 1800000 -O connect_mode=under-reset mbed-os-example-blinky.bin I receive transfer errors. I am running the latest ST Link firmware (3.10.3) and have installed the Keil.STM32WLxx_DFP.1.1.0-small.pack CMSIS pack for this chip using pyocd pack install but it is the same if I use the one bundled with Mbed Studio or one downloaded directly from CMSIS.

On first attempt I get:

0000574 E Transfer error while reading AHB-AP#1 ROM table: Memory transfer fault (read) @ 0xf0000fd0-0xf000102f [ap]
Traceback (most recent call last):
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/coresight/ap.py", line 797, in find_components
    cmpid.read_id_registers()
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/coresight/rom_table.py", line 124, in read_id_registers
    regs = self.ap.read_memory_block32(self.top_address + self.IDR_READ_START, self.IDR_READ_COUNT)
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/coresight/ap.py", line 1216, in _accelerated_read_memory_block32
    return self._accelerated_memory_interface.read_memory_block32(addr, size,
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/probe/stlink_probe.py", line 301, in read_memory_block32
    return conversion.byte_list_to_u32le_list(self._link.read_mem32(addr, size * 4, self._apsel, csw))
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/probe/stlink/stlink.py", line 473, in read_mem32
    return self._read_mem(addr, size, Commands.JTAG_READMEM_32BIT, self.MAXIMUM_TRANSFER_SIZE, apsel, csw)
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/probe/stlink/stlink.py", line 423, in _read_mem
    raise exc
pyocd.core.exceptions.TransferFaultError: Memory transfer fault (read) @ 0xf0000fd0-0xf000102f
0000591 I Loading /home/rikki/Mbed Programs/mbed-os-example-blinky-baremetal/BUILD/NUCLEO_WL55JC/ARMC6/mbed-os-example-blinky-baremetal.bin [load_cmd]
[==================================================] 100%
0001317 I Erased chip, programmed 23552 bytes (23 pages), skipped 0 bytes (0 pages) at 31.69 kB/s [loader]

and on subsequent attempts I get:

0000632 E Error reading AP#1 IDR: Memory transfer fault (STLink error (17): AP fault) [discovery]
Traceback (most recent call last):
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/coresight/discovery.py", line 162, in _create_1_ap
    ap = AccessPort.create(self.dp, ap_address)
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/coresight/ap.py", line 367, in create
    ap.init()
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/coresight/ap.py", line 1256, in init
    super().init()
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/coresight/ap.py", line 778, in init
    _init_hprot()
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/coresight/ap.py", line 746, in _init_hprot
    csw = AccessPort.read_reg(self, self._reg_offset + MEM_AP_CSW)
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/coresight/ap.py", line 453, in read_reg
    return self.dp.read_ap(self.address.address + addr, now)
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/coresight/dap.py", line 875, in read_ap
    result_cb = self.probe.read_ap(addr, now=False)
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/probe/stlink_probe.py", line 207, in read_ap
    result = self._link.read_dap_register(apsel, addr & 0xffff)
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/probe/stlink/stlink.py", line 521, in read_dap_register
    self._check_status(response[:2])
  File "/home/rikki/.local/lib/python3.10/site-packages/pyocd/probe/stlink/stlink.py", line 363, in _check_status
    raise self._ERROR_CLASSES[status](error_message)
pyocd.core.exceptions.TransferFaultError: Memory transfer fault (STLink error (17): AP fault)
0000657 I Loading /home/rikki/Mbed Programs/mbed-os-example-blinky-baremetal/BUILD/NUCLEO_WL55JC/ARMC6/mbed-os-example-blinky-baremetal.bin [load_cmd]
[==================================================] 100%
0001769 I Erased 24576 bytes (12 sectors), programmed 23552 bytes (23 pages), skipped 0 bytes (0 pages) at 20.69 kB/s [loader]

Is this indicating that the pack is malformed? How do I fix this?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported command with the Nucleo WL55JC1 and inspect the pyocd/coresight/ap.py, discovery.py, rom_table.py, and probe/stlink_probe.py paths named in the trace. Compare the first and subsequent AP transfer failures and verify that flashing and debugging complete without transfer faults.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.