0
\$\begingroup\$

EDIT: I am purposely trying to corrupt my ATxmega32E5 flash memory.

I am disabling my BOD level on my ATxmega32E5 and checking how it affects my MCU by switching the power on the mcu on and off with a big capacitor attached to it to reduce fall, rise times of the voltage.

schematic

simulate this circuit – Schematic created using CircuitLab

I managed to corrupt my flash memory several times (I know that because the mcu lights up a led when turned on, and the led stops turning on at some point). When I re-program my flash, everything works great again, the led blinks.

Now, every time my mcu was corrupted, before re-uploading the flash/firmware again, I stored/read (by using atmel ice) the broken/corrupted flash memory and I can see that it has differences compared to the one I am uploading.

But I wonder, is there any chance that part of these "corruptions" I am seeing, are a normal behavior of the flash memory? Does the mcu change the flash memory in a permanent way while a program runs to store variables for example?

(I know that there are ways to change the flash memory while the mcu is running, but I am not using any of these techniques)

\$\endgroup\$
7
  • \$\begingroup\$ A corruption of flash is not "normal". You should look at your code. Your schematic is suspicious too. Why VCC is fed with square wave? \$\endgroup\$
    – Eugene Sh.
    Feb 23, 2021 at 15:12
  • \$\begingroup\$ I know its not normal. I am creating the corruptions in purpose. I am using pulses in the MCU's VCC to create issues with the flash, and then checking the corrupted flash for differences with the one i uploaded initially. \$\endgroup\$ Feb 23, 2021 at 15:17
  • \$\begingroup\$ Well, you should have stated more clearly that you are doing it on purpose. But this is making it not clear what you question is. As said, there are no "normal" flash corruptions which wouldn't be taken care of by the flash controller. \$\endgroup\$
    – Eugene Sh.
    Feb 23, 2021 at 15:19
  • 1
    \$\begingroup\$ > Does the mcu change the flash memory in a permanent way while a program runs to store variables for example - no, unless your program instructs it to do so. \$\endgroup\$
    – Eugene Sh.
    Feb 23, 2021 at 15:36
  • 3
    \$\begingroup\$ Do you have a bootloader? I've seen this happen before on an ATTiny MCU which had a bootloader which in the right conditions would corrupt the first line in the flash if the supply level was too low without a brownout. \$\endgroup\$ Feb 23, 2021 at 15:51

1 Answer 1

1
\$\begingroup\$

Yes i do have a bootloader. and the corruption happens on the first lines mainly (1st to 8th line of the flash)

If your micro-controller has a bootloader then that means it has the ability to program it's own flash under software control. Furthermore it has code in the program memory that was designed to write the flash.

If you allow a processor to run below it's designed supply voltage, then you risk erratic operation. Said erratic operation could lead to inadvertant triggering of the programming code in the bootloader.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.