This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1231H6PZ: Enable/Disable flash memory protection

Part Number: TM4C1231H6PZ

Hello, 

I am working on an application in which I am required to FlashProtectSet(FlashReadOnly) at the very beginning of the application code to protect the range of memory(internal microcontroller flash) where my application code resides. I have used a custom bootloader which decides whether to continue in application mode or update mode every time the device is turned on or restarts. I have a firmware file(lets say firmware2)which resides in another range of microcontroller flash memory. On receiving certain command from user I am required to update my application code(residing in protected flash memory) with the firmware2 file. I am resetting the microcontroller using "HWREG(NVIC_APINT) = NVIC_APINT_VECTKEY | NVIC_APINT_SYSRESETREQ" api. Bootloader enters into update mode & here I am suppossed to copy firmware2 file to address where my application code resides. But here the application memory still remains in "FlashReadOnly" mode.

In FlashProtectSet api description, it is written that "Changes to the flash protection are maintained only until the next reset".

How should I proceed to make this range of microcontroller flash memory writtable in bootloader?

  • I'm fairly certain you must perform a reset. I don't have the documentation in front of me but that's what I recall.

    Robert
  • Hi,

     Robert is correct. Please see below from the datasheet.

    The factory settings for the FMPREn and FMPPEn registers are a value of 1 for all implemented

    banks. These settings create a policy of open access and programmability. The register bits may

    be changed by clearing the specific register bit. The changes are effective immediately, but are not

    permanent until the register is committed (saved), at which point the bit change is permanent. If a

    bit is changed from a 1 to a 0 and not committed, it may be restored by executing a power-on reset

    sequence. The changes are committed using the Flash Memory Control (FMC) register