Programming external flash via IDE fails

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Programming external flash via IDE fails

1,904 Views
dariuskellerman
Contributor III

Hello everyone,

We are having issues, programming the external flash on a custom PCB via the IDE. On most of our PCBA, it works, but on other, which are seemingly identical, it does not. Swapping out the CPU or the flash IC did not fix it.

In the past we have been using S25FL064P, while on our newer boards a S25FL256S is placed. The driver used is the LPC5460x_SPIFI_GENERIC.cfx for which both used flash ICs are listed as supported devices in the MCUXpresso IDE User Guide.

The flash ICs are connected via SPIFI and the memory is configured as outlined below.

ICStart AddressSizeWorks?
S25FL064P0x100000000x7a1200Yes
S25FL2560x100000000x1E84800No
S25FL2560x100000000x3d09000No

When trying to debug the program, flashing aborts with the following output in the debug messages:

MCUXpresso RedlinkMulti Driver v10.0 (Jun 22 2017 23:31:55 - crt_emu_cm_redlink build 272)
Found chip XML file in C:/data/prj/fw/FW_pHMI/RfTest\LPC54608J512.xml
Reconnected to existing redlink server (PID 4294967295)
Connecting to probe 1 core 0 (server PID unknown) gave 'OK'
Probe Firmware: LPC-LINK2 CMSIS-DAP V5.182 (NXP Semiconductors)
Serial Number: I3FUBYKQ
VID:PID: 1FC9:0090
USB Path: \\?\hid#vid_1fc9&pid_0090&mi_00#8&dea33f8&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
number of h/w breakpoints = 6
number of flash patches = 2
number of h/w watchpoints = 4
Probe(0): Connected&Reset. DpID: 2BA01477. CpuID: 410FC240. Info: <None>
Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
Inspected v.2 On-chip Flash Memory LPC5460x_512K.cfx
Image 'LPC5460x (512K Flash) Oct 3 2016 17:52:49'
Non-default CRT_DEBUG_TRACE set (to 0x1)
Inspected v.2 External Flash Device on SPI using SPIFI lib LPC5460x_SPIFI_GENERIC.cfx
Image 'LPC5460x Generic SPIFI Jun 22 2017 15:19:27'
Non-default CRT_DEBUG_TRACE set (to 0x1)
Opening flash driver LPC5460x_SPIFI_GENERIC.cfx
Sending SYSRESETREQ to run flash driver
Driver V.2 dynamic startup failed - driver Init provided no flash parameters
Flash Driver V.2 startup failed - rc Ef(55): Dynamic flash driver startup failed to provide flash parameters.
Terminate (0x0, 0x0, 0x0) status 0x40 - driver reports init failure - EXTSPI driver rc 13 - No supported SPIFI device found
failed operation called after Init failure (status 0x40)

Driver from AXF file:
200024B8: 00000000 00000000 00000000 00000000 ................
200024C8: 00000000 00000000 00000000 00000000 ................
200024D8: 00000000 00000000 00000000 00000000 ................
200024E8: 00000000 00000000 00000000 00000000 ................
200024F8: 00000000 00000000 00000000 00000000 ................
20002508: 00000000 00000000 00000000 00000000 ................
20002518: 00000000 00000000 00000000 00000000 ................
20002528: 00000000 00000000 00000000 00000000 ................
20002538: 00000000 00000000 00000000 00000000 ................
20002548: 00000000 00000000 00000000 00000000 ................
20002558: 00000000 00000000 00000000 00000000 ................
20002568: 00000000 00000000 00000000 00000000 ................
20002578: 00000000 00000000 00000000 00000000 ................
20002588: 00000000 00000000 00000000 00000000 ................
20002598: 00000000 00000000 00000000 00000000 ................
200025A8: 00000000 00000000 00000000 00000000 ................
200025B8: 00000000 00000000 00000000 00000000 ................
200025C8: 00000000 00000000 00000000 00000000 ................
200025D8: 00000000 00000000 00000000 00000000 ................
200025E8: 00000000 00000000 00000000 00000000 ................
200025F8: 00000000 00000000 00000000 00000000 ................
20002608: 00000000 00000000 00000000 00000000 ................
20002618: 00000000 00000000 00000000 00000000 ................
20002628: 00000000 00000000 00000000 00000000 ................
20002638: 00000000 00000000 00000000 ............
Driver code in memory:
200024B8: 00000001 00000000 20002578 20002168 ........x%. h!.
200024C8: 20002628 200020c8 20002588 20002134 (&. . . .%. 4!.
200024D8: 20002568 20001c73 20002508 00000000 h%. s.. .%. ....
200024E8: 200024fc 00000000 20000dfd 20001df0 .$. ....... ...
200024F8: 20002500 00000020 2000219c 20002570 .%. ....!. p%.
20002508: 00000000 200024f4 200021d0 200025b8 .....$. .!. .%.
20002518: 20002204 00000000 20002238 20002510 .". ....8". .%.
20002528: 2000226c 20002520 200022a0 20002528 l". %. .". (%.
20002538: 200022d4 20002620 20002308 20002530 .". &. .#. 0%.
20002548: 2000233c 20002538 20002370 20002548 <#. 8%. p#. H%.
20002558: 20001c3c 200024cc 200023d8 20002580 <.. .$. .#. .%.
20002568: 20002100 20002558 2000240c 200024d4 .!. X%. .$. .$.
20002578: 200024dc 00000000 200023a4 20002550 .$. .....#. P%.
20002588: 20002094 200024c4 20001e24 20002518 . . .$. $.. .%.
20002598: 20001e58 20002590 20001e8c 20002598 X.. .%. ... .%.
200025A8: 20001ec0 200025a0 20001ef4 20002540 ... .%. ... @%.
200025B8: 20001f28 200025a8 20001f5c 200025b0 (.. .%. \.. .%.
200025C8: 20001f90 200025c0 00000000 00000000 ... .%. ........
200025D8: 00000000 00000000 00000000 00000000 ................
200025E8: 00000000 00000000 00000000 00000000 ................
200025F8: 00000000 00000000 00000000 00000000 ................
20002608: 00000000 00000000 20001fc4 200025c8 ........... .%.
20002618: 20001ff8 20002560 2000202c 20002610 ... `%. , . .&.
20002628: 20002060 20002618 05f5e100 00000000 ` . .&. ........
20002638: 00000000 00000000 00000000 ............
Halting target for post-mortem
Driver Addresses
Start: 20000000
Entry: 20000035
End: 200026B4
Stack: 200036B8
Mailbox:2000B6B8
Driver Register State
R0: 0000000D
R1: 20003660
R2: 00000000
R3: 00000100
R4: 2000B6B8
R5: 00000100
R6: 0000000D
R7: 00000000
R8: 00000000
R9: 00000000
R10: 00000000
R11: 00000000
R12: 00000000
SP: 200036B8
LR: 200003BF
PC: 200000DA
xPSR: 61000000
MSP: 200036B8
PSP: 200036B8
CFBP: 00000001 (CONTROL=0x0, FAULTMASK=0x0, BASEPRI=0x0, PRIMASK=0x1)
Stacked Exception information (not in exception now)
200036D4: xPSR: 7AACE194
200036D0: VECTPC: 00000000
200036CC: LR: 00000000
200036C8: R12: 00000000
200036C4: R3: 00000000
200036C0: R2: 00000000
200036BC: R1: 00000000
200036B8: R0: 00000000
Exception registers
E000ED04: ICSR: 00400000 (ISRPEND, VECTPEND=0(none), VECTACTIVE=0(none))
E000ED08: VTOR: 00000000 TBLBASE=0(INCODE), TBLOFF=0x0
E000ED28: MMFSR: 00
E000ED29: BFSR: 00
E000ED2A: UFSR: 0000
E000ED2C: HFSR: 00000000
E000ED30: DFSR: 00000001 (HALTED)
E000ED3C: AFSR: 00000000
E000ED24: SHCSR: 00000000
E000ED34: MMAR: E000EDF8
E000ED38: BFAR: E000EDF8
E000EDFC: DEMCR: 01000000 (TRCENA)
Failed on chip setup: Ec(01). Invalid part, XML, or configuration.

To further pinpoint the problem, I ran the SPIFI driver code from the Example directory in the MCUXpresso install folder. It crashes with a hard fault (see stack below), but gives the following output.

[MCUXpresso Semihosting Telnet console for 'LPC5460x_SPIFIdriver_Generic LinkServer Debug' started on port 49341 @ 127.0.0.1]

Flash Driver test program starting

SPIFI driver : LPC5460x Generic SPIFI Sep 14 2017 07:29:17
Detected properties
- SPIFI size : 65536 KB, 64.00 MB
- SPIFI ProgramPage size : 256 bytes
- SPIFI sector size : 64 KB
- Detected device : (null)

pastedImage_1.png

The hard fault occurs during execution of the instruction pastedImage_13.png , which reads eight words from pastedImage_14.png.

What can cause the driver to fail that way?

Best regards,

Darius

Tags (2)
0 Kudos
1 Reply

1,068 Views
dariuskellerman
Contributor III

I have just figured out that the hard fault is due to the flash driver not caring about the return value of Init().

pastedImage_1.png

This would cause a hard fault, because (I guess) the peripheral is not clocked or powered. The reason that this is relevant at all, is that the device we are using now is actually not supported, because it is a S25FL256L.

I have now implemented support for the device and at least the test application is working. Will check with the compiled driver next.

[MCUXpresso Semihosting Telnet console for 'LPC5460x_SPIFIdriver_Generic' started on port 50210 @ 127.0.0.1]

Flash Driver test program starting

SPIFI driver : LPC5460x Generic SPIFI Sep 14 2017 07:29:17
Detected properties
- SPIFI size : 32768 KB, 32.00 MB
- SPIFI ProgramPage size : 16384 bytes
- SPIFI sector size : 64 KB
- Detected device : S25FL256L
Finished

[Closed Telnet Session]
0 Kudos