DSP用的是TI的5509A,FLASH芯片为AM29LV800B,连上CCS3.3,单步运行到擦除函数,发现只有奇地址变了,而且不是FFFF,是0010。写数据的时候也是只能写入奇地址,欧地址根本写不进。以下是我部分代码和CCS图
/*FLASH写命令操作*/
void FLASH_write_byte(unsigned int offset, unsigned int data)
{
*((volatile unsigned int*)(CE1+offset))=data;
}
/*FLASH擦除函数*/
void erase_FLASH()
{
FLASH_write_byte(0x0555,0xaa);
FLASH_write_byte(0x2aa,0x55);
FLASH_write_byte(0x0555,0x80);
FLASH_write_byte(0x0555,0xaa);
FLASH_write_byte(0x02aa,0x55);
FLASH_write_byte(0x0555,0x10);
delay(100);
}
/*FLASH写数据初始化*/
void FLASH_write_initial()
{
FLASH_write_byte(0x0555,0xaa);
FLASH_write_byte(0x02aa,0x55);
FLASH_write_byte(0x0555,0xa0);
}
/*FLASH写数据*/
void FLASH_write(unsigned int write_addr,unsigned int data)
{
// FLASH_write_byte(write_addr,0xa0);
FLASH_write_byte(write_addr,data);
delay(10000);
}
main()
{
int i;
/*初始化CSL库*/
CSL_init();
/*EMIF为全EMIF接口*/
CHIP_RSET(XBSR,0x0a01);
/*设置系统的运行速度为144MHz*/
PLL_config(&myConfig);
flash=0;
erase_FLASH();
FLASH_write_initial();
fwaddr=CE1;
fwaddr+=1000;
for(i=1000;i<2000;i++)
{
FLASH_write(fwaddr+i,i);
}
|