I would like to store a special sequence number in flash. Is there any advantage to storing it in SegmentA (InfoA) segment with the following code:
void write_SegA()
{
char * Flash_Addr = (char *)0x10F0;
BCSCTL1 = CALBC1_1MHZ; // Set DCO to 1MHz
DCOCTL = CALDCO_1MHZ;
FCTL2 = FWKEY + FSSEL0 + FN1; // MCLK/3 for Flash Timing Generator
FCTL3 = FWKEY + LOCKA; // Clear LOCK & LOCKA bits
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation
Flash_Addr[0]=1;
Flash_Addr[1]=2;
Flash_Addr[2]=3;
Flash_Addr[3]=4;
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCKA + LOCK; // Set LOCK & LOCKA bit
}
I notice it does not erase first, will this work. The sequence # must get updated every 15 minutes.
This area of flash is 0xFF, so should be fine to use.
Thanks, Tom