完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
想咨询一个问题,我想用5509A来读取存放在FIFO(IDT7205,9*8192)中的数据(来自8位ADC采集),ADC和FIFO用的相同的CLKIN,DSP的CE1定义为异步存储器,DSP的ARE接FIFO的读引脚,DSP的INT1(帧同步事件)接FIFO的HF,想每半满一次,就用DMA运送一帧数据(4096),想问下程序框架流程,和一些具体问题。如果可以的话,加我QQ:7614 75 745,非常感谢
|
|
相关推荐
2个回答
|
|
|
|
|
|
/***********************************************************************************
This is a program about reading data from fifo to DARAM by DMA chanel1,one Block=1 Frame; 1 Frame=4096 Element;each element is a 16bit data(int type); 通过将INT1与FIFO的HF相连,作为帧同步事件,每发生一次帧同步事件,就启动DMA传输并处理(一帧)。 ***********************************************************************************/ #include #include #include #include #include #include #include #include #define N 4096 /*全局变量声明*/ int *souraddr,*temp; Uint16 eventId0;//定义中断ID号 int old_intm,i,j; Uint16 srcAddrHi, srcAddrLo; Uint16 databufferAddrHi, databufferAddrLo; /*在CMD文件中指定数据来源和存储位置*/ #pragma DATA_SECTION(databuffer,"dmaMem") Uint16 databuffer[4096],dst[4096];//databuffer[]实现数组中转功能 #pragma DATA_SECTION(src,"fifo") Uint16 src[4096]; /*函数声明*/ /* Reference start of interrupt vector table */ /* This symbol is defined in file, vectors_IP.s55 */ extern void VECSTART(void); void INTconfig(void); void delay(void); interrupt void int1(void); /*锁相环的设置,CPU时钟为24*12/(1+1)=144MHz*/ PLL_Config myConfig = { 0, //IAI: the PLL locks using the same process that was underway //before the idle mode was entered 1, //IOB: If the PLL indicates a break in the phase lock, //it switches to its bypass mode and restarts the PLL phase-locking //sequence 24, //PLL multiply value; multiply 12 times 1 //Divide by 2 PLL divide value; it can be either PLL divide value //(when PLL is enabled), or Bypass-mode divide value //(PLL in bypass mode, if PLL multiply value is set to 1) }; DMA_Config myconfig = { DMA_DMACSDP_RMK( DMA_DMACSDP_DSTBEN_NOBURST, DMA_DMACSDP_DSTPACK_OFF, DMA_DMACSDP_DST_DARAM, DMA_DMACSDP_SRCBEN_NOBURST, DMA_DMACSDP_SRCPACK_OFF, DMA_DMACSDP_SRC_EMIF, DMA_DMACSDP_DATATYPE_16BIT ), /* DMACSDP */ DMA_DMACCR_RMK( DMA_DMACCR_DSTAMODE_POSTINC, DMA_DMACCR_SRCAMODE_CONST, DMA_DMACCR_ENDPROG_ON, DMA_DMACCR_REPEAT_OFF, DMA_DMACCR_AUTOINIT_OFF, DMA_DMACCR_EN_START, DMA_DMACCR_PRIO_HI, DMA_DMACCR_FS_FRAME, DMA_DMACCR_SYNC_REVT1 ), /* DMACCR */ DMA_DMACICR_RMK( DMA_DMACICR_BLOCKIE_OFF, DMA_DMACICR_LASTIE_OFF, DMA_DMACICR_FRAMEIE_ON, /*此位如何设置有待商榷,是不是此位一开,一旦一帧传输完成,就将FRAME置1,向CPU发中断,进入一次半满信号触发的一帧数据处理过程*/ DMA_DMACICR_FIRSTHALFIE_OFF, DMA_DMACICR_DROPIE_OFF, DMA_DMACICR_TIMEOUTIE_OFF ), /* DMACICR */ (DMA_AdrPtr)&src, /* DMACSSAL源地址低段 */ 0, /* DMACSSAU */ (DMA_AdrPtr)&databuffer, /* DMACDSAL目的地址低段 */ 0, /* DMACDSAU */ N, /* DMACEN 帧中单元数 */ 1, /* DMACFN 块中帧数 */ 0, /* DMACFI */ 0 /* DMACEI */ //DMA_DMAGCR_FREE_OFF }; DMA_Handle myhDma; EMIF_Config emiffig = { 0x0221, //EGCR : the MEMFREQ = 00,the clock for the memory is equal to cpu frequence // the WPE = 0 ,forbiden the writing posting when we debug the EMIF // the MEMCEN = 1,the memory clock is reflected on the CLKMEM pin // the NOHOLD = 1,HOLD requests are not recognized by the EMIF 0xFFFF, //EMI_RST: any write to this register resets the EMIF state machine 0x7FFF, //CE0_1: CE0 space control register 1 // 未定义,保留 0xFFFF, //CE0_2: CE0 space control register 2 0x00FF, //CE0_3: CE0 space control register 3 // TIMEOUT = 0xFF; 0x1215, //CE1_1: CE0 space control register 1 这个片选空间的读建立,读选通和读保持时间需要好好配置,此处参考了EMIF异步手册 // Asynchronous, 16Bit 0x0fff, //CE1_2: CE0 space control register 2 0x000F, //CE1_3: CE0 space control register 3 0x1FFF, //CE2_1: CE0 space control register 1 // Asynchronous, 16Bit 0xFFFF, //CE2_2: CE0 space control register 2 0x00FF, //CE2_3: CE0 space control register 3 0x1FFF, //CE3_1: CE0 space control register 1 // Asynchronous, 16Bit 0xFFFF, //CE3_2: CE0 space control register 2 0x00FF, //CE3_3: CE0 space control register 3 0x2911, //SDC1: SDRAM control register 1 // TRC = 8 // SDSIZE = 0;SDWID = 0 // RFEN = 1 // TRCD = 2 // TRP = 2 0x0410, //SDPER : SDRAM period register // 7ns *4096 0x07FF, //SDINIT: SDRAM initialization register // any write to this register to init the all CE spaces, // do it after hardware reset or power up the C55x device 0x0131 //SDC2: SDRAM control register 2 // SDACC = 0; // TMRD = 01; // TRAS = 0101; // TACTV2ACTV = 0001; }; void main() { /*初始化CSL库*/ CSL_init(); /*EMIF为全EMIF接口*/ CHIP_RSET(XBSR,0x0a01); /*设置系统的运行速度为144MHz*/ PLL_config(&myConfig); /*配置CE1空间为异步存储器(FIFO)*/ EMIF_config(&emiffig); /*设置并使能5509A芯片的INT0中断(EXINT中断)*/ INTconfig(); /* myhDma=DMA_open(DMA_CHA1, DMA_OPEN_RESET); DMA_config(myhDma,&myconfig); */ /*通过GPIO 6 引脚来初始化 FIFO(拉低一次),使其读指针和写指针都指向fifo首地址*/ _PGPIO_pinEnable(GPIO_PIN6); _PGPIO_pinDirection(GPIO_PIN6,1); _PGPIO_pinWrite(GPIO_PIN6,1); delay(); _PGPIO_pinWrite(GPIO_PIN6,0); delay(); _PGPIO_pinWrite(GPIO_PIN6,1); delay(); while(1); } /*函数原型声明*/ void INTconfig(void) { /* Temporarily disable all maskable interrupts */ IRQ_setVecs((Uint32)(&VECSTART)); /* Temporarily disable all maskable interrupts */ old_intm = IRQ_globalDisable(); /* Get Event Id associated with External INT1(8019), for use with */ eventId0 = IRQ_EVT_INT1; /* Clear any pending INT1 interrupts */ IRQ_clear(eventId0); /* Place interrupt service routine address at */ /* associated vector location */ IRQ_plug(eventId0,&int1); /* Enable INT1(8019) interrupt */ IRQ_enable(eventId0); /* Enable all maskable interrupts */ IRQ_globalEnable(); } //External INT0(EXINT)中断处理函数 interrupt void int1() { //printf("EXINT ouccersn"); // temp=(int *)0x0c230; /* Open DMA Channel 1 setting registers to their power on defualts */ myhDma = DMA_open(DMA_CHA1, DMA_OPEN_RESET); /* By default, the TMS320C55xx compiler assigns all data symbols word */ /* addresses. The DMA however, expects all addresses to be byte */ /* addresses. Therefore, we must shift the address by 2 in order to */ /* change the word address to a byte address for the DMA transfer. */ //myconfig.dmacssal = (DMA_AdrPtr)(((Uint32)(myconfig.dmacssal)<<1)&0xFFFF); //myconfig.dmacdsal = (DMA_AdrPtr)(((Uint32)(myconfig.dmacdsal)<<1)&0xFFFF); srcAddrHi = (Uint16)(((Uint32)(&src)) >> 15) & 0xFFFFu; //如果调试不成功,可以尝试把0xFFFFu改为0x00FF试一下 srcAddrLo = (Uint16)(((Uint32)(&src)) << 1) & 0xFFFFu; //如果调试不成功,可以尝试把0xFFFFu改为0x00FF试一下 databufferAddrHi = (Uint16)(((Uint32)(&databuffer)) >> 15) & 0xFFFFu; databufferAddrLo = (Uint16)(((Uint32)(&databuffer)) << 1) & 0xFFFFu;// 这一部分需要修改,FIFO为8位,16位 需要 myconfig.dmacssal = (DMA_AdrPtr)srcAddrLo; myconfig.dmacssau = srcAddrHi; myconfig.dmacdsal = (DMA_AdrPtr)databufferAddrLo; myconfig.dmacdsau = databufferAddrHi; /* Write configuration structure values to DMA control registers */ DMA_config(myhDma, &myconfig); /*开始一帧数据的传输*/ //DMA_FSETH(myhDma,DMACCR,EN,1); DMA_start(myhDma); /* souraddr=(int*)0x0200000; for(j=0;j<4096;j++) { databuffer[j]=*souraddr&0x00FF; souraddr++; } */ /*等待一帧传输完毕*/ while (!DMA_FGETH(myhDma,DMACSR,FRAME))//FRAME是只读帧传输结束标志位 { printf("transmitting.....n"); } //for(i=0;i<4096;i++) //databuffer[i]= src[i]; /*souraddr = (int *)0x0200000; datacount = 0; for(i=0;i<4096;i++) databuffer[i]= *souraddr&0x00FF;*/ /*一帧传输完毕后,对这一帧数据进行处理,此处的数据处理,是数据赋值,或理解为从DARAM到DARAM的数据搬移*/ for(i=0;i<4096;i++) dst[i]=databuffer[i]; //if(databuffer[i]>80) //{cl[j]=databuffer[i]; //j++;} delay(); DMA_close(myhDma); } void delay() { Uint32 j = 0,k = 0; for(j = 0;j<0x10;j++) { for(k= 0;k<0xff;k++) {} } } /************************************************************************************ * 每两次HF低电平之间,发生了两个过程,一个是一帧的读过程,另一个是对这一帧数据的处理过程 * ************************************************************************************/ |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
593 浏览 0 评论
基于 DSP5509 进行数字图像处理中 Sobel 算子边缘检测的硬件连接电路图
3410 浏览 0 评论
814 浏览 0 评论
普中科技F28335开发板中,如何使用aic23播放由代码生成的正弦波
3830 浏览 0 评论
4588 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-29 08:58 , Processed in 0.727583 second(s), Total 74, Slave 58 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号