2004-04-12 01:49 AM
Difficulty Erasing Flash In-Application
2011-05-17 02:59 AM
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.2011-05-17 02:59 AM
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. Daniel2011-05-17 02:59 AM
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