Error while erase flash memory (NXP LPC55S69-EVK)

Open
#1,485 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python

Research direction

Start by reproducing pyocd erase on the NXP LPC55S69-EVK and read the traceback path through pyocd/flash/eraser.py, pyocd/flash/flash.py, and pyocd/target/family/target_lpc5500.py. Compare the failing reset-and-halt operation with the reported successful MCUXpresso erase; done means pyOCD can erase the board without a transfer timeout.

Written by the indexing model from the issue text.

Description

Hi,

I'm trying to erase the flash memory from NXP LPC55S69 board, but I'm having constantly the following output error:

Connected to LPC55S69 [Running]: 02360b000046f48b00000000000000000000000097969905
pyocd> halt
Successfully halted device
pyocd> erase
Transfer failed: 
Traceback (most recent call last):
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/probe/cmsis_dap_probe.py", line 502, in read_ap_result_callback
    value = result()
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1060, in read_reg_cb
    res = transfer.get_result()
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 154, in get_result
    self.daplink._read_packet()
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1146, in _read_packet
    decoded_data = cmd.decode_data(raw_data)
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 480, in decode_data
    data = self._decode_transfer_data(data)
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 386, in _decode_transfer_data
    self._check_response(data[2])
  File "/home/daniel/.local/lib/python3.8/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/daniel/.local/lib/python3.8/site-packages/pyocd/commands/repl.py", line 96, in run_one_command
    self.context.process_command_line(line)
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/commands/execution_context.py", line 316, in process_command_line
    invoc.handler(invoc)
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/commands/execution_context.py", line 417, in execute_command
    cmd_object.execute()
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/commands/commands.py", line 915, in execute
    eraser.erase()
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/flash/eraser.py", line 79, in erase
    self._chip_erase()
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/flash/eraser.py", line 99, in _chip_erase
    region.flash.init(region.flash.Operation.ERASE)
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/flash/flash.py", line 237, in init
    self.target.reset_and_halt()
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/core/soc_target.py", line 266, in reset_and_halt
    return self.selected_core_or_raise.reset_and_halt(reset_type)
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/target/family/target_lpc5500.py", line 325, in reset_and_halt
    self.read32(CortexM.DHCSR)
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/core/memory_interface.py", line 116, in read32
    return self.read_memory(addr, 32, now)
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/coresight/cortex_m.py", line 478, in read_memory
    result = self.ap.read_memory(addr, transfer_size, now)
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
    return func(self, *args, **kwargs)
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/coresight/ap.py", line 1084, in _read_memory
    result = read_mem_cb()
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/coresight/ap.py", line 1062, in read_mem_cb
    res = result_cb()
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/coresight/dap.py", line 889, in read_ap_cb
    result = result_cb()
  File "/home/daniel/.local/lib/python3.8/site-packages/pyocd/probe/cmsis_dap_probe.py", line 507, in read_ap_result_callback
    raise self._convert_exception(error) from error
pyocd.core.exceptions.TransferTimeoutError

The DAPLink firmware is this:

# DAPLink Firmware - see https://mbed.com/daplink
Unique ID: 02360b000046f48b00000000000000000000000097969905
HIC ID: 97969905
Auto Reset: 1
Automation allowed: 1
Overflow detection: 1
Daplink Mode: Interface
Interface Version: 0254
Bootloader Version: 0254
Git SHA: f499eb6ec4a847a2b78831fe1acc856fd8eb2f28
Local Mods: 1
USB Interfaces: MSD, CDC, HID, WebUSB
Bootloader CRC: 0x09974fb3
Interface CRC: 0x7174ab4c
Remount count: 0
URL: https://os.mbed.com/platforms/LPCXpresso55S69/

If I erase through the MCUXpresso IDE, I can after use pyocd to flash the memory. However, I would like to constantly use pyocd and not depend on the MCUXpresso to erase the memory everytime I need to reprogram the flash.

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

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.

More from pyocd/pyOCD

All issues in pyocd/pyOCD

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.