(Reposted with topic tag) * * A contradiction: >> Now, the program itself frequently _moves_ 32-byte >> blocks from program memory to RAM, but >> never writes in program memory. Versus: >> I normally use an USB bootloader to load the actual software. Maybe you'll see it as semantics, but "never writes to program memory" isn't accurate. What you mean is that you don't do that intentionally. But there is a routine present in memory at all times that will cheerfully write to program memory if that routine is entered. I'm not trying to split hairs. I remember a long discussion years ago here in which this sort of thing was hashed out. You have actually run some good experiments for us that pretty much points to the block erase function as the culprit. Meaning, it's not some hardware glitch that causes blocks to disappear. Instead, it's probably "random code execution". So, what to do? Everything Dom just said applies, and I won't repeat that. Another level of protection might be to make it more difficult for the bootloader code to write to program memory (like "secret unlock codes"). But you can only be so clever, because there will always some place you can jump to that knows all the tricks to do the erase. As well as the core erase routine itself. Microchip has some parts (don't recall--might be only the 32-bit) that allow you to access the configuration once and only once at power on, then protects it. This could allow the bootloader to access normally protected space. But that's not a guarantee if there are startup glitches. There are situations where there's a cause and then there are subsequent preventions to guard against the actions of the cause. In my humble opinion, it is best to prevent the problem in the first place, than to try deflecting it later. I think attacking possible startup glitches and power problems is the way to do it. By the way, where I worked, we always used an external brownout/reset controller (simple 3-pin device) and have never experienced this particular problem. And I did have a bootloader most times. --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .