AnsweredAssumed Answered

"Ef(34): Timed-out initializing flash" when trying to programm flash memory

Question asked by Artur Miller on Oct 10, 2018
Latest reply on Oct 10, 2018 by Artur Miller



I flashed the LPC4078 MCU with a code which (most probably) improperly setting the clocking, and the flash is no longer programmable. I can connect to the target (Attach only = True), I can execute it step by step in the debug session, I can access all the registers, change their values, but I cannot program the flash anymore. 


The bad thing is that the MCU is in the BGA package and the P2.10 pin is not connected and not accessible.


If there is no software way to fix this problem I can replace the crystal with the one I programmed but I would like to avoid it (tiny SMD piece)


I thought the JTAG interface can take over the CPU and keep it from running the user code totally, so the reprogramming should be fairly easy, but it doesn't seem to be the case?


Here is the debugger log:


Ns: MCUXpresso RedlinkMulti Driver v10.0 (Jun 22 2017 23:31:55 - crt_emu_cm_redlink.exe build 272)
Pc: ( 0) Reading remote configuration
Wc(03). No cache support.
Pc: ( 5) Remote configuration complete
Nc: Reconnected to existing redlink server (PID 4294967295)
Nc: Connecting to probe 1 core 0 (server PID unknown) gave 'OK'
Nc: Probe Firmware: LPC-LINK2 CMSIS-DAP V5.182 (NXP Semiconductors)
Nc: Serial Number: I3FUFTIW
Nc: VID:PID: 1FC9:0090
Nc: USB Path: \\?\hid#vid_1fc9&pid_0090&mi_00#8&318c6fd0&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Pc: ( 30) Emulator Connected
Pc: ( 40) No Halt
Pc: ( 50) CPU ID
Nc: number of h/w breakpoints = 6
Nc: number of flash patches = 2
Nc: number of h/w watchpoints = 4
Nc: Probe(0): Connected&Reset. DpID: 2BA01477. CpuID: 410FC240. Info: <None>
Nc: Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
Nc: Inspected v.2 On-chip Flash Memory LPC177x_8x_407x_8x_512.cfx
Nc: Image 'LPC177x_8x_407x_8x (512K) Jun 22 2017 15:17:57'
Nc: NXP: LPC4078
Pc: ( 65) Chip Setup Complete
Nt: Connected: was_reset=false. was_stopped=false
Cr:v MCUXpresso Free License - Downloads unlimited
Pc: ( 70) License Check Complete
Nc: Opening flash driver LPC177x_8x_407x_8x_512.cfx
Nc: Sending VECTRESET to run flash driver
Nc: AFTER driver startup timeout
Wc: Driver Addresses
Wc: Start: 10000000
Wc: Entry: 10000035
Wc: End: 100003DC
Wc: Stack: 100005E0
Wc: Mailbox:100025E0
Wc: Driver Register State
Wc: R0: 100025E0
Wc: R1: 00000000
Wc: R2: 00000001
Wc: R3: C8C30080
Wc: R4: 100025E0
Wc: R5: 00000000
Wc: R6: 00002EE0
Wc: R7: 100005AC
Wc: R8: 00000000
Wc: R9: 00000000
Wc: R10: 00000000
Wc: R11: 00000000
Wc: R12: 00000000
Wc: SP: 100005AC
Wc: LR: FFFFFFF9 (exception from main thread)
Wc: PC: 0000022C
Wc: xPSR: 01000003
Wc: MSP: 100005AC
Wc: PSP: 100005E0
Wc: CFBP: 00000001 (CONTROL=0x0, FAULTMASK=0x0, BASEPRI=0x0, PRIMASK=0x1)
Wc:Stacked Exception information
Wc:100005C8: xPSR: 100000EE
Wc:100005C4: VECTPC: 1000003D
Wc:100005C0: LR: 00000000
Wc:100005BC: R12: C8C30080
Wc:100005B8: R3: 00000001
Wc:100005B4: R2: 00000000
Wc:100005B0: R1: 100025E0
Wc:100005AC: R0: 00000000
Wc:Exception registers
Wc:E000ED04: ICSR: 00400803 (ISRPEND, VECTPEND=0(none), RETTOBASE, VECTACTIVE=3(hard fault))
Wc:E000ED08: VTOR: 00000000 TBLBASE=0(INCODE), TBLOFF=0x0
Wc:E000ED28: MMFSR: 00
Wc:E000ED2A: UFSR: 0000
Wc:E000ED2C: HFSR: 40000000 (FORCED)
Wc:E000ED30: DFSR: 00000001 (HALTED)
Wc:E000ED3C: AFSR: 00000000
Wc:E000ED24: SHCSR: 00000000
Wc:E000ED34: MMAR: C8C30108
Wc:E000ED38: BFAR: C8C30108
Wc:E000EDFC: DEMCR: 01000000 (TRCENA)
Nc: Flash Driver V.2 startup failed - rc Ef(34): Timed-out initializing flash.
Ed:04: Failed to erase flash: Ef(34): Timed-out initializing flash.
Pc: (100) Target Connection Failed