AnsweredAssumed Answered

IAR EWARM Failed to load FlashLPC546x_SPIFI.flash  

Question asked by Kilian on Dec 7, 2017
Latest reply on Jan 5, 2018 by Frédéric RIVIERE

I am having an issue with the flash downloader .mac file for the LPCXpresso54608 Eval board.


I get an error when trying to download using J-Link/J-Trace and a flash loader.

The error message is:

C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0_2\arm\config\flashloader\NXP\FlashLPC546x_SPIFI.mac(39,27): Error: Operation error.


Looking at the debugger log (attached) I can see that every operation after setting the main clock returns 0xFFFFFFFF

(line 1375 is where the main clock is set, and it's all 0xFFFFFF after that.)


Line 1375:

T157C 006:181 JLINK_BeginDownload(Flags = 0x01) (0000ms, 4225ms total)
T157C 006:181 JLINK_WriteMem(0x40000280, 0x0004 Bytes, ...) - Data: 03 00 00 00 -- CPU_WriteMem(4 bytes @ 0x40000280) returns 0x04 (0101ms, 4326ms total)
T157C 006:283 JLINK_EndDownload() returns 0x00 (0000ms, 4326ms total)
T157C 006:283 JLINK_BeginDownload(Flags = 0x01) (0000ms, 4326ms total)
T157C 006:283 JLINK_WriteMem(0x400002A0, 0x0004 Bytes, ...) - Data: 00 00 00 00 -- CPU_WriteMem(4 bytes @ 0x400002A0) returns 0xFFFFFFFF (0201ms, 4527ms total)
T157C 006:484 JLINK_EndDownload() returns 0x00 (0000ms, 4527ms total)
T157C 006:485 JLINK_BeginDownload(Flags = 0x01) (0000ms, 4527ms total)


In the FlashLPC546x_SPIFI.mac file, lines 20,21 are:

/*MAINCLKSELA[1:0] = 0b11 == fro_hf*/
__writeMemory32(0x00000003, 0x40000280, "Memory");

Commenting-out the setting of the main clock allows me to download and debug correctly.


What would be the correct way to correct this error?

I don't think it's a good idea to edit an IAR system file, although I could make a copy and check it in with my project.


If I uncheck the "Use Flash Loader" box, I can download and debug just fine also.


I've installed the latest IAR release.

I've updated the LPCXpresso board with the latest drivers, firmware and scripts:


Any help would be welcome.