FLASH写不进去,怎么回事?
时间:10-02
整理:3721RD
点击:
FLASH是SST39VF400A,原理图用的和CCS文档中的提供的,DSP是TMS320C6701,程序跑起来,运行到写数据就死了,不知道怎么回事?
代码如下:
void main()
{
int f;
f = Check_SST_39VF400A();
if(!f)
return;
Erase_Entire_Chip();
}
int Check_SST_39VF400A()
{
int*ctrl_addr1;
int*ctrl_addr2;
int SST_id1;
int SST_id2;
int ReturnStatus;
/* Issue the Software Product ID code to 39VF400A */
ctrl_addr1 = (int*)((int)flash_ptr+(0x5555<<2));
ctrl_addr2 = (int*)((int)flash_ptr+(0x2aaa<<2));
*ctrl_addr1= 0xAAAA; /* write data 0xAAAA to the address1 */
// ctrl_addr2 = (int*)((int)flash_ptr+(0x2AAA<<2));
// 只能运行到这里!
*ctrl_addr2= 0x5555; /* write data 0x5555 to the address2 */
// ctrl_addr1 = (int*)((int)flash_ptr+(0x5555<<2));
*ctrl_addr1= 0x9090; /* write data 0x9090 to the address1 */
Delay(150); /* insert delay time = 150 ns */
/* Read the product ID from 39VF400A */
ctrl_addr1 = (int*)((int)flash_ptr+(0x0000<<2));
ctrl_addr2 = (int*)((int)flash_ptr+(0x0001<<2));
SST_id1 = *ctrl_addr1; /* get first ID int */
SST_id1 = SST_id1 & 0xFF; /* mask of higher char */
SST_id2 = *ctrl_addr2; /* get second ID int */
/* Determine whether there is a SST39VF400A installed or not */
if ((SST_id1 == SST_ID) && (SST_id2 ==SST_39VF400A))
ReturnStatus = TRUE;
else
ReturnStatus = FALSE;
/* Issue the Soffware Product ID Exit code thus returning the 39VF400A*/
/* to the read operating mode */
ctrl_addr1 = (int*)((int)flash_ptr+(0x5555<<2));
ctrl_addr2 = (int*)((int)flash_ptr+(0x2aaa<<2));
*ctrl_addr1= 0xAAAA; /* write data 0xAAAA to the address1 */
*ctrl_addr2= 0x5555; /* write data 0x5555 to the address2 */
*ctrl_addr1= 0xF0F0; /* write data 0xF0F0 to the address1 */
Delay(150); /* insert delay time = 150 ns */
return(ReturnStatus);
}
代码如下:
void main()
{
int f;
f = Check_SST_39VF400A();
if(!f)
return;
Erase_Entire_Chip();
}
int Check_SST_39VF400A()
{
int*ctrl_addr1;
int*ctrl_addr2;
int SST_id1;
int SST_id2;
int ReturnStatus;
/* Issue the Software Product ID code to 39VF400A */
ctrl_addr1 = (int*)((int)flash_ptr+(0x5555<<2));
ctrl_addr2 = (int*)((int)flash_ptr+(0x2aaa<<2));
*ctrl_addr1= 0xAAAA; /* write data 0xAAAA to the address1 */
// ctrl_addr2 = (int*)((int)flash_ptr+(0x2AAA<<2));
// 只能运行到这里!
*ctrl_addr2= 0x5555; /* write data 0x5555 to the address2 */
// ctrl_addr1 = (int*)((int)flash_ptr+(0x5555<<2));
*ctrl_addr1= 0x9090; /* write data 0x9090 to the address1 */
Delay(150); /* insert delay time = 150 ns */
/* Read the product ID from 39VF400A */
ctrl_addr1 = (int*)((int)flash_ptr+(0x0000<<2));
ctrl_addr2 = (int*)((int)flash_ptr+(0x0001<<2));
SST_id1 = *ctrl_addr1; /* get first ID int */
SST_id1 = SST_id1 & 0xFF; /* mask of higher char */
SST_id2 = *ctrl_addr2; /* get second ID int */
/* Determine whether there is a SST39VF400A installed or not */
if ((SST_id1 == SST_ID) && (SST_id2 ==SST_39VF400A))
ReturnStatus = TRUE;
else
ReturnStatus = FALSE;
/* Issue the Soffware Product ID Exit code thus returning the 39VF400A*/
/* to the read operating mode */
ctrl_addr1 = (int*)((int)flash_ptr+(0x5555<<2));
ctrl_addr2 = (int*)((int)flash_ptr+(0x2aaa<<2));
*ctrl_addr1= 0xAAAA; /* write data 0xAAAA to the address1 */
*ctrl_addr2= 0x5555; /* write data 0x5555 to the address2 */
*ctrl_addr1= 0xF0F0; /* write data 0xF0F0 to the address1 */
Delay(150); /* insert delay time = 150 ns */
return(ReturnStatus);
}
你在擦除flash前的操作干吗呢?对flash应该擦除成功后坐进行写操作吧。因为flash里面只会从1变0。所以应该擦除成功后即flash空间都变为FFFF后,在写的!
建议吧Erase_Entire_Chip();放到你的子函数顶部
使用Flashburn
CCS6000没有烧写插件,只有用Flashburn