pyOCD icon indicating copy to clipboard operation
pyOCD copied to clipboard

No cores were discovered with LPC845

Open jpmzometa opened this issue 3 years ago • 19 comments

I'm getting the error 'No cores were discovered'. This happens after successfully flashing a valid program. If I erase the chip (using MCUXpresso, the official IDE for LPC845), the pyocd is able to detect the cores again.

This might be related to issue #743 . But this an NXP LPC845, so the solution proposed there does not work here.

pyocd erase -vv --chip -t lpc845 -O reset_type=hw
0000439:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=1bcf PID=2c94). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000441:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=05f3 PID=0007). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000441:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=145f PID=0263). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000442:DEBUG:pyusb_v2_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=1bcf PID=2c94). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000443:DEBUG:pyusb_v2_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=05f3 PID=0007). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000443:DEBUG:pyusb_v2_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=145f PID=0263). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000768:DEBUG:session:Project directory: /home/pablo/pyocd2
0000936:WARNING:cmsis_pack:Overlapping memory regions in file <zipfile.ZipFile filename='/home/pablo/.local/share/cmsis-pack-manager/NXP/LPC845_DFP/12.3.0.pack' mode='r'>, deleting outer region. Further warnings will be suppressed for this file.
0000956:INFO:board:Target type is lpc845
0000957:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=1bcf PID=2c94). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000959:DEBUG:pyusb_backend:Detaching Kernel Driver of Interface 0 from USB device (VID=1fc9 PID=0090).
0000965:DEBUG:dap_access_cmsis_dap:CMSIS-DAP probe I3F4M0GS firmware version: 1.10
0000971:DEBUG:sequencer:Running task load_svd
0001033:DEBUG:sequencer:Running task pre_connect
0001033:DEBUG:sequencer:Running task dp_init
0001033:DEBUG:sequencer:Running task lock_probe
0001033:DEBUG:sequencer:Running task get_probe_capabilities
0001038:DEBUG:sequencer:Running task connect
0001118:DEBUG:dap:Default wire protocol selected; using SWD
0001124:DEBUG:swj:Sending deprecated SWJ sequence to select SWD
0001134:INFO:dap:DP IDR = 0x0bc11477 (v1 MINDP rev0)
0001134:DEBUG:sequencer:Running task clear_sticky_err
0001134:DEBUG:sequencer:Running task power_up_debug
0001135:DEBUG:sequencer:Running task check_version
0001135:DEBUG:sequencer:Running task unlock_probe
0001135:DEBUG:sequencer:Running task create_discoverer
0001135:DEBUG:sequencer:Running task discovery
0001135:DEBUG:sequencer:Running task find_aps
0001139:DEBUG:sequencer:Running task create_aps
0001139:DEBUG:sequencer:Running task create_ap.0
0001140:INFO:ap:AHB-AP#0 IDR = 0x04770031 (AHB-AP var3 rev0)
0001142:DEBUG:ap:AHB-AP#0 default HPROT=3 HNONSEC=0
0001143:DEBUG:ap:AHB-AP#0 implemented HPROT=3 HNONSEC=0
0001144:DEBUG:sequencer:Running task find_components
0001144:DEBUG:sequencer:Running task init_ap.0
0001149:WARNING:rom_table:Invalid coresight component, cidr=0x0
0001149:DEBUG:sequencer:Running task create_cores
0001149:DEBUG:sequencer:Running task set_default_reset_type
0001149:DEBUG:sequencer:Running task create_components
0001149:DEBUG:sequencer:Running task check_for_cores
0001150:DEBUG:session:uninit session <pyocd.core.session.Session object at 0x7fd405854470>
0001150:DEBUG:pyusb_backend:closing interface
0001152:CRITICAL:__main__:No cores were discovered!

jpmzometa avatar Jan 20 '21 12:01 jpmzometa

Hi @jpmzometa. This is an interesting one. The key log entry is 0001149:WARNING:rom_table:Invalid coresight component, cidr=0x0.

