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的某个地址上的Flash坏了,BUSY会是什么?

Other Parts Discussed in Thread: MSP430F4152

现在产品使用的是MSP430F4152,因为刚开始没有考虑那么全面 ,产品已经量产了安装了,数据存储用的是以下的代码:

void WaitForEnable()
{
    while((FCTL3 & BUSY) == BUSY);      //Busy
}

void WriteFlash(unsigned int Addr,unsigned char *Data,unsigned char DataLend)
{
	WDTCTL = WDTPW+WDTHOLD;
    char i;

    char *FlashPtr = (char *)Addr;              // Segment  pointer

    FCTL1 = FWKEY + WRT;                        // Set WRT bit for write operation

    FCTL3 = FWKEY;                              // Clear Lock bit

    _DINT();

    for(i=0;i<DataLend;i++)
    {
	*FlashPtr = *Data;                           // Save Data
	WaitForEnable();                            //Busy
	*FlashPtr++;
        Data++;
    }

    _EINT();
    FCTL1 = FWKEY;                              // Clear WRT bit
    FCTL3 = FWKEY + LOCK;                       // Set LOCK bit
    WDTCTL = WDT_ARST_1000;//开一秒看门狗

}

如果MCU的某一地址的flash坏了 是否会导致

while((FCTL3 & BUSY) == BUSY);      //Busy 
无限等待吗?
  • 是有这个可能,因此在设计软件的时候,是不建议设置这种可能无限等待的while的。你可以使用逻辑运算与,包含一个计时的变量,当等待到计时变量为假的时候自动跳过这个检测。

  • 同意楼上的观点.

    有可能一直Busy, 设置Time out功能, 同时程序中记录此情况, 下次执行可绕过.