Hi.
i'm not good at english..
This article is based on a Google Translator, so please understand if your grammar is strange.
I am going to use flash memory of msp430. But I did not fully understand how to use it.
I am writing data every 10 seconds, and I think there is a problem because of program / erase endurance.
I write to the flash memory sequentially by 2bytes, and when 32KB is full, I delete it and try to write new data.
The program / erase endurance of the msp430 flash memory is 100,000 times.
1. The flash memory address of msp430fe4272 is known as 0x8000 ~ 0xFFFF. Is that right?
2. I do not know if the number of 100,000 times goes up when I erase one segment, or when I erase the entire segment.
Please look at this source code.
void flash_erase(int *addr)
{
_DINT(); // Disable interrupts. This is important, otherwise,
// a flash operation in progress while interrupt may
// crash the system.
while(BUSY & FCTL3); // Check if Flash being used
FCTL2 = FWKEY + FSSEL_1 + FN3; // Clk = SMCLK/4
FCTL1 = FWKEY + ERASE; // Set Erase bit
FCTL3 = FWKEY; // Clear Lock bit
*addr = 0; // Dummy write to erase Flash segment
while(BUSY & FCTL3); // Check if Flash being used
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
_EINT();
}
Is the source code above erasing one segment? Or delete the entire segment?
Please tell me how to delete the entire segment at once.
and,
When writing 2 bytes of data periodically, please present an efficient method or example.