Flash Magic Forum

In-System Programming Support => ARM Cortex => Topic started by: rmatlin on September 14, 2011, 07:36:35 AM

Title: Erase Flash
Post by: rmatlin on September 14, 2011, 07:36:35 AM
I am using FlashMagicARMCortexNET runtime version v2.0.50727 in a manufacturing environment for a product using the LPC1754. I am able to successfully flash the device the first time when there is no image in the device. If I try to flash it again with a different HEX image, I don't get any errors but the firmware is not changed. I call the erase function as: this.flashMagic.Erase(EraseTypes.DEVICE, 0x0, 1, ProgressHandler, "Erase Flash", ""); This gives the event ERASING_DEVICE. I have also tried:  this.flashMagic.Erase(EraseTypes.NEEDED, 0x0, 0, ProgressHandler, "Erase Flash", this.Parameters["ImagePath"].ToString()); This gives a dozen or so ERASING_BLOCK events. I go through the program then verify processes. I restart but the firmware is not changed. What else do I need to do to be able to overwrite an existing flash image?  Thanks
Title: Re: Erase Flash
Post by: Andy Ayre on September 16, 2011, 01:13:32 AM
What value is the CRP set to in the device?

Can you please temporarily switch back to the free GUI version, make sure the problem happens there, generate a debug file and send it to us?

http://www.flashmagictool.com/debugfile.html

Andy
Title: Re: Erase Flash
Post by: rmatlin on September 16, 2011, 02:09:11 PM
I talked to the software engineer and he said he's not setting it in the Hex image. What does it need to be to allow the Erase to take place and what is the default value if it is not specified?  Thanks
Title: Re: Erase Flash
Post by: Andy Ayre on September 16, 2011, 02:34:57 PM
There are three values that are supported and they are described in the user manual from NXP for your device.

If the CRP memory location is not reserved in your project then the value you are setting it to depends on what happens to have been compiled there.

Note that the default Keil startup code defines the CRP to zero, which is a safe value but provides no security of course.

Andy
Title: Re: Erase Flash
Post by: rmatlin on September 19, 2011, 07:22:08 AM
The software engineer gave me these two lines from the HEX image  and asked if these would cause a problem reflashing with FlashMagic

:1001F00000F0061620162016201A201C20120120BE
:1002F00093FD00F09DFD10BDBD1D0000471D0000D9

The fixture for programming these devices is being used currently so I can't try the FlashMagic GUI to duplicate this problem. I will do that as soon as the fixture becomes available. In the mean time I have worked around the problem by allowing a BIN file download during the next stage of the testing in order to update these boards. I have looked in the NXP manual and as far as I can tell the CRP would be set to None and a "partial flash update in ISP mode" would be available. I can't find where "partial flash update" is defined. Thanks again for your help
Title: Re: Erase Flash
Post by: Andy Ayre on September 20, 2011, 06:15:21 PM
The safest way is to set the CRP to zero rather than relying on whatever came out of the compiler.

"Partial flash update" means erasing individual flash sectors rather than the entire device.

Andy
Title: Re: Erase Flash
Post by: rmatlin on September 22, 2011, 11:32:11 AM
I tried attaching the debug file and HEX image but they were too large. Where can I send them?

The attached HEX image file contains both our bootloader and an End-of-Line Application. What I'm finding is when I run FlashMagic on a fresh unit, nothing has ever been written to flash, I get the exepected result, both the boot loader and EOL application. When I run FlashMagic on a unit with firmware already loaded, I can change the bootloader but never the EOL Application. I'm the test engineer on this project and I don't know the detailed structure of the firmware. This behaves the same in the FlashMagic production system program and the program I wrote. In the FlashMagic  program I have tried Erase blocks used by Hex File, Fill unused Flash, Oscillator = 4 (the device is not using an external oscillator). Always with the same result. When I do a Blank Check after an Erase all Flash + CRP I get all flash blocks are blank. As I indicated earlier I have worked around this problem by allowing a BIN file update further along in our test process. I'm mainly concerned that there is some underlying process I'm missing and it will bite me some day.  Thanks
Title: Re: Erase Flash
Post by: rmatlin on September 22, 2011, 02:06:55 PM
Problem solved. It had nothing to do with FlashMagic. It was performing as expected. The issue had to do with the system this processor is working in. Thanks for all the help and attention.