按照starterware中的例程配置一下dma作为事件触发模式,使用pingpong传输的方式接收ad采样数据,数据可以接收,但是发现了两个问题,本人初学,希望大家能答疑解惑,感激不尽
1,dma的单个buff最大只能接收54463个数据(bcnt最大只能54463),例如设置bcnt为60000,54464之后的数值都为0,不理解是什么原因造成的
2,虽然是设置的A同步传输方式,但是只能传输一帧的数据,也就是说例如ccnt=10的时候,dma的buff也只有一帧的数据,之后的为0,应该是配置有问题,参数ram配置如下
paramSet4.opt = 0x00104000u;
paramSet4.srcAddr = (unsigned int)0x01D11000;
paramSet4.destAddr = (unsigned int)(dstBuff0);
paramSet4.aCnt = (unsigned short)acnt;
paramSet4.bCnt = (unsigned short)bcnt;
paramSet4.cCnt = (unsigned short)ccnt;
paramSet4.srcBIdx = 0;
paramSet4.destBIdx = (short)acnt;
paramSet4.srcCIdx = 0;
paramSet4.destCIdx = (short)acnt;
paramSet4.linkAddr = (unsigned short)0x4FE0u;
paramSet4.bCntReload = (unsigned short)0u;
EDMA3SetPaRAM(SOC_EDMA30CC_0_REGS, chNum, ¶mSet4);
//Parameter 126 opt设置为传输结束代码为4,使能传输完成中断
*(unsigned int *)0x01C04FC0 =0x00104000u;//OPT
*(unsigned int *)0x01C04FC4 = (unsigned int)0x01D11000; //SRC
*(unsigned int *)0x01C04FC8 = (unsigned short)bcnt<<16|(unsigned short)acnt;//B|A_CNT
*(unsigned int *)0x01C04FCC = (unsigned int)dstBuff0; //DST
*(unsigned int *)0x01C04FD0 = (short)acnt<<16|0; //DST|SRC_ BIDX
*(unsigned int *)0x01C04FD4 = 0<<16|0x4FE0; //BCNTRELOAD|LINK
*(unsigned int *)0x01C04FD8 = (short)acnt<<16|0; //DST|SRC_CIDX
*(unsigned int *)0x01C04FDC = (unsigned short)ccnt; //CCNT
//Parameter 127 opt设置为传输结束代码为4,使能传输完成中断
*(unsigned int *)0x01C04FE0 =0x00104000u;//OPT
*(unsigned int *)0x01C04FE4 = (unsigned int)0x01D11000;//SRC
*(unsigned int *)0x01C04FE8 = (unsigned short)bcnt<<16|(unsigned short)acnt;//B|A_CNT
*(unsigned int *)0x01C04FEC = (unsigned int)dstBuff1; //DST
*(unsigned int *)0x01C04FF0 = (short)acnt<<16|0; //DST|SRC_ BIDX
*(unsigned int *)0x01C04FF4 = 0<<16|0x4FC0; //BCNTRELOAD|LINK
*(unsigned int *)0x01C04FF8 = (short)acnt<<16|0; //DST|SRC_CIDX
*(unsigned int *)0x01C04FFC = (unsigned short)ccnt; //CCNT
Tony Tang:
我觉得参数表配置有点问题,dest的bindex, cindex, bcntReload都不对。参考TRM手册的18.2.2.1节说明。