LM3S9B92的EPI功能外接一个16位并行的铁电SRAM, 配置好后不知道数据该如何存储和读取;配置如下:
void init(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_EPI0); //使能EPI模块
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
//================== 配置GPIO为EPI=================
GPIOPinConfigure(GPIO_PH3_EPI0S0);
GPIOPinConfigure(GPIO_PH2_EPI0S1);
GPIOPinConfigure(GPIO_PC4_EPI0S2);
GPIOPinConfigure(GPIO_PC5_EPI0S3);
GPIOPinConfigure(GPIO_PC6_EPI0S4);
GPIOPinConfigure(GPIO_PC7_EPI0S5);
GPIOPinConfigure(GPIO_PH0_EPI0S6);
GPIOPinConfigure(GPIO_PH1_EPI0S7);
GPIOPinConfigure(GPIO_PE0_EPI0S8);
GPIOPinConfigure(GPIO_PE1_EPI0S9);
GPIOPinConfigure(GPIO_PH4_EPI0S10);
GPIOPinConfigure(GPIO_PH5_EPI0S11);
GPIOPinConfigure(GPIO_PF4_EPI0S12);
GPIOPinConfigure(GPIO_PG0_EPI0S13);
GPIOPinConfigure(GPIO_PG1_EPI0S14);
GPIOPinConfigure(GPIO_PF5_EPI0S15);
GPIOPinConfigure(GPIO_PJ0_EPI0S16);
GPIOPinConfigure(GPIO_PJ1_EPI0S17);
GPIOPinConfigure(GPIO_PH7_EPI0S27);
GPIOPinConfigure(GPIO_PJ4_EPI0S28);
GPIOPinConfigure(GPIO_PJ5_EPI0S29);
GPIOPinConfigure(GPIO_PJ6_EPI0S30);
GPIOPinTypeEPI(GPIO_PORTC_BASE, EPI_PORTC_PINS);
GPIOPinTypeEPI(GPIO_PORTE_BASE, EPI_PORTE_PINS);
GPIOPinTypeEPI(GPIO_PORTF_BASE, EPI_PORTF_PINS);
GPIOPinTypeEPI(GPIO_PORTG_BASE, EPI_PORTG_PINS);
GPIOPinTypeEPI(GPIO_PORTH_BASE, EPI_PORTH_PINS);
GPIOPinTypeEPI(GPIO_PORTJ_BASE, EPI_PORTJ_PINS);
//================== EPI配置 ===================
EPIDividerSet(EPI0_BASE, 100); //波特率等于系统时钟/2
EPIModeSet(EPI0_BASE, EPI_MODE_HB16); // SRAM使用HB16模式
EPIConfigHB16Set(EPI0_BASE,
EPI_HB16_MODE_ADMUX | //使用ADMUX子模式,地址/数据总线复用子模式
EPI_HB16_WRWAIT_3 | //无写等待态
EPI_HB16_RDWAIT_3 | //无读等待态
EPI_HB16_WORD_ACCESS | //使用字访问模式
EPI_HB16_CSCFG_ALE //使用ALE配置,EPI0S30用ALE
,0); //无使用FIFO,无需设置
EPIAddressMapSet(EPI0_BASE,
EPI_ADDR_RAM_SIZE_16MB | //设置片外SRAM空间为16MB
EPI_ADDR_RAM_BASE_6); //设置自外SRAM的映射空间基地址为0x60000000
//==============================================
while(HWREG(EPI0_BASE + EPI_O_STAT) & EPI_STAT_INITSEQ)
{
}
}
EPIO27用做片选;ALE=EPIO30 ; |