Does the code you flashed happen to change power modes, especially enter a low power mode? The invalid CoreSight component ID is a clue that part of the chip is asleep, but it could be something else.

You can try connecting with --connect=under-reset to see if that helps. This is very often required to fully wake up devices in low power states.

flit avatar Jan 24 '21 00:01 flit

Hi @flit thanks for your reply.

pyocd erase -vv --chip -t lpc845 -O reset_type=hw --connect=under-reset results in a different error 0001156:CRITICAL:__main__:No ACK received.

I've been testing a bit, and I always get that warning WARNING:rom_table:Invalid coresight component, cidr=0x0 even if the action is successful. See for example succesfully erasing the chip (and later on succesfully flashing the chip):

pyocd erase -vv --chip -t lpc845
0000489:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=1bcf PID=2c94). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000489:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=05f3 PID=0007). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000491:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=145f PID=0263). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000492:DEBUG:pyusb_v2_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=1bcf PID=2c94). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000492:DEBUG:pyusb_v2_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=05f3 PID=0007). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000493:DEBUG:pyusb_v2_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=145f PID=0263). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000841:DEBUG:session:Project directory: /home/pablo/pyocd2
0001055:WARNING:cmsis_pack:Overlapping memory regions in file <zipfile.ZipFile filename='/home/pablo/.local/share/cmsis-pack-manager/NXP/LPC845_DFP/12.3.0.pack' mode='r'>, deleting outer region. Further warnings will be suppressed for this file.
0001076:INFO:board:Target type is lpc845
0001076:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=1bcf PID=2c94). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0001077:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=05f3 PID=0007). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0001079:DEBUG:pyusb_backend:Detaching Kernel Driver of Interface 0 from USB device (VID=1fc9 PID=0090).
0001087:DEBUG:dap_access_cmsis_dap:CMSIS-DAP probe I3F4M0GS firmware version: 1.10
0001092:DEBUG:sequencer:Running task load_svd
0001174:DEBUG:sequencer:Running task pre_connect
0001174:DEBUG:sequencer:Running task dp_init
0001174:DEBUG:sequencer:Running task lock_probe
0001174:DEBUG:sequencer:Running task get_probe_capabilities
0001179:DEBUG:sequencer:Running task connect
0001275:DEBUG:dap:Default wire protocol selected; using SWD
0001275:DEBUG:swj:Sending deprecated SWJ sequence to select SWD
0001278:INFO:dap:DP IDR = 0x0bc11477 (v1 MINDP rev0)
0001278:DEBUG:sequencer:Running task clear_sticky_err
0001279:DEBUG:sequencer:Running task power_up_debug
0001279:DEBUG:sequencer:Running task check_version
0001279:DEBUG:sequencer:Running task unlock_probe
0001279:DEBUG:sequencer:Running task create_discoverer
0001280:DEBUG:sequencer:Running task discovery
0001280:DEBUG:sequencer:Running task find_aps
0001283:DEBUG:sequencer:Running task create_aps
0001283:DEBUG:sequencer:Running task create_ap.0
0001284:INFO:ap:AHB-AP#0 IDR = 0x04770031 (AHB-AP var3 rev0)
0001285:DEBUG:ap:AHB-AP#0 default HPROT=3 HNONSEC=0
0001286:DEBUG:ap:AHB-AP#0 implemented HPROT=3 HNONSEC=0
0001288:DEBUG:sequencer:Running task find_components
0001288:DEBUG:sequencer:Running task init_ap.0
0001293:INFO:rom_table:AHB-AP#0 Class 0x1 ROM table #0 @ 0xf0000000 (designer=501 part=000)
0001296:WARNING:rom_table:Invalid coresight component, cidr=0x0
0001296:INFO:rom_table:[0]<15000c000: cidr=0, pidr=0, component invalid>
0001298:INFO:rom_table:[1]<e00ff000:ROM class=1 designer=43b part=4c0>
0001298:INFO:rom_table:  AHB-AP#0 Class 0x1 ROM table #1 @ 0xe00ff000 (designer=43b part=4c0)
0001300:INFO:rom_table:  [0]<e000e000:SCS-M0+ class=14 designer=43b part=008>
0001303:INFO:rom_table:  [1]<e0001000:DWT-M0+ class=14 designer=43b part=00a>
0001305:INFO:rom_table:  [2]<e0002000:BPU class=14 designer=43b part=00b>
0001305:DEBUG:sequencer:Running task create_cores
0001305:DEBUG:discovery:Creating SCS-M0+ component
0001307:INFO:cortex_m:CPU core #0 is Cortex-M0+ r0p1
0001308:DEBUG:sequencer:Running task set_default_reset_type
0001308:DEBUG:sequencer:Running task create_components
0001308:DEBUG:discovery:Creating DWT-M0+ component
0001311:INFO:dwt:2 hardware watchpoints
0001312:DEBUG:discovery:Creating BPU component
0001313:INFO:fpb:4 hardware breakpoints, 0 literal comparators
0001313:DEBUG:fpb:fpb has been disabled
0001313:DEBUG:sequencer:Running task check_for_cores
0001313:DEBUG:sequencer:Running task halt_on_connect
0001314:DEBUG:cortex_m:halting core 0
0001315:DEBUG:sequencer:Running task post_connect
0001315:DEBUG:sequencer:Running task post_connect_hook
0001315:DEBUG:sequencer:Running task create_flash
0001315:DEBUG:sequencer:Running task notify
0001315:INFO:eraser:Erasing chip...
0001315:DEBUG:cortex_m:halting core 0
0001316:DEBUG:cortex_m:set reset catch, core 0
0001316:DEBUG:cortex_m:halting core 0
0001318:DEBUG:cortex_m:reset, core 0, type=SW_SYSRESETREQ
0001327:DEBUG:cortex_m:clear reset catch, core 0
0001338:DEBUG:cortex_m:resuming core 0
0001338:DEBUG:manager:added=[] removed=[]
0001338:DEBUG:manager:bps after flush={}
0001350:DEBUG:cortex_m:resuming core 0
0001350:DEBUG:manager:added=[] removed=[]
0001350:DEBUG:manager:bps after flush={}
0001462:DEBUG:cortex_m:resuming core 0
0001462:DEBUG:manager:added=[] removed=[]
0001462:DEBUG:manager:bps after flush={}
0001465:INFO:eraser:Done
0001465:DEBUG:session:uninit session <pyocd.core.session.Session object at 0x7fd10dfb15f8>
0001465:DEBUG:board:uninit board <pyocd.board.board.Board object at 0x7fd10df709b0>
0001466:DEBUG:cortex_m:resuming core 0
0001466:DEBUG:manager:added=[] removed=[]
0001466:DEBUG:manager:bps after flush={}
0001469:DEBUG:pyusb_backend:closing interface

