2812硬件仿真速度较快,但下载到FLASH中运行速度下降10倍左右,可能初始设置有问题,请高手帮忙.
void InitFlash(void)
{
EALLOW;
//Enable Flash Pipeline mode to improve performance
//of code executed from Flash.
FlashRegs.FOPT.bit.ENPIPE = 1;
//Set the Random Waitstate for the Flash
FlashRegs.FBANKWAIT.bit.RANDWAIT = 5;
//Set the Paged Waitstate for the Flash
FlashRegs.FBANKWAIT.bit.PAGEWAIT = 5;
//Set number of cycles to transition from sleep to standby
FlashRegs.FSTDBYWAIT.bit.STDBYWAIT = 0x01FF;
//Set number of cycles to transition from standby to active
FlashRegs.FACTIVEWAIT.bit.ACTIVEWAIT = 0x01FF;
EDIS;
.
asm(" RPT #7 || NOP";
}
void InitPll(Uint16 val)
{
volatile Uint16 iVol;
EALLOW;
SysCtrlRegs.PLLCR.bit.DIV = 6;
/////////////////////////////add
XintfRegs.XINTCNF2.bit.CLKOFF=1 ;//off clkout
XintfRegs.XINTCNF2.bit.WRBUFF=3 ;//
XintfRegs.XINTCNF2.bit.CLKMODE=0;//
XintfRegs.XINTCNF2.bit.XTIMCLK=0;//=sysclk
///////////////////////////////////////////
SysCtrlRegs.HISPCP.all = 0x0007; //low clk
SysCtrlRegs.LOSPCP.all = 0x0007; //low clk
EDIS;
for(iVol= 0; iVol< ( (131072/2)/12 ); iVol++)
{
}
}
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
flash的效率一般只有RAM的70-80%左右
你可以采用Flash搬移到Ram中运行
一周热门 更多>