正在用EPI模块,模块能正常工作,但是速率好像比预计的慢a!有没有人测过EPI的实际速率是多少??
下面是测试代码:
void
ReadControlHandler(void)
{
unsigned short count = 544;
//length = EPINonBlockingReadGet16(EPI0_BASE,544, pucbuf);
while(HWREG(EPI0_BASE + EPI_O_RFIFOCNT) && count--)
{
//
// Read from the FIFO and store in the caller supplied buffer.
//
*pusBuf = (unsigned short)HWREG(EPI0_BASE + EPI_O_READFIFO);
//
// Update the caller's buffer pointer and the count of items read.
//
pusBuf++;
length++;
}
UARTprintf("%d
", length);
length = 0;
}
void
Timer0Handler(void)
{
TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
EPINonBlockingReadStart(EPI0_BASE, 0, 544);
UARTprintf("timer start!
");
}
void
timer0_init(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
TimerConfigure(TIMER0_BASE,TIMER_CFG_32_BIT_PER);
TimerLoadSet(TIMER0_BASE, TIMER_A, SysCtlClockGet()/2); //测试程序,AD触发频率是10K
IntEnable(INT_TIMER0A);
TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); //中断使能
TimerEnable(TIMER0_BASE, TIMER_A); //定时器开控制位: 开始
}
int
main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
PinoutSet();
InitConsole();
SysCtlPeripheralEnable(SYSCTL_PERIPH_EPI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
/*GPIOPadConfigSet(SYSCTL_PERIPH_GPIOC, EPI_PORTC_PINS, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
GPIOPadConfigSet(SYSCTL_PERIPH_GPIOE, EPI_PORTE_PINS, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
GPIOPadConfigSet(SYSCTL_PERIPH_GPIOF, EPI_PORTF_PINS, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
GPIOPadConfigSet(SYSCTL_PERIPH_GPIOG, EPI_PORTG_PINS, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
GPIOPadConfigSet(SYSCTL_PERIPH_GPIOH, EPI_PORTH_PINS, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
GPIOPadConfigSet(SYSCTL_PERIPH_GPIOJ, EPI_PORTJ_PINS, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
GPIODirModeSet(SYSCTL_PERIPH_GPIOC, EPI_PORTC_PINS, GPIO_DIR_MODE_HW);
GPIODirModeSet(SYSCTL_PERIPH_GPIOE, EPI_PORTE_PINS, GPIO_DIR_MODE_HW);
GPIODirModeSet(SYSCTL_PERIPH_GPIOF, EPI_PORTF_PINS, GPIO_DIR_MODE_HW);
GPIODirModeSet(SYSCTL_PERIPH_GPIOG, EPI_PORTG_PINS, GPIO_DIR_MODE_HW);
GPIODirModeSet(SYSCTL_PERIPH_GPIOH, EPI_PORTH_PINS, GPIO_DIR_MODE_HW);
// GPIODirModeSet(SYSCTL_PERIPH_GPIOJ, EPI_PORTJ_PINS, GPIO_DIR_MODE_HW);*/
//GPIOPinTypeGPIOOutput(GPIO_PORTJ_BASE,GPIO_PIN_5); //写控制地址1
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_PH7_EPI0S27);
GPIOPinConfigure(GPIO_PJ5_EPI0S29);
GPIOPinConfigure(GPIO_PG7_EPI0S31);
////EPI模块上或者说接口上总共有19个信号,实际上
//也可以降地址引入,用于简单的写操作!
GPIOPinTypeEPI(GPIO_PORTH_BASE, GPIO_PIN_3); //EPI0S0,数据位1
GPIOPinTypeEPI(GPIO_PORTH_BASE, GPIO_PIN_2); //EPI0S1,数据位2
GPIOPinTypeEPI(GPIO_PORTC_BASE, GPIO_PIN_4); //EPI0S2,数据位3
GPIOPinTypeEPI(GPIO_PORTC_BASE, GPIO_PIN_5); //EPI0S3,数据位4
GPIOPinTypeEPI(GPIO_PORTC_BASE, GPIO_PIN_6); //EPI0S4,数据位5
GPIOPinTypeEPI(GPIO_PORTC_BASE, GPIO_PIN_7); //EPI0S5,数据位6
GPIOPinTypeEPI(GPIO_PORTH_BASE, GPIO_PIN_0); //EPI0S6,数据位7
GPIOPinTypeEPI(GPIO_PORTH_BASE, GPIO_PIN_1); //EPI0S7,数据位8
GPIOPinTypeEPI(GPIO_PORTE_BASE, GPIO_PIN_0); //EPI0S8,数据位9
GPIOPinTypeEPI(GPIO_PORTE_BASE, GPIO_PIN_1); //EPI0S9,数据位10
GPIOPinTypeEPI(GPIO_PORTH_BASE, GPIO_PIN_4); //EPI0S10,数据位11
GPIOPinTypeEPI(GPIO_PORTH_BASE, GPIO_PIN_5); //EPI0S11,数据位12
GPIOPinTypeEPI(GPIO_PORTF_BASE, GPIO_PIN_4); //EPI0S12,数据位13
GPIOPinTypeEPI(GPIO_PORTG_BASE, GPIO_PIN_0); //EPI0S13,数据位14
GPIOPinTypeEPI(GPIO_PORTG_BASE, GPIO_PIN_1); //EPI0S14,数据位15
GPIOPinTypeEPI(GPIO_PORTF_BASE, GPIO_PIN_5); //EPI0S15,数据位16
GPIOPinTypeEPI(GPIO_PORTH_BASE, GPIO_PIN_7); //EPI0S27,IRDY外部设备就绪信号
GPIOPinTypeEPI(GPIO_PORTJ_BASE, GPIO_PIN_5); //EPI0S29,读使能信号
GPIOPinTypeEPI(GPIO_PORTG_BASE, GPIO_PIN_7); //EPI0S31,读写时钟输出信号
timer0_init();
EPIModeSet(EPI0_BASE, EPI_MODE_GENERAL); //EPI选择通用模式
EPIConfigGPModeSet(EPI0_BASE, //EPI模块基址
EPI_GPMODE_CLKPIN | //EPI时钟输出信号(EPI31)
EPI_GPMODE_RDYEN | //EPI帧输出信号
EPI_GPMODE_READWRITE | //EPI读写使能信号输出
EPI_GPMODE_READ2CYCLE | //EPI双周期读信号
EPI_GPMODE_ASIZE_NONE | //4为地址位
EPI_GPMODE_DSIZE_16 , //16位数据位
//字操作模式
0,
0);
/*EPIAddressMapSet(EPI0_BASE,
EPI_ADDR_PER_BASE_NONE | //0寻址空间
EPI_ADDR_RAM_BASE_NONE); //EPI外设基址为0xA000 0000 */
EPIFIFOConfig(EPI0_BASE,EPI_FIFO_CONFIG_RX_3_4); //配置读FIFO深度
EPIDividerSet(EPI0_BASE, 2); //EPI读写分频器
EPIIntEnable(EPI0_BASE, EPI_INT_RXREQ); //使能EPI读FIFO中断
IntEnable(INT_EPI0); //使能EPI模块中断
IntPrioritySet(INT_EPI0,0x00);
IntMasterEnable();
EPINonBlockingReadConfigure(EPI0_BASE,0,EPI_NBCONFIG_SIZE_16,0); //非阻塞读控制配置
EPINonBlockingReadStart(EPI0_BASE, 0, 544);
while(1)
{
}
}
[
本帖最后由 confuciounxk 于 2011-10-20 11:09 编辑 ]
此帖出自
小平头技术问答
如果选用这个 EPI_GPMODE_RDYEN
还需要 或上 EPI_GPMODE_CLKGATE
[ 本帖最后由 Study_Stellaris 于 2011-10-20 18:59 编辑 ]
一周热门 更多>