Debuggers cannot connect to MIMXRT1062 after core calls NVIC_SystemReset Hi, I'm here to bring back a ghost from the past. Specifically, this thread. I'm working on the port of Mbed OS CE to MIMXRT1062, and have run into this issue when trying to set up our test suite. Basically, anytime the code running on the M7 core calls NVIC_SystemReset, debuggers lose the ability to connect to the core. LinkServer prints: Ns: MCUXpresso IDE RedlinkMulti Driver v11.6 (Oct 3 2022 08:09:13 - crt_emu_cm_redlink.exe build 9)
Pc: ( 0) Reading remote configuration
Wc(03). No cache support.
Nc: Found chip XML file in I:/RPL/mbed-os/targets/upload_method_cfg/redlink_cfgs\MIMXRT1052xxxxB.xml
Pc: ( 5) Remote configuration complete
Nc: Restarted LinkServer process (PID 30668).
Wc: ============= SCRIPT: RT1050_connect.scp =============
Wc: RT1050 Connect Script
Wc: DpID = 0BD11477
Wc: APID = 0x04770041
Wc: Disabling MPU
Wc: Configure FlexRAM for 256KB OC RAM, 128KB I-TCM, 128KB D-TCM
Wc: Finished
Wc: ============= END SCRIPT =============================
Nc: Probe Firmware: DAPLink CMSIS-DAP (ARM)
Nc: Serial Number: 0227000047784e4500559004d7450044ddb1000097969900
Nc: VID:PID: 0D28:0204
Nc: USB Path: \\?\hid#vid_0d28&pid_0204&mi_03#7&316d2a6&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Nc: Using memory from core 0 after searching for a good core
Pc: ( 30) Emulator Connected
Xr:
Pc: ( 40) Debug Halt
Nc: connection failed - Ep(03). Invalid ID for processor... Retrying
Nc: Using memory from core 0 after searching for a good core
Nc: On debug connection - reset using system reset
Pc: ( 30) Emulator Connected
Pc: ( 40) Debug Halt
Ed:02: Failed on connect: Ep(03). Invalid ID for processor.
Et: Probe(0): Connected&Reset. Was: NotConnected. DpID: 0BD11477. CpuID: 00000FFF. Info:
Nc: Last stub error 0: OK
Nc: Last sticky error: 0x0 AIndex: 0
Nc: Debug bus selected: MemAp 0
Nc: DAP Speed test unexecuted or failed
Nc: Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
Pc: (100) Target Connection Failed PyOCD prints: 0000350 I Target type is mimxrt1060 [board]
0000405 I DP IDR = 0x0bd11477 (v1 MINDP rev0) [dap]
0000433 I AHB-AP#0 IDR = 0x04770041 (AHB-AP var4 rev0) [discovery]
0000446 W Invalid coresight component, cidr=0x0 [rom_table]
0000450 I IMXRT Boot Mode: Boot From Fuses [target_imxrt]
0000458 I CPU core #0: Unknown (CPUID=0x00000000) r0p0, v6.0-M architecture [cortex_m]
0000471 I Loading /home/jamie/Mbed/mbed-os/cmake-build-develop-mimxrt1060evk/hal/tests/TESTS/mbed_hal/rtc_reset/test-mbed-hal-rtc-reset.bin at 0x60000000 [load_cmd]
0000496 I IMXRT Boot Mode: Boot From Fuses [target_imxrt]
0000499 I IMXRT Boot Device: 0 [target_imxrt]
0000545 C cannot write registers r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, psp, msp, lr, pc, xpsr, cfbp because core #0 is not halted [__main__] OpenOCD prints: Info : 114 157 adi_v5_swd.c:370 swd_connect_single(): SWD DPIDR 0x0bd11477
Debug: 115 160 arm_adi_v5.c:679 dap_dp_init(): imxrt.dap
Debug: 116 160 arm_adi_v5.c:711 dap_dp_init(): DAP: wait CDBGPWRUPACK
Debug: 117 160 arm_adi_v5.h:638 dap_dp_poll_register(): DAP: poll 4, mask 0x20000000, value 0x20000000
Debug: 118 164 arm_adi_v5.c:719 dap_dp_init(): DAP: wait CSYSPWRUPACK
Debug: 119 164 arm_adi_v5.h:638 dap_dp_poll_register(): DAP: poll 4, mask 0x80000000, value 0x80000000
Debug: 120 166 cmsis_dap.c:808 cmsis_dap_swd_write_from_queue(): refusing to enable sticky overrun detection
Debug: 121 169 openocd.c:151 handle_init_command(): Examining targets...
Debug: 122 169 target.c:1843 target_call_event_callbacks(): target event 19 (examine-start) for core imxrt.cpu
Debug: 123 169 arm_adi_v5.c:1095 dap_get_ap(): refcount AP#0x0 get 1
Debug: 124 173 arm_adi_v5.c:1038 dap_find_get_ap(): Found MEM-AP AHB3 at AP index: 0 (IDR=0x04770041)
Debug: 125 181 arm_adi_v5.c:825 mem_ap_init(): MEM_AP Packed Transfers: disabled
Debug: 126 181 arm_adi_v5.c:836 mem_ap_init(): MEM_AP CFG: large data 0, long address 0, big-endian 0
Debug: 127 185 target.c:2628 target_read_u32(): address: 0xe000ed00, value: 0x00000000
Error: 128 185 cortex_m.c:2363 cortex_m_examine(): [imxrt.cpu] Cortex-M PARTNO 0x0 is unrecognized
Debug: 129 185 target.c:1843 target_call_event_callbacks(): target event 20 (examine-fail) for core imxrt.cpu Basically it seems like, in this situation, the CPU ID reads as 0, so no debugger is able to talk to the core. The original thread (linked above) implied that this error was due to not doing a JEDEC reset of the flash. However, I dug into the article linked by the thread, and it looks like this is an issue specific to using the flash chip in XIP Enhanced mode. In this mode, normal commands don't work, so when you reset the chip, boot will fail if you do not use a JEDEC reset that gets the chip out of XIP Enhanced (AKA Continuous Read) mode first. However, this situation does not match the configuration that the MIMXRT1060_EVK board is in. I double checked all the flash sequences, and we do not enable XIP Enhanced mode -- in fact, the flash doesn't support it at all. Additionally, the MCU does continue to work after being reset. It just cannot be flashed. This is conclusive proof that this issue is not caused by an inability for the MCU to read its XIP flash. Instead, what I think is going on here is either (a) resetting the MCU somehow disables the ARM JTAG TAP, so the CPU will not talk over the debug port, or (b) resetting the MCU is interfering with some pin mapping used by SWD, so the SWD connection itself dies after the MCU is reset. Would really appreciate if someone on the NXP side could confirm that this is an issue and explain what's going on here. For now, I did find one workaround, which is to pass "-Oconnect_mode=pre-reset" to pyocd. This causes it to issue a reset before connecting, which appears to prevent the issue from happening. Unfortunately, I have not been able to find a similar workaround with LinkServer, which makes it basically unusable for my application. At minimum, I would really appreciate if you guys could add a "reset before connect" option to LinkServer, or some kind of fallback mode that detects when the MIMXRT CPUID is 0 and tried to reset it. i.MXRT 106x Re: Debuggers cannot connect to MIMXRT1062 after core calls NVIC_SystemReset Hi @MultipleMonomials ,
As far as I know, it should be at the evaluation stage at the moment. The real implementation will take some time, but if the project is deployed, it should greatly improve everyone's debugging experience in RT MCUs. The debugging experience is not only soft reset, but even the FDCB header of XIP will be improved. Thanks for your understanding!
Best regards, Gavin Re: Debuggers cannot connect to MIMXRT1062 after core calls NVIC_SystemReset Thanks for looking at this Gavin. Do you know if any fix/workaround for this is on the LinkServer roadmap anytime soon? (either a fix for the actual issue or a way to make LinkServer do a HW reset before connecting). It makes it all but impossible to use LinkServer for our automated test suite in Mbed OS -- we have to use PyOCD and it's way slower. Re: Debuggers cannot connect to MIMXRT1062 after core calls NVIC_SystemReset Hi @MultipleMonomials ,
I've double-checked the internals for you over the last few days, and losing the debugger connection after calling NVIC_SystemReset seems to be the expected behavior. "0x202090" is ROMboot entry address. The linkserver debug probe will hold the MCU immediately after NVIC_SystemReset. And I have not found linkserver to have a similar feature as you describe.
Sorry for that.
Best regards, Gavin Re: Debuggers cannot connect to MIMXRT1062 after core calls NVIC_SystemReset Hi Gavin! I do not believe that this issue is related to Mbed OS at all. In fact, Mbed OS is built on top of the MCUXpresso SDK, and we use the bootup code and NOR flash configs from the SDK almost unmodified. This issue should be reproducible by adding a call to NVIC_SystemReset() to any existing MCUXpresso project. (it would probably be a good idea to reset only when a button is pressed to avoid sending the board into a reset loop). Yep, I am using an MIMXRT1060 EVKB board running DAPLink firmware, with LinkServer 24.9.75. Thanks for your help on this, hope this makes sense! Re: Debuggers cannot connect to MIMXRT1062 after core calls NVIC_SystemReset Hi @MultipleMonomials ,
Thanks for your interest in NXP MIMXRT series!
Since the official SDK from NXP does not contain a support project for MEBED OS, it may be necessary for you to provide us with more information. Thanks in advance!
1. Can the phenomenon you mentioned be reproduced using the NXP SDK examples? Or does it only exist in the Mebed project?
2. If the latter, can you provide a reproducible routine?
3. Also, just to confirm with you, the environment you are using is DAP Debugger + LinkServer, right?
Best regards, Gavin
View full article