And afterwards flashing the chip works as expected:

pyocd flash -vvv -t lpc845 sbl_v1.1.hex
0000435:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=1bcf PID=2c94). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000435:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=05f3 PID=0007). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000437:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=145f PID=0263). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000437:DEBUG:pyusb_v2_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=1bcf PID=2c94). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000437:DEBUG:pyusb_v2_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=05f3 PID=0007). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000439:DEBUG:pyusb_v2_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=145f PID=0263). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000795:DEBUG:session:Project directory: /home/pablo/pyocd2
0000967:WARNING:cmsis_pack:Overlapping memory regions in file <zipfile.ZipFile filename='/home/pablo/.local/share/cmsis-pack-manager/NXP/LPC845_DFP/12.3.0.pack' mode='r'>, deleting outer region. Further warnings will be suppressed for this file.
0000985:INFO:board:Target type is lpc845
0000986:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=1bcf PID=2c94). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000986:DEBUG:pyusb_backend:[Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=05f3 PID=0007). This can probably be remedied with a udev rule. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.
0000988:DEBUG:pyusb_backend:Detaching Kernel Driver of Interface 0 from USB device (VID=1fc9 PID=0090).
0000992:DEBUG:dap_access_cmsis_dap:CMSIS-DAP probe I3F4M0GS firmware version: 1.10
0000997:DEBUG:sequencer:Running task load_svd
0001066:DEBUG:sequencer:Running task pre_connect
0001067:DEBUG:sequencer:Running task dp_init
0001067:DEBUG:sequencer:Running task lock_probe
0001067:DEBUG:sequencer:Running task get_probe_capabilities
0001067:DEBUG:sequencer:Running task connect
0001153:DEBUG:dap:Default wire protocol selected; using SWD
0001158:DEBUG:swj:Sending deprecated SWJ sequence to select SWD
0001169:INFO:dap:DP IDR = 0x0bc11477 (v1 MINDP rev0)
0001169:DEBUG:sequencer:Running task clear_sticky_err
0001169:DEBUG:sequencer:Running task power_up_debug
0001170:DEBUG:sequencer:Running task check_version
0001170:DEBUG:sequencer:Running task unlock_probe
0001170:DEBUG:sequencer:Running task create_discoverer
0001170:DEBUG:sequencer:Running task discovery
0001170:DEBUG:sequencer:Running task find_aps
0001173:DEBUG:sequencer:Running task create_aps
0001173:DEBUG:sequencer:Running task create_ap.0
0001174:INFO:ap:AHB-AP#0 IDR = 0x04770031 (AHB-AP var3 rev0)
0001177:DEBUG:ap:AHB-AP#0 default HPROT=3 HNONSEC=0
0001178:DEBUG:ap:AHB-AP#0 implemented HPROT=3 HNONSEC=0
0001179:DEBUG:sequencer:Running task find_components
0001179:DEBUG:sequencer:Running task init_ap.0
0001185:INFO:rom_table:AHB-AP#0 Class 0x1 ROM table #0 @ 0xf0000000 (designer=501 part=000)
0001188:WARNING:rom_table:Invalid coresight component, cidr=0x0
0001189:INFO:rom_table:[0]<15000c000: cidr=0, pidr=0, component invalid>
0001191:INFO:rom_table:[1]<e00ff000:ROM class=1 designer=43b part=4c0>
0001191:INFO:rom_table:  AHB-AP#0 Class 0x1 ROM table #1 @ 0xe00ff000 (designer=43b part=4c0)
0001194:INFO:rom_table:  [0]<e000e000:SCS-M0+ class=14 designer=43b part=008>
0001196:INFO:rom_table:  [1]<e0001000:DWT-M0+ class=14 designer=43b part=00a>
0001197:INFO:rom_table:  [2]<e0002000:BPU class=14 designer=43b part=00b>
0001198:DEBUG:sequencer:Running task create_cores
0001198:DEBUG:discovery:Creating SCS-M0+ component
0001200:INFO:cortex_m:CPU core #0 is Cortex-M0+ r0p1
0001200:DEBUG:sequencer:Running task set_default_reset_type
0001200:DEBUG:sequencer:Running task create_components
0001200:DEBUG:discovery:Creating DWT-M0+ component
0001202:INFO:dwt:2 hardware watchpoints
0001203:DEBUG:discovery:Creating BPU component
0001204:INFO:fpb:4 hardware breakpoints, 0 literal comparators
0001204:DEBUG:fpb:fpb has been disabled
0001204:DEBUG:sequencer:Running task check_for_cores
0001204:DEBUG:sequencer:Running task halt_on_connect
0001204:DEBUG:cortex_m:halting core 0
0001205:DEBUG:sequencer:Running task post_connect
0001205:DEBUG:sequencer:Running task post_connect_hook
0001205:DEBUG:sequencer:Running task create_flash
0001205:DEBUG:sequencer:Running task notify
0001246:DEBUG:cortex_m:halting core 0
0001247:DEBUG:cortex_m:set reset catch, core 0
0001247:DEBUG:cortex_m:halting core 0
0001248:DEBUG:cortex_m:reset, core 0, type=SW_SYSRESETREQ
0001254:DEBUG:cortex_m:clear reset catch, core 0
0001266:DEBUG:cortex_m:resuming core 0
0001267:DEBUG:manager:added=[] removed=[]
0001267:DEBUG:manager:bps after flush={}
0001412:DEBUG:builder:Analyze time: 0.137865
0001412:DEBUG:builder:Using double buffer sector erase program
[                    ]   0%0001421:DEBUG:cortex_m:halting core 0
0001425:DEBUG:cortex_m:resuming core 0
0001425:DEBUG:manager:added=[] removed=[]
0001425:DEBUG:manager:bps after flush={}
0001435:DEBUG:cortex_m:resuming core 0
0001435:DEBUG:manager:added=[] removed=[]
0001435:DEBUG:manager:bps after flush={}
0001443:DEBUG:cortex_m:resuming core 0
0001443:DEBUG:manager:added=[] removed=[]
0001443:DEBUG:manager:bps after flush={}
[                    ]   0%0001552:DEBUG:cortex_m:resuming core 0
0001552:DEBUG:manager:added=[] removed=[]
0001552:DEBUG:manager:bps after flush={}
[                    ]   1%0001660:DEBUG:cortex_m:resuming core 0
0001660:DEBUG:manager:added=[] removed=[]
0001660:DEBUG:manager:bps after flush={}
[                    ]   1%0001770:DEBUG:cortex_m:resuming core 0
0001770:DEBUG:manager:added=[] removed=[]
0001770:DEBUG:manager:bps after flush={}
[                    ]   1%0001879:DEBUG:cortex_m:resuming core 0
0001879:DEBUG:manager:added=[] removed=[]
0001879:DEBUG:manager:bps after flush={}
[                    ]   1%0001986:DEBUG:cortex_m:resuming core 0

