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.
Address allocation
bootloader:0x5c00-0x6bff
app:0x6c00-0xfcff 0x10000-0x16000
USE IARforMSP430
the question:
the BSL program cannot erase the flash range 0x10000 from 0x16000 , why ?
thanks!
Thank you for your reply.
I set the data model to medium or large ,but still not erase correctly.
the erase code as follow:
//erase code
void FLASH_Erase(void)
{
unsigned int Adr;
Adr=0x6C00; //erase code 1
while(Adr<0xFDFF)
{
FLASH_EraseSEG((unsigned int *)Adr);
Adr+=0x0200;
if(Adr%0x1000==0)
SCI_Tx('*');
}
Adr=0x10000; //erase code 2
while(Adr<0x16000)
{
FLASH_EraseSEG((unsigned int *)Adr);
Adr+=0x0200;
if(Adr%0x1000==0)
SCI_Tx('*');
}
}
//erase one segment---one SEG is 0x200 (512 Bytes)
void FLASH_EraseSEG(unsigned int *Address)
{
_DINT();
FCTL3=FWKEY; // LOCK = 0
while((FCTL3&BUSY)==BUSY); // Waitint for FLASH
FCTL1=FWKEY+ERASE; // ERASE=1
*Address=0; // Write to the SEGment
FCTL1=FWKEY;
FCTL3=FWKEY+LOCK;
while((FCTL3&BUSY)==BUSY); // Waitint for FLASH
_EINT();
}
when run the erase code 2,it will go wrong
Hi,
you declare your variable "Adr" as unsigned int. That is a 16bit number. You need to use unsigned long.
unsigned long Adr;
For more information please also have a look at this e2e threads:
https://e2e.ti.com/support/microcontrollers/msp430/f/166/p/38837/140201
Best regards,
Andre
**Attention** This is a public forum