EraseSector error when programming LPC1347 with LPCLink2 debugger

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

EraseSector error when programming LPC1347 with LPCLink2 debugger

713 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pdr on Wed Aug 06 22:33:51 MST 2014
I get the below error when trying to program a LPC1347.

...
[color=#f3f]driver "EraseSector" return code: 0x1
Flash Program Summary: 14832 bytes in 0.08 seconds (190.58 KB/sec)
Stopped (Was Reset)  [Reset from Unknown]
Stopped: Breakpoint #1[/color]

It started happening as my compiled code size approached 16k.

I've tested the following scenarios:
1) Comment out a large section of my program, compile to around 12k. 
    Power up board as a ramdisk, copy over as firmware.bin, reboot
    I can now launch the debugger, and download the code as many times as I want.
    Download output looks like:
[color=#f3f]          Writing 11904 bytes to address 0x00000000 in Flash
           Erased/Wrote page  0-2 with 11904 bytes in 1933msec
           Flash Write Done
           Flash Program Summary: 11904 bytes in 1.93 seconds (6.01 KB/sec)
           Stopped (Was Reset)  [Reset from Unknown]
[/color]
2) Leave the code as is, and compile - 16048 bytes.
     Power up the board as ramdisk, copy over as firmware.bin, reboot
     or, if I've previously done step 1, I can download via the debugger.
    The code runs, but I cannot download new code without getting the "EraseSector" error and aborting the download
    The first time, the download output looks like:
[color=#f3f]         Writing 14992 bytes to address 0x00000000 in Flash
          Erased/Wrote page  0-3 with 14992 bytes in 2530msec
          Flash Write Done
          Flash Program Summary: 14992 bytes in 2.53 seconds (5.79 KB/sec)
          Stopped (Was Reset)  [Reset from Unknown]
[/color]   After, the first time, I get the EraseSector error

On the ones that work, it writes pages 0-2, on the one that breaks it, it writes pages 0-3.

Where am I going wrong.  It's a 64k part, do I need to do something differently as the program grows?

Thanks

Labels (1)
0 Kudos
3 Replies

609 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Aug 07 23:52:28 MST 2014
Very very likely. Programming flash takes a lot of power. Where the actual programming fails often depends on the characteristics of the power supply.
0 Kudos

609 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pdr on Thu Aug 07 21:02:14 MST 2014
I've done a lot more testing today.

My test setup was that the target device and the LPCLink were both plugged into the same USB hub.  In this setup, during the download, I get the EraseSector errors.

If I instead plug the target into my Linux box, or into a 5v usb power supply, the download works flawlessly.

Could this be a power problem?
0 Kudos

609 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Aug 07 01:38:42 MST 2014
It is hard to say what is happening here, but it sounds like something in your code is de-stabilising the chip in some way. Presumably, this is in the code that you remove to make the code smaller.

Can you provide the image (axf file) that, when programmed into flash, causes a subsequent download to fail? The map file for this image would also be useful.

Also, can you provide the contents for the "GDB traces" console after the problem has happened - this may also provide some clues.

When this problem occurs, can you try mass erasing the device (Use the Flash utility toolbar button to do this) and then try downloading again, to see if this changes the behaviour in any way.
0 Kudos