---- PROGRESS REMOVED BY JPMZOMETA FOR CLARITY ----

[====================] 100%
0006732:DEBUG:cortex_m:resuming core 0
0006732:DEBUG:manager:added=[] removed=[]
0006732:DEBUG:manager:bps after flush={}
0006743:DEBUG:progress:progress out of bounds: 1.000
0006753:DEBUG:cortex_m:resuming core 0
0006754:DEBUG:manager:added=[] removed=[]
0006754:DEBUG:manager:bps after flush={}
0006763:DEBUG:progress:progress out of bounds: 1.000
0006767:DEBUG:cortex_m:resuming core 0
0006767:DEBUG:manager:added=[] removed=[]
0006767:DEBUG:manager:bps after flush={}
0006780:DEBUG:progress:progress out of bounds: 1.000
0006786:DEBUG:cortex_m:resuming core 0
0006786:DEBUG:manager:added=[] removed=[]
0006786:DEBUG:manager:bps after flush={}
0006790:DEBUG:builder:Estimated sector erase programmed page count: 125
0006791:DEBUG:builder:Actual sector erase programmed page count: 128
0006791:DEBUG:cortex_m:set reset catch, core 0
0006791:DEBUG:cortex_m:halting core 0
0006792:DEBUG:cortex_m:reset, core 0, type=SW_SYSRESETREQ
0006798:DEBUG:cortex_m:clear reset catch, core 0
0006798:INFO:loader:Erased 32768 bytes (32 sectors), programmed 32768 bytes (128 pages), skipped 0 bytes (0 pages) at 5.76 kB/s
0006798:DEBUG:session:uninit session <pyocd.core.session.Session object at 0x7fcb63ad6630>
0006798:DEBUG:board:uninit board <pyocd.board.board.Board object at 0x7fcb63a92978>
0006800:DEBUG:cortex_m:resuming core 0
0006800:DEBUG:manager:added=[] removed=[]
0006800:DEBUG:manager:bps after flush={}
0006804:DEBUG:pyusb_backend:closing interface

