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.
Hi I had this working fine, now I am having trouble erasing the flash from 0x1000 to 0x17FF. When I run the code below, the program loses control as soon as I get to the dummy write to start the erase. It looks like it keeps resetting or goes into never never land. Any ideas as to what is going on? I can single step to the dummy write, but as soon as I execute that line, it crashes.
Thanks
//WRITES PROPER BSL CODE TO 1000-17FF
void Rewrite_BSL(void)
{_DINT();
static unsigned int i,j;
static char * Flash_ptr; // Initialize Flash pointer
static char *Mem_ptrD;
Flash_ptr = (char *) 0x1000;
Mem_ptrD = (char *) &BSL_CODE;
for(j=0;j<4;j++)
{ FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY|ERASE; // Set Erase bit
*Flash_ptr = 0; // Dummy write to erase Flash seg
FCTL1 = FWKEY|WRT; // Set WRT bit for write operation
delay(100);
Flash_ptr+=0x200;//total 4 segs
}
Flash_ptr = (char *) 0x1000;
for (i = 0; i < 0x800; i++)
{
*Flash_ptr++ = *Mem_ptrD++; // Write value to flash
}
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY|LOCK; // Set LOCK bit
return;
}
**Attention** This is a public forum