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.

5438AFlash自编程问题



先将TXT文件通过232下载转换到一个外存(AT45DB161E)与5438一样都是每512字节一页;下载完成检验正确后写入5838A出现问题;5438A不能运行;并且也不能再通过JTAG下载了;整

//*********************************************************
//不可以调用外部段的函数,因为可能已经擦除了!
void gengxin(void)@"MYSEG"
{
char *Flash_ptrD; // Flash pointer
unsigned int k,seg;
unsigned long i;
_DINT();
WDTCTL = WDTPW + WDTHOLD;//停止看门狗
//擦除操作
//Flash_ptr = (char*) MYSEG_end; // Initialize Flash pointer
seg=(MYSEG_end/512); //要擦除的开始段;本身不能擦除;从0x6000开始
for(i=seg;i<512;i++) //512页
{
while(FCTL3&BUSY);
Flash_ptrD=(char*)(i*0x200);
FCTL1 = FWKEY + ERASE; // Set Erase bit
FCTL3 = FWKEY; // Clear Lock bit
*Flash_ptrD = 0; // Dummy write to erase Flash segment
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation
//编程操作
while(FCTL3&BUSY);
//外存第512块0地址对应于CPU_FLASH的0X5C00地址;实际页开始地址为:0x6000-0x5c00=1024;/2=2
//即从外存的第二页开始读
continous_gj_rd ((i-46),0,512,buf);//每次读512字节
for(k=0;k<512;k++)*Flash_ptrD++=buf[k];
while(FCTL3&BUSY);
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Reset LOCK bit
}
while(FCTL3&BUSY);
//复位程序
WDTCTL =0;
}

个报废了;同样的程序在149上没有问题!有谁告诉怎么办?