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.

MSP430擦写片内地址>64k的地址空间遇到的问题

Other Parts Discussed in Thread: MSP430F249

原来是用的MSP430F249,后来空间不够了改用F2416,但是地址》0xFFFF的高位空间,不知道如果去擦写这些高位空间。

如果我要对0x13000这个地址的扇区进行擦写操作的话,总是不成功。

void Test_WriteFlash(void)
{
U16 i;
char* pdb;

WDTCTL = WDTPW + WDTHOLD;

//second segment
pdb = (int *)FLASH_TEST;
FCTL3 = FWKEY; //clear lock bit
FCTL1 = FWKEY + ERASE; //set erase bit

*pdb = 0;
FCTL1 = FWKEY + WRT; //dummy write
while ((FCTL3 & BUSY) > 0);
*pdb = 0x55;

//-- disable flash write
FCTL1 = FWKEY;
FCTL3 = FWKEY + LOCK;

}

当#define FLASH_TEST 0x2000时,能够把0x2000地址的扇区删除并对第一个 字节写入0x55.

当#define FLASH_TEST 0x13000时,对0x13000地址的操作则无法成功。

  • dirtwillfly,

    当操作的FALSH地址超过了64KBYTE时,需要在编译器选项中处理器设置里将DATA/CODE MODE设置为LARGE。

    上面是IAR中的操作,IAR 开发环境中,右键点项目名称进入Options for node "xxx", 在General Options的Target页面的Data Model选项中 选择Large模式.

    BR,

    Lina


  • 你可以用 __data20_write_short(IVal,0);替换 pdb = (int *)FLASH_TEST;

    __data20_write_short(地址,数据)完成全数据的写入替换 *pdb = 0x55;