mbed-ce / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things
https://mbed.com
Other
88 stars 16 forks source link

mbed-hal-rtc-reset test kills MIMXRT1050_EVK #83

Open multiplemonomials opened 2 years ago

multiplemonomials commented 2 years ago

After running the mbed-hal-rtc-reset test, something really bad happens to the DAPLink debugger and/or the Redlink debug tool on this target. The board is unable to be programmed anymore, and is totally inoperable until it's disconnected and reconnected.

The test appears to run normally and passes, but then any subsequent attempt to program the target gets

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: <None>
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
multiplemonomials commented 1 year ago

Apparently this is a known issue https://community.nxp.com/t5/i-MX-Processors/Debugging-after-NVIC-SystemReset/td-p/1682963

multiplemonomials commented 1 year ago

It seems like we might need a MIMXRT-specific reset function which runs out of RAM and resets the flash using its reset pin before calling NVIC_SystemReset. This would be the first actual, bona fide new HAL API added by Mbed CE!