Attempting to flash the chip again (using the same command) gives the error show in the OP.

jpmzometa avatar Jan 27 '21 14:01 jpmzometa

@jpmzometa Could you try the latest code? Same warning in there but the erase and flash works fine. 0001404:WARNING:rom_table:Invalid coresight component, cidr=0x0

Hoohaha avatar Feb 04 '21 08:02 Hoohaha

I have tried the latest code (0.29.1.dev16), but the issue remains.

Just to be clear, erase and flash works fine with this version and v0.29, as long as there is not a valid program already flashed in the MCU.

jpmzometa avatar Feb 05 '21 14:02 jpmzometa

Thanks for testing. I'm ordering an LPC845-BRK board so I can try to reproduce it.

flit avatar Feb 05 '21 15:02 flit

Looking at the user manual (UM11029) explains a few things.

Connect under-reset doesn't work because boundary scan mode is enabled when the nRESET pin is asserted; SWD is disabled while the part is held in reset. See section 32.5.3. This is an unfortunate design. It means the only way to recover from a low power mode or bad configuration is to use the ISP pin, which is usually not accessible by the debugger.

My guess is that the "invalid coresight component" is caused by two different components in the working and non-working case. In the working case, it's probably the MTB; section 32.3 says, "In order to use the micro-trace buffer for debugging, enable the MTB clock in the SYSAHBCLKCTRL register". And the MTB is not otherwise listed in the ROM table.

In the non-working case from your first log, it looks like the root ROM table itself is returning invalid IDs.

@jpmzometa What does the code you are flashing do? Does it put the device in a low power state?

flit avatar Feb 05 '21 15:02 flit

Hi. The code does not put the device in a low power mode. The interesting thing is that the MCUXpresso IDE is able to flash/erase the LPC845 every time without problems using the same setup, independently of the state of the MCU (valid code, low power mode or not). So, my guess is that it is possible to do it via software (i.e. without the need for ISP pin), but no idea how.

jpmzometa avatar Feb 05 '21 16:02 jpmzometa

Ok, thanks for confirming that. And it's good to know that it's MCUX can do it without the ISP pin—the LPC845-BRK schematic confirms there isn't an ISP pin connection to the on-board debug probe like there is on some other LPC boards.

flit avatar Feb 05 '21 18:02 flit

@fli @jpmzometa I can reproduce this issue in my local. Board cannot be flashed when an application is running which used "WFI()" to wait for interrupt. IAR and MCUXpressoIDE both can connect to even target is sleeping. See below picture: image

Hoohaha avatar Mar 11 '21 10:03 Hoohaha

Hi @Hoohaha, thanks for taking a look at this and providing the IAR log. I did get an LPC845-BRK board, so I should be able to debug it. Are you using one of the MCUX demos for testing?

flit avatar Mar 11 '21 23:03 flit

  • Example name: pint_pattern_match
  • Example project in package: ./boards/lpc845breakout/driver_examples/pint/pattern_match/
  • Compiled by MCUXpressoIDE:

lpc845breakout_pint_pattern_match.zip

Test command:

pyocd flash --format elf --target lpc845  <path/to/elf>

Hoohaha avatar Mar 12 '21 03:03 Hoohaha

Thanks @Hoohaha !

flit avatar Mar 12 '21 21:03 flit

Ok, I can reproduce it now. For some reason, immediately after I flash the test app it was working fine. It may have required a power cycle to reproduce.

flit avatar Mar 20 '21 21:03 flit

The lpc845breakout_pint_pattern_match test image above reproduces the "No cores found" error. Using the "under-reset" connect mode, e.g., --connect=under-reset, seems to resolve all issues. Erasing and programming flash work fine, and connecting Commander works fine. (I'm not sure why you'd get a "No ACK" error, since I'm not getting that.)

Definitely seems to be related to low power mode. If I load the test image but leave the core halted, I can always connect fine. But if the core is running when attempting to connect, it fails. Also, resuming the CPU from within Commander results in a "Device entered sleep" message.

Pyocd fails to find any cores because the root ROM table reads as all zeroes when the device is in a low power state. IAR works because it apparently doesn't perform CoreSight discovery, and the CPUID and other core debug registers read correctly when the core is asleep.

Btw, the reason a fully erased device works without errors is because it stays in the boot ROM and does not enter sleep.

I'll continue to explore this a bit and see if there's anything pyocd is missing or doing wrong.

flit avatar Mar 30 '21 16:03 flit

@flit Thanks for so detailed analysis.

As you know, there are many people were confused the exception "No cores were discovered". And I know somes are relate to specific soc design. Is possible that pyocd can automatically do something then to reconnect like you mentioned with a under-reset? This would probably improve the user experience.

Hoohaha avatar Mar 31 '21 02:03 Hoohaha

You're right about the message being difficult to understand for many people. A big part is the lack of documentation. I'm working on a pyocd.io website and will be writing (hopefully a lot) more documentation to try to address this.

For most debuggers like Keil MDK, you just have to "know" which connect mode to use. But they tend to have pretty good documentation.

Automatically switching to under-reset a good idea. One problem is that not all MCUs can be connected under-reset. For instance the LPC55xx family cannot be connected at all while reset is asserted (because debug is completely disabled until mid-way through boot ROM execution). But, we could have a target flag that enables auto-reconnect-under-reset.

flit avatar Mar 31 '21 14:03 flit

Hey guys, I'm now having the same problem with pyOCD v0.33.1 and LPC-Link2. Did you have any progress in the meantime?

I did a series of erasing/flashing tests to try to make sense out of it. Here's the result (pretty simmilar to what you guys had so far):

Note:

  • I'm using MCUXpresso on Mac and it works with LPC-Link2 without problems
  • LPC-Link2 has been flashed with CMSIS-DAP V5.361 firmware
  • I'm running pyOCD with LPC-Link2 on Raspberry Pi (not on Mac!)
  • before each pyocd command I either erased or reflashed the MCU with MCUExpresso for consistency, according to the testing scenario
  • I know that --connect=under-reset doesn't make much sense when the MCU is already erased, but I did it for consistency as well

With target specified (LPC845)

MCUXpresso pyocd erase -vv --chip -t lpc845 pyocd erase -vv --chip -t lpc845 --connect=under-reset pyocd flash -vv --format bin --target lpc845 <path/to/bin> pyocd flash -vv --format bin --target lpc845 <path/to/bin> --connect=under-reset
erase :white_check_mark: OK :x: 'No cores were discovered!' :white_check_mark: OK (verified with MCUX) :tada: :x: 'No ACK received'
flash code :x: 'No cores were discovered!' :x: 'No ACK received' :x: 'No cores were discovered!' :x: 'No ACK received'

Without target specified (generic 'cortex_m')

MCUXpresso pyocd erase -vv --chip pyocd erase -vv --chip --connect=under-reset pyocd flash -vv --format bin <path/to/bin> pyocd flash -vv --format bin --target lpc845 <path/to/bin> --connect=under-reset
erase :white_check_mark: OK :x: 'No ACK received' :x: 'No boot memory is defined for this device' :x: 'No ACK received'
flash code :x: 'No cores were discovered!' :x: 'No ACK received' :x: 'No cores were discovered!' :x: 'No ACK received'

This pretty much boils down to @jpmzometa's initial conclusion that we can currently only flash erased MCUs :(

I also have a Python application where I'm using pyOCD API with somehow different results(?) when calling FileProgrammer(session, FlashingProgressHandler).program(<path/to/bin>, base_address=0) (note: no options defined, so I'm assuming it's the same as calling pyocd flash --format bin <path/to/bin>) - it succides with the pre-flashed MCU, although MCUX verify fails(?)

MiroHibler avatar Mar 24 '22 00:03 MiroHibler

@MiroHibler Thank you for all the details. Not sure when I'll be able to get back to this issue, but I haven't forgotten about it.

flit avatar May 01 '22 19:05 flit

If you would do me the favor of helping me, I have to use the lpc845brk with the esp232(bluethoo) and the ESP8266(WIFI), if someone has any file or tutorial, I would appreciate it. Thank you

danieltecheyra avatar Aug 20 '22 18:08 danieltecheyra