cancel
Showing results for 
Search instead for 
Did you mean: 

Difficulty Erasing Flash In-Application

jdaniel
Associate II
Posted on April 12, 2004 at 10:49

Difficulty Erasing Flash In-Application

3 REPLIES 3
jdaniel
Associate II
Posted on May 17, 2011 at 11:59

I wonder if anyone knows what might be causing the problems I'm currently having erasing a main flash bank in-application. I've basically ported the functions over from the flashcode.c file distributed with ST's IAP demo code. This works more or less correctly, except some bytes get left at 0x00 instead of erasing to 0xFF. They follow a regular pattern. Every address with a low-order byte value of 0x00 or 0x80 has data of 0 for some reason. That is, after erase, everything is 0xFF as expected except for addresses 0x0000, 0x0080, 0x0100, 0x0180, etc. This behavior seems very odd to me.

The device erases ok with the JTAG programmer and once erased, these addresses can be successfully programmed in-application by my code. I'm confused as to what might be causing this behavior. Any help would be greatly appreciated.
danielh1
Associate II
Posted on May 17, 2011 at 11:59

I had the same problem in the past and notified ST support. They acknowledged; since then...

I wrote my own IAP, after a lot of experiments. Basically I found that reliable write/erase operations on one type of flash can be done only from the other type: you can erase a main flash sector from a boot sector, and vice-versa. Of course, all interrupts MUST BE DISABLED during the operation, as explicitly stated in the datasheet.

Daniel

jdaniel
Associate II
Posted on May 17, 2011 at 11:59

Asterix,

Thanks for the tip. I am already erasing the main flash bank while executing code from boot flash, so I'm not sure that's my particular problem. I also disable interrupts during the operation. Hopefully the moderator will come back with a suggestion.

--Phaze426