LPC1313 Fail to Erase sector 0

Started by matterama, November 27, 2011, 02:47:32 PM

Previous topic - Next topic

matterama

Hello,
While trying to program an LPC1313 with a hex file, both Flash Magic and a separate open source utility failed to erase sector 0.  Using your terminal feature, I was able to do synchronize, unlock and prepare other sectors (like sector 1) and then erase them successfully.  I can also erase the whole chip and then write without erasing to program, though this deletes configuration data in the last sector that I want to maintain.

Using the terminal, I can prepare sector 0 ("P 0 0" returns a "0").  But when I try to erase ("E 0 0"), nothing comes back and power must be cycled to recover, which is what happens with Flash Magic GUI handling this feature also.  CRP is all disabled, etc.

the .FMD file is attached in case that helps.

Thanks for your help,
Mr. Yan


Andy Ayre

The debug file shows the same thing. I think this is a question for NXP as we have no idea.

tx> U 23130\d
rx> U 23130\d
rx> 0\d\a
tx> P 0 0\d
rx> P 0 0\d
rx> 0\d\a
tx> E 0 0\d
rx> E 0 0\d
debug> ReadFile - not enough or too many bytes read
debug> wanted 1 bytes, read 0 bytes
rx>
tx> \1b
debug> COM Port RX flushed
tx> U 23130\d
debug> ReadFile - not enough or too many bytes read
debug> wanted 1 bytes, read 0 bytes
rx>
tx> \1b
debug> COM Port RX flushed

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

matterama

Thanks Andy, at least I'm not crazy.  Do you have a recommended contact at NXP that I can relay this to, or should I just send it up the generic issue chain?
Thanks again...

matterama

Hi Andy,

Although I have checked the CRP and it says it is disabled, I can program the whole chip if I choose "erase all + code protect" option instead of the "erase ll used by hex". 

However, even if I blank the chip in this manner and then try to erase sector 0, I get the same failure, so I do not believe it is a CRP issue.  But can you tell me what the difference is in the actual ISP commands between these two options?

Thanks,
Mr. Yan

Andy Ayre

I just double-checked and what you are describing is CRP level 1. This only allows sector 0 containing the interrupt vectors to be erased with a full chip erase.

You need to make sure in your code that you are not accidentally putting a part of your firmware in the CRP location. For safety you should set those four bytes to zero.

The command for erasing the entire device is "E 0 " followed by the number of the highest sector in the device.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

matterama

Hi Andy,

I know it sounds like that, but it isn't.  I have read the CRP memory location (both with SWD and directly using the ISP read memory command) and while it isn't 0, it isn't any of the CRP codes.  Flash Magic also confirms no CRP is enabled.  On top of all that I can still debug via SWD (CRP 1 kills that).

All that aside though, if I erase all sectors of the chip using (P 0 7) and then (E 0 7), I get a success and the chip is erased successfully (verified that all locations have a 0x5F written).  However, if I now erase just sector 0, it still fails to do this.  So the chip is totally blank, but it still fails with a (P 0 0) and (E 0 0) command.

I can erase sections like 0 to 1 or 0 to 5 or 0 to 7, just not 0 to 0.

It might be something with this part, as it has a sister variant that does USB on board and looks like a flash drive when blank.  Anyway, I've submitted a request to NXP, we'll see what they have to say about it...

Thanks Andy...
Mr. Yan
 

Andy Ayre

Could be the part has static damage.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

matterama

Unfortunately, I tested 3 different units.  And I'd guess that static damage would result in code not running correctly, but once programmed, these parts all do what they are supposed to...