pyocd / pyocd/pyOCD

STLink error (16): AP wait with NUCLEO-L452RE board

Open
#1,329 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

connecting needs feedback target under-investigation
Dominant language
Python
Stars
1.5k
Forks
560
Avg merge
1h 41m
Merged PRs (30d)
3

Description

Hello,

when I try to flash a NUCLEO-L452RE board with pyOCD i get a
STLink error (16): AP wait
When I compile the same mbed blinky project for an STM32L152 pyOCD flashes a NUCLEO-L152RE Board without a problem.

  • Updated the ST-Link Programmer on the NUCLEO-Board to the latest version.
  • I can flash both boards with openOCD and mbed cli tools.
  • I have the same problem on a Windows 10 machine and a Mac running Big Sur.
  • Board is directly connected via USB (no hubs in between).
  • I also installed both packs for stm32l152 and stm32l452
  • pyOCD reports version number 0.32.3

Command

pyocd flash --target stm32l452retx --erase=chip -0 connect_mode=under-reset mbed-20220208-2.bin

This is the terminal output:

0002880:ERROR:ap:Transfer error while reading AHB-AP#0 ROM table: STLink error (16): AP wait
Traceback (most recent call last):
  File ".../pyocd/coresight/ap.py", line 740, in find_components
    cmpid.read_id_registers()
  File ".../pyocd/coresight/rom_table.py", line 114, in read_id_registers
    regs = self.ap.read_memory_block32(self.top_address + self.IDR_READ_START, self.IDR_READ_COUNT)
  File ".../pyocd/probe/stlink_probe.py", line 270, in read_memory_block32
    return conversion.byte_list_to_u32le_list(self._link.read_mem32(addr, size * 4, self._apsel))
  File ".../pyocd/probe/stlink/stlink.py", line 385, in read_mem32
    return self._read_mem(addr, size, Commands.JTAG_READMEM_32BIT, self.MAXIMUM_TRANSFER_SIZE, apsel)
  File ".../pyocd/probe/stlink/stlink.py", line 345, in _read_mem
    raise self._ERROR_CLASSES[status](error_message)
pyocd.core.exceptions.TransferTimeoutError: STLink error (16): AP wait
0002883:CRITICAL:__main__:No cores were discovered!
Traceback (most recent call last):
  File ".../pyocd/__main__.py", line 150, in run
    status = cmd.invoke()
  File ".../pyocd/subcommands/load_cmd.py", line 96, in invoke
    with session:
  File ".../pyocd/core/session.py", line 341, in __enter__
    self.open()
  File ".../pyocd/core/session.py", line 459, in open
    self._board.init()
  File ".../pyocd/board/board.py", line 99, in init
    self.target.init()
  File ".../pyocd/core/soc_target.py", line 117, in init
    seq.invoke()
  File ".../pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
  File ".../pyocd/coresight/coresight_target.py", line 247, in check_for_cores
    raise exceptions.DebugError("No cores were discovered!")
pyocd.core.exceptions.DebugError: No cores were discovered!

I also looked at #1147 but a power down problem can not be related to mine. Board is running/idle not power down.

Any pointers to what I could check or test would be appreciated.

Stephen

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 failure with the reported pyocd flash command and compare it with the working STM32L152 case. Start in pyocd/probe/stlink_probe.py and pyocd/probe/stlink/stlink.py, then trace the AP discovery path through coresight/ap.py and rom_table.py. Done means identifying the cause of the AP wait error and confirming a fix or a documented device limitation.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.