pyocd / pyocd/pyOCD

Transfer Fault programming LPC55S69 flash

Open
#760 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Probe: LPC-LINK2 CMSIS-DAP
PyOCD Version: 0.22.0
Target: LPC55s69

When start gdb-server, pyocd reported error. I killed process and start again, it would be OK.
I can reproduce the problem by steps: start -> Error occurred -> Restart -> OK -> Restart -> Error occurred -> Restart -> OK ...

I use other CMSIS-DAP probe, the problem occurred too.

Log:

C:\Python27\Scripts\pyocd gdb -t lpc55s69 -f 40000000 --persist
0000437:WARNING:common:STLink and CMSIS-DAPv2 probes are not supported because no libusb library was found.
0004373:INFO:board:Target type is lpc55s69
0004404:INFO:dap:DP IDR = 0x6ba02477 (v2 rev6)
0004419:INFO:ap:AP#0 IDR = 0x84770001 (AHB-AP var0 rev8)
0004451:INFO:ap:AP#1 IDR = 0x84770001 (AHB-AP var0 rev8)
0004467:INFO:ap:AP#2 IDR = 0x002a0000 (proprietary)
0004467:INFO:rom_table:AP#0 ROM table #0 @ 0xe00fe000 (designer=015 part=000)
0004483:INFO:rom_table:[0]<e00ff000:ROM class=1 designer=43b part=4c9>
0004483:INFO:rom_table:  AP#0 ROM table #1 @ 0xe00ff000 (designer=43b part=4c9)
0004483:INFO:rom_table:  [0]<e000e000:SCS-M33 class=9 designer=43b part=d21 devtype=00 archid=2a04 devid=0:0:0>
0004483:INFO:rom_table:  [1]<e0001000:DWT class=9 designer=43b part=d21 devtype=00 archid=1a02 devid=0:0:0>
0004483:INFO:rom_table:  [2]<e0002000:BPU class=9 designer=43b part=d21 devtype=00 archid=1a03 devid=0:0:0>
0004513:INFO:rom_table:  [3]<e0000000:ITM class=9 designer=43b part=d21 devtype=43 archid=1a01 devid=0:0:0>
0004529:INFO:rom_table:[1]<e0040000:TPIU-M33 class=9 designer=43b part=d21 devtype=11 archid=0000 devid=0:0:ca0>
0004529:INFO:rom_table:AP#1 ROM table #0 @ 0xe00fe000 (designer=015 part=000)
0004544:INFO:rom_table:[0]<e00ff000:ROM class=1 designer=43b part=4c9>
0004544:INFO:rom_table:  AP#1 ROM table #1 @ 0xe00ff000 (designer=43b part=4c9)
0004544:INFO:rom_table:  [0]<e000e000:SCS-M33 class=9 designer=43b part=d21 devtype=00 archid=2a04 devid=0:0:0>
0004544:INFO:rom_table:  [1]<e0001000:DWT class=9 designer=43b part=d21 devtype=00 archid=1a02 devid=0:0:0>
0004560:INFO:rom_table:  [2]<e0002000:BPU class=9 designer=43b part=d21 devtype=00 archid=1a03 devid=0:0:0>
0004560:INFO:rom_table:  [3]<e0000000:ITM class=9 designer=43b part=d21 devtype=43 archid=1a01 devid=0:0:0>
0004560:INFO:rom_table:[1]<e0040000:TPIU-M33 class=9 designer=43b part=d21 devtype=11 archid=0000 devid=0:0:ca0>
0004576:INFO:cortex_m_v8m:CPU core #0 is Cortex-M33 r0p3 (security ext present)
0004576:INFO:cortex_m:FPU present: FPv5-SP
0004608:INFO:cortex_m_v8m:CPU core #1 is Cortex-M33 r0p3
0004622:INFO:dwt:4 hardware watchpoints
0004638:INFO:fpb:8 hardware breakpoints, 1 literal comparators
0004654:INFO:dwt:4 hardware watchpoints
0004654:INFO:fpb:8 hardware breakpoints, 1 literal comparators
0004701:INFO:server:Semihost server started on port 4444
0004701:INFO:gdbserver:GDB server started on port 3333
0004717:INFO:server:Semihost server started on port 4445
0004717:INFO:gdbserver:GDB server started on port 3334
0013952:INFO:gdbserver:One client connected!
[                    ]   0%0014220:ERROR:gdbserver:Unhandled exception in handle_message: SWD/JTAG Transfer Fault @ 0x40034fe0-0x40034fe3
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 549, in handle_message
    reply = handler(msg[msgStart:])
  File "c:\python27\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 768, in v_command
    return self.flash_op(data)
  File "c:\python27\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 884, in flash_op
    self.flash_loader.commit()
  File "c:\python27\lib\site-packages\pyocd\flash\loader.py", line 508, in commit
    keep_unwritten=self._keep_unwritten)
  File "c:\python27\lib\site-packages\pyocd\flash\flash_builder.py", line 466, in program
    flash_operation = self._sector_erase_program_double_buffer(progress_cb)
  File "c:\python27\lib\site-packages\pyocd\flash\flash_builder.py", line 859, in _sector_erase_program_double_buffer
    self.flash.init(self.flash.Operation.ERASE)
  File "c:\python27\lib\site-packages\pyocd\flash\flash.py", line 235, in init
    self.target.reset_and_halt(Target.ResetType.SW)
  File "c:\python27\lib\site-packages\pyocd\core\coresight_target.py", line 333, in reset_and_halt
    return self.selected_core.reset_and_halt(reset_type)
  File "c:\python27\lib\site-packages\pyocd\target\builtin\target_LPC55S69JBD100.py", line 257, in reset_and_halt
    if (self.read32(base + FLASH_INT_STATUS) & 0x00000004) != 0:
  File "c:\python27\lib\site-packages\pyocd\core\memory_interface.py", line 56, in read32
    return self.read_memory(addr, 32, now)
  File "c:\python27\lib\site-packages\pyocd\coresight\cortex_m.py", line 614, in read_memory
    result = self.ap.read_memory(addr, transfer_size, now)
  File "c:\python27\lib\site-packages\pyocd\coresight\ap.py", line 564, in _read_memory
    result = read_mem_cb()
  File "c:\python27\lib\site-packages\pyocd\coresight\ap.py", line 546, in read_mem_cb
    res = result_cb()
  File "c:\python27\lib\site-packages\pyocd\coresight\dap.py", line 276, in read_ap_cb
    result = result_cb()
  File "c:\python27\lib\site-packages\pyocd\probe\cmsis_dap_probe.py", line 288, in read_ap_result_callback
    six.raise_from(self._convert_exception(error), error)
  File "c:\python27\lib\site-packages\six.py", line 737, in raise_from
    raise value
TransferFaultError: SWD/JTAG Transfer Fault @ 0x40034fe0-0x40034fe3
0014246:INFO:gdbserver:Client detached
0014247:INFO:gdbserver:Client disconnected!

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

Start with pyocd/target/builtin/target_LPC55S69JBD100.py and its reset_and_halt() method, then trace the read at 0x40034fe0 through the flash and GDB-server paths named in the traceback. Reproduce the start, error, restart sequence and confirm that repeated flash programming no longer produces a SWD/JTAG Transfer Fault.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.