Hi Thomas,
It seems pretty clear from your report that the erase operation is failing. It would be interesting to take a look at the memory values and see if there is a consistent fail location.
You can examine memory within LPCScrypt using:
LPCScrypt memdisplay banka
0x1a000000 ffffffff ffffffff ffffffff ffffffff
0x1a000010 ffffffff ffffffff ffffffff ffffffff
0x1a000020 ffffffff ffffffff ffffffff ffffffff
0x1a000030 ffffffff ffffffff ffffffff ffffffff
0x1a000040 ffffffff ffffffff ffffffff ffffffff
0x1a000050 ffffffff ffffffff ffffffff ffffffff
0x1a000060 ffffffff ffffffff ffffffff ffffffff
0x1a000070 ffffffff ffffffff ffffffff ffffffff
0x1a000080 ffffffff ffffffff ffffffff ffffffff
0x1a000090 ffffffff ffffffff ffffffff ffffffff
0x1a0000a0 ffffffff ffffffff ffffffff ffffffff
0x1a0000b0 ffffffff ffffffff ffffffff ffffffff
0x1a0000c0 ffffffff ffffffff ffffffff ffffffff
0x1a0000d0 ffffffff ffffffff ffffffff ffffffff
0x1a0000e0 ffffffff ffffffff ffffffff ffffffff
0x1a0000f0 ffffffff ffffffff ffffffff ffffffff
Successful
You can add an options length parameter to explore further into the flash e.g. memdisplay banka +0x400.
One thing you could try is programming (erasing) flash at a slower clock speed. LPCScrypt has a command to reduce the default clock as below:
LPCScrypt clockslow
Successful
This slows the clock to 120MHz
LPCScrypt querypart
partID = 0xa001ca60 0
decode = LPC43S37: BankA 512KB, BankB 512KB
Core Clock = 120000000
Successful
At this lower speed, repeat the program operation (and/or erase) and see if this works correctly.
Another thought would be to examine the power to the board. If you are using a USB hub consider connecting directly to the host or powering the hub separately.
Please can you report your results to this thread.
LPCScrypt supports a number of operations, the full list can be seen via the option.
LPCScrypt helpadvanced
Some of the low level operations may assist here.
Finally, if all of the above fails to solve this issue, you could make use of MCUXPresso IDE to perform a mass erase of this part. While intrinsically this will be the same operation using internal ROM API calls, they are performed at an even slower clock speed on this part so may deliver better results.
I hope this helps,
Yours,
MCUXpresso IDE Support