本帖最后由 direrwind 于 2015-7-30 12:27 编辑
我从影片范例、datasheet、书本都已看过,还是没成功,读到的值全都是FFFFFFFF,这是为什么呢?
以下是我的FMC的程式码,
UNLOCKREG();
DrvFMC_EnableISP();
DrvFMC_EnableLDUpdate();
FMC->ISPCMD.FCTRL=2; //Erase
FMC->ISPCMD.FCEN=0;
FMC->ISPCMD.FOEN=1;
FMC->ISPADR=0x1F000;
FMC->ISPTRG.ISPGO=1;
__ISB();
while(FMC->ISPTRG.ISPGO==1);
if(FMC->ISPCON.ISPFF==1)
{
FMC->ISPCON.ISPFF=1;
}
FMC->ISPCMD.FCTRL=1;//Write
FMC->ISPCMD.FCEN=0;
FMC->ISPCMD.FOEN=1;
FMC->ISPADR=0x1F000;
FMC->ISPDAT=0x3;
FMC->ISPTRG.ISPGO=1;
__ISB();
while(FMC->ISPTRG.ISPGO==1);
if(FMC->ISPCON.ISPFF==1)
{
FMC->ISPCON.ISPFF=1;
}
FMC->ISPCMD.FCTRL=0;//Read
FMC->ISPCMD.FCEN=0;
FMC->ISPCMD.FOEN=0;
FMC->ISPADR=0x1F000;
FMC->ISPDAT=0;
FMC->ISPTRG.ISPGO=1;
__ISB();
while(FMC->ISPTRG.ISPGO==1);
if(FMC->ISPCON.ISPFF==1)
{
FMC->ISPCON.ISPFF=1;
}
data=FMC->ISPDAT;
FMC->ISPCON.ISPEN = 0;
|