1. There is a requirement to store some information across power cycles and since there is no FlexNVM on K26(at least the p/n we have), we decided to store that information in program flash itself.
I have implemented the FTFE program flash driver to execute from RAM during power up to erase/write to the program flash.
My question - Is it necessary to execute the flash driver from RAM, I did not find any documentation recommending against executing the code from flash while the Flash erase/write operations are performed. Any suggestions/recommendations? Is it not safe to execute flash driver and perform operation on itself?
2. The manual mentions :
A flash memory location must be in the erased state before
being programmed. Cumulative programming of bits (back-to back
program operations without an intervening erase) within a
flash memory location is not allowed. Re-programming of
existing 0s to 0 is not allowed as this over stresses the device.
From a performance point of view I would rather not erase every power-up but I am doing so because of this directive
My question - Is erasing flash better than over writing 0s to 0. In my case as I am erasing a block of memory on every power cycle, will there be memory degradation. What would over stress the device more in this case writing 0s to 0s or erasing same block of memory over and over?
Thanks,
Nagabhushan
Hi Sabina,
Thanks for the answers.
1. So that would be 1MB block ranges as per the table in Section 4.2
either 0x0000_0000 - 0x000F_FFFF or 0x0010_0000 - 0x001F_FFFF. Is that correct?
2. About question 2, maybe i didn't phrase the question properly.
I am aware that '0' cannot be programmed to '1' but is it safe to program '0' to '0'. The reason to do this is avoiding erase operation.
For example say I have Data 0xDEADBEEF = > 1101 1110 1010 1101 1011 1110 1110 1111. Is it ok to program this to 0x00000000 by using the Program command where in I would be trying to program '1' to '0' and '0' to '0' (which would have no effect?)
We have done this in some external flash devices before but since the manual specifically talks about it (refer my OP), wanted to understand if performing the above operation would stress the device over say erasing every power-up. So it would be
0xDEADBEEF -----erase -------> 0xFFFFFFFF -----program ----> 0x00000000
vs
0xDEADBEEF ---- program--->0x0000000
Thanks,
Nagabhushan
Hi Nagabhushan,
1. Yes these are the correct block ranges for Block0/1 and Block2/3.
2. Overwriting 0s to 0 is not allowed, it will harm the microcontroller and will cause problems later on. In this case the process is "0xDEADBEEF -----erase -------> 0xFFFFFFFF -----program ----> 0x00000000 "
Best Regards,
Sabina
Hello Nagabhushan,
Here are the answers to your questions above:
1. It is not necessary to execute the flash driver from RAM. You may do this from flash itself. However, it is necessary that you use different blocks.As long as you execute on a different block than the one you are programming this will be safe operation. Keep in mind, that the flash memory on this device should not be programmed or erased while operating in High Speed Run or VLPR power modes.
2. The programming operation is unidirectional it can only move bits from the '1' state (erased) to the '0' state(programmed). Only the erase operations restores the bits from '0' to '1'. In addition you cannot program the bits from '0' to '1'. You can find more information on this in Chapter 32.
Please let me know if you have any further questions.
Best Regards,
Sabina
Hello Nagabhushan,
Thank you in advance for your patience. I am currently confirming the information. I will let you know as soon as I have an answer.
Best Regards,
Sabina