Hallo All,
I know that a lot of posts discussed this problem. However, my problem is that I can write the value only once and when I try to write it another value the value doesn't change? Any help would be appreciated: The following is the main function that I'm using
void Set_BSL_FW_BIT(char bit,int address)
{
char * Flash_ptr;
Flash_ptr = (char *) address; // Initialize Flash pointer
Enable_Flash_Lock();
*Flash_ptr = bit; // Write value to flash
Disable_Flash_Lock();
}
char Get_BSL_FW_BIT(int address){
char * Flash_ptr;
char value;
Flash_ptr = (char *) address; // Initialize Flash pointer
value = * Flash_ptr;
return value;
}
void Enable_Flash_Lock(void){
__disable_interrupt();
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY+ERASE; // Set Erase bit
FCTL1 = FWKEY+WRT; // Set WRT bit for write operation
}
void Disable_Flash_Lock(void){
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY+LOCK; // Set LOCK bit
__enable_interrupt();
}