Since I am new to NXP/Freescale MCUs, I thought it wouldn't hurt by purchasing an original MIMXRT1020-EVK to try out some examples before committing new designs to the RT1021.
Using MCUXpresso IDEv11.6.0, building the example iled_blinky project was simple and pain-free.
But I am luckless with downloading the binary to the RT1020-EVK. To be specific, the following is the dump from the Console in the IDE:
Probe Firmware: DAPLink CMSIS-DAP (ARM)
Serial Number: 0226000047784e4500279003d917004ee561000097969900
VID:PID: 0D28:0204
USB Path: \\?\hid#vid_0d28&pid_0204&mi_03#8&2d6f39ab&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Using memory from core 0 after searching for a good core
debug interface type = CoreSight DP (DAP DP ID 0BD11477) over SWD TAP 0
processor type = Cortex-M7 (CPU ID 00000C27) on DAP AP 0
number of h/w breakpoints = 8
number of flash patches = 0
number of h/w watchpoints = 4
Probe(0): Connected&Reset. DpID: 0BD11477. CpuID: 00000C27. Info: <None>
Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
Content of CoreSight Debug ROM(s):
RBASE E00FD000: CID B105100D PID 000008E88C ROM (type 0x1)
ROM 1 E00FE000: CID B105100D PID 04000BB4C8 ROM (type 0x1)
ROM 2 E00FF000: CID B105100D PID 04000BB4C7 ROM (type 0x1)
ROM 3 E000E000: CID B105E00D PID 04000BB00C Gen SCS (type 0x0)
ROM 3 E0001000: CID B105E00D PID 04000BB002 Gen DWT (type 0x0)
ROM 3 E0002000: CID B105E00D PID 04000BB00E Gen (type 0x0)
ROM 3 E0000000: CID B105E00D PID 04000BB001 Gen ITM (type 0x0)
ROM 2 E0041000: CID B105900D PID 04001BB975 CSt ARM ETMv4.0 type 0x13 Trace Source - Core
ROM 2 E0042000: CID B105900D PID 04004BB906 CSt type 0x14 Debug Control - Trigger, e.g. ECT
ROM 1 E0040000: CID B105900D PID 04000BB9A9 CSt type 0x11 Trace Sink - TPIU
ROM 1 E0043000: CID B105F00D PID 04001BB101 Sys (type 0x0)
NXP: MIMXRT1021xxxxx
DAP stride is 1024 bytes (256 words)
Inspected v.2 External Flash Device on SPI MIMXRT1020-EVK_IS25LP064.cfx
Image 'MIMXRT1020-EVK_IS25LP064A Jul 7 2022 12:14:07'
( 65) Chip Setup Complete
Connected: was_reset=false. was_stopped=true
Awaiting telnet connection to port 3330 ...
GDB nonstop mode enabled
Opening flash driver MIMXRT1020-EVK_IS25LP064.cfx
Sending VECTRESET to run flash driver
AFTER driver startup timeout (302 5ms retries)
Driver Addresses
Start: 20000000
Entry: 2000009D
End: 200012D8
Stack: 200022D8
Mailbox:2000A2D8
Driver Register State
R0: 402A8000
R1: 20002258
R2: 00000000
R3: 402A8000
R4: 402A8000
R5: 20002258
R6: 00000000
R7: 00000000
R8: 00000000
R9: 00000000
R10: 00000000
R11: 00000000
R12: 00000000
SP: 20002220
LR: FFFFFFF9 (exception from main thread)
PC: 00209C66
xPSR: 21000003
MSP: 20002220
PSP: 200022D8
CFBP: 00000001 (CONTROL=0x0, FAULTMASK=0x0, BASEPRI=0x0, PRIMASK=0x1)
Stacked Exception information at MSP
2000223C: xPSR: 21000000
20002238: VECTPC: 200008B2
20002234: LR: 20000D85
20002230: R12: 00000000
2000222C: R3: 402A8000
20002228: R2: 00000000
20002224: R1: 20002258
20002220: R0: 402A8000
Exception registers
E000ED04: ICSR: 00000803 (VECTPEND=0(none), RETTOBASE, VECTACTIVE=3(hard fault))
E000ED08: VTOR: 00200000 TBLBASE=0(INCODE), TBLOFF=0x4000
E000ED28: MMFSR: 00
E000ED29: BFSR: 00
E000ED2A: UFSR: 0100 (UNALIGNED)
E000ED2C: HFSR: 40000000 (FORCED)
E000ED30: DFSR: 00000009 (VCATCH, HALTED)
E000ED3C: AFSR: 00000000
E000ED24: SHCSR: 00000000
E000ED34: MMAR: 00000000
E000ED38: BFAR: 00000000
E000EDFC: DEMCR: 010007F0 (TRCENA, VC_HARDERR, VC_INTERR, VC_BUSERR, VC_STATERR, VC_CHKERR, VC_NOCPERR, VC_MMERR)
VECTPC instructions near 21000000
20FFFFFC: (can't read - Nn(05). Wire ACK Fault in DAP access)
20FFFFFE: (can't read)
Flash Driver V.2 startup failed - rc Ef(34): Timed-out initializing flash.
(100) Writing Flash ended with an error.
Target error from Commit Flash write: Ef(34): Timed-out initializing flash.
GDB stub (C:\nxp\MCUXpressoIDE_11.6.0_8187\ide\plugins\com.nxp.mcuxpresso.tools.bin.win32_11.6.0.202207121507\binaries\crt_emu_cm_redlink) terminating - GDB protocol problem: Pipe has been closed by GDB.
I hope this are just some errors thrown up by my stupidity and nothing broken in the hardware or software.
Further experimentation revealed that the "timed-out initializing flash" error only occurs after certain SDK examples have been downloaded to the RT1020 EVK. To be specific, the offending SDK examples are the ones which exercise the SAI (irrespective of interrupt or EDMA being used).
Apparently downloading the "'Link application to RAM" binary of iled_blinky would cause some sort of resetting, and the SAI examples would not suffer the time-out error in the next download to the RT1020 EVK.
At least this is some relief that the on-board flash is not faulty.
It would be nice to know why the MCUXpresso IDE would behave so, and if there is a cure.
It seems that MCUX flashloader is not working properly.
You can try below example to validate on-board Flash firstly (Enable 'Link application to RAM' in project option):
\SDK_2.x_EVK-MIMXRT1020\boards\evkmimxrt1020\driver_examples\flexspi\nor.