Part Number:TMS320F28377D
Hi team,
我将EMIF配置为异步的32bit模式,用于读写FPGA内配置的双口RAM,EMIF的配置代码如下:
void EmifInit(void)
{
Uint16 ErrCount = 0,i = 0;
for (i=28; i<=87;i++)
{
if (i != 42 || i != 43 || i != 84 )
{
GPIO_SetupPinMux(i,0,2);
}
}
GPIO_SetupPinMux(88,0,3);
GPIO_SetupPinMux(89,0,3);
GPIO_SetupPinMux(90,0,3);
GPIO_SetupPinMux(91,0,3);
GPIO_SetupPinMux(92,0,3);
GPIO_SetupPinMux(93,0,3);
GPIO_SetupPinMux(94,0,2);
//setup async mode for Data pins
for (i=53; i<=85;i++)
{
if (i != 84)
{
GPIO_SetupPinOptions(i,0,0×31);
}
}
EALLOW;
//PLLSYSCLK(200MHz)/1 is selected
ClkCfgRegs.PERCLKDIVSEL.bit.EMIF1CLKDIV = 0x0;
EDIS;
EALLOW;
//Disable Access Protection (CPU_FETCH/CPU_WR/DMA_WR)
Emif1ConfigRegs.EMIF1ACCPROT0.all = 0x0;
if (Emif1ConfigRegs.EMIF1ACCPROT0.all != 0x0)
{
ErrCount++;
}
// Commit the configuration related to protection. Till this bit remains set
// content of EMIF1ACCPROT0 register can't be changed.
Emif1ConfigRegs.EMIF1COMMIT.all = 0x1;
if(Emif1ConfigRegs.EMIF1COMMIT.all != 0x1)
{
ErrCount++;
}
// Lock the configuration so that EMIF1COMMIT register can't be changed any more.
Emif1ConfigRegs.EMIF1LOCK.all = 0x1;
if (Emif1ConfigRegs.EMIF1LOCK.all != 1)
{
ErrCount++;
}
EDIS;
Emif1Regs.ASYNC_CS2_CR.bit.ASIZE = EMIF_ASYNC_ASIZE_32; // 1:0 Asynchronous Memory Size.
Emif1Regs.ASYNC_CS2_CR.bit.TA = 3; // 3:2 Turn Around cycles.
Emif1Regs.ASYNC_CS2_CR.bit.R_HOLD = 0; // 6:4 Read Strobe Hold cycles.
Emif1Regs.ASYNC_CS2_CR.bit.R_STROBE = 5; // 12:7 Read Strobe Duration cycles.
Emif1Regs.ASYNC_CS2_CR.bit.R_SETUP = 0; // 16:13 Read Strobe Setup cycles.
Emif1Regs.ASYNC_CS2_CR.bit.W_HOLD = 0; // 19:17 Write Strobe Hold cycles.
Emif1Regs.ASYNC_CS2_CR.bit.W_STROBE = 5; // 25:20 Write Strobe Duration cycles.
Emif1Regs.ASYNC_CS2_CR.bit.W_SETUP = 0; // 29:26 Write Strobe Setup cycles.
Emif1Regs.ASYNC_CS2_CR.bit.EW = 0; // 30 Extend Wait mode.
Emif1Regs.ASYNC_CS2_CR.bit.SS = 0; // 31 Select Strobe mode.默认正常模式
}
配置的读写周期数一致,可是我测试时发现读一次数据需要19个时钟周期,写一次数据只需要7或8个时钟周期,这是为什么呢?如何加快读数据的过程呢?
Ben Qin:
你好,你使用的是什么板子?官方板还是自制板?有没有尝试过TI的例程?