|
关于248 flash无法访问问题,郁闷中,请大侠指点!!
[复制链接]
我使用TI给的例子程序,始终无法将FCTLx中读密码096H改为写密码0A5H,请问这是为何?
代码如下:
Flash_ptrA = (char *)0x1000; // Point to beginning of seg A
while(FCTL3 & BUSY);
FCTL2 = FWKEY + FSSEL_3 + FN3; // MCLK/3 for Flash Timing Generator
while(FCTL3 & BUSY);
FCTL1 = FWKEY + ERASE; // Set Erase bit
while(FCTL3 & BUSY);
FCTL3 = FWKEY + LOCKA; // Clear LOCK & LOCKA bits
*Flash_ptrA = 0x00; // Dummy write to erase Flash seg A
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation
Flash_ptrA = (char *)0x1000; // Point to beginning of cal consts
for (j = 0; j < 8; j++)
*Flash_ptrA++ = 0x55; // re-flash DCO calibration data
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCKA + LOCK; // Set LOCK & LOCKA bit
是否加忙判断,效果都一样!!
郁闷中,请大侠指点!!
|
|