DSP通过EMIF与CPLD通信,读数据时正常,写数据反而要写两次(两次AWE拉低信号)?
EMIF配置:
/*异步16位EMIF设置*/
EMIF_Config emiffig = {
(3<<9|0<<5|1<<4),//EGCR
0xFFFF, //EMI_RST: any write to this register resets the EMIF state machine
//CE0_1: CE0 space control register 1
(1<<12|0xf<<8|0x3f<<2|3),// MTYPE = 01,Synchronous ,16-bit data bus width
//CE0_2: CE0 space control register 2
(3<<14|3<<12|0xf<<8|0x3f<<2|3),
0x00FF, //CE0_3: CE0 space control register 3
//CE1_1: CE0 space control register 1
(0<<12|2<<8|5<<2|2),
//CE1_2: CE0 space control register 2
(1<<14|1<<12|2<<8|5<<2|2),
0x00FF, //CE1_3: CE0 space control register 3
//CE2_1: CE1 space control register 1
(0<<12|2<<8|5<<2|2),
//CE2_2: CE1 space control register 2
(1<<14|1<<12|2<<8|5<<2|2),
0x00FF, //CE2_3: CE0 space control register 3
0x7FFF, //CE3_1: CE0 space control register 1
0xFFFF, //CE3_2: CE0 space control register 2
0x00FF, //CE3_3: CE0 space control register 3
EMIF_SDC1_DEFAULT,
EMIF_SDPER_DEFAULT,
EMIF_INIT_DEFAULT ,
EMIF_SDC2_DEFAULT
};
读写地址:
#define KEYPORT (*(Uint32 *)(0x40002>>1))
#define PORT (*(Uint32 *)(0x40000>>1))
while(1)
{
KEYPORT =0xaa;//写
delay_us(100);
Ptemp=PORT;//读
delay_us(100);
}
波形:
读:(因外部CPLD还没有工作测试只是直接测试DSP的EMIF输出,所以读的时候可能会读到0XAA)
写:

