TI中文支持网
TI专业的中文技术问题搜集分享网站

C6748利用EDMA3 ping-pong的方式来连续采集电压信号时,会在ping(pong)数组的起始处的明显地缺失了一个采样点的数据。

上面两幅图片就是ping(pong)数组内的部分数据波形。

我程序是将8通道ADS的数据全部采集到一个数组中,再在回调函数内将8通道的数据分别利用memcpy函数复制进ping(pong)数组中,通过稍作修改使ping(pong)数组可以连续存入数据,下面是我回调函数的程序,以及EDMA3的ParRam。

回调函数:

void callback(unsigned int tccNum, unsigned int status, void *appData)
{
(void)tccNum;
(void)appData;

if(EDMA3_XFER_COMPLETE == status)
{
// 传输成功
irqRaised = 1;

if(pingpong)
{
CacheInv ((unsigned int)rcv_buffer1, MAX_BUFFER_SIZE);
// rcv_buffer1 完成接收
memcpy(channel1_1[ch1_num++], &rcv_buffer1[MAX_ACOUNT * MAX_CCOUNT * 0], MAX_ACOUNT * MAX_CCOUNT);
/*memcpy(channel1_2, &rcv_buffer1[MAX_ACOUNT * MAX_CCOUNT * 1], MAX_ACOUNT * MAX_CCOUNT);
memcpy(channel1_3, &rcv_buffer1[MAX_ACOUNT * MAX_CCOUNT * 2], MAX_ACOUNT * MAX_CCOUNT);
memcpy(channel1_4, &rcv_buffer1[MAX_ACOUNT * MAX_CCOUNT * 3], MAX_ACOUNT * MAX_CCOUNT);
memcpy(channel1_5, &rcv_buffer1[MAX_ACOUNT * MAX_CCOUNT * 4], MAX_ACOUNT * MAX_CCOUNT);
memcpy(channel1_6, &rcv_buffer1[MAX_ACOUNT * MAX_CCOUNT * 5], MAX_ACOUNT * MAX_CCOUNT);
memcpy(channel1_7, &rcv_buffer1[MAX_ACOUNT * MAX_CCOUNT * 6], MAX_ACOUNT * MAX_CCOUNT);*/
//memcpy(channel1_8, &rcv_buffer1[MAX_ACOUNT * MAX_CCOUNT * 7], MAX_ACOUNT * MAX_CCOUNT);
//W_BREAKPOINT;
ping_complete = 1;
}
else
{
CacheInv ((unsigned int)rcv_buffer2, MAX_BUFFER_SIZE);
// rcv_buffer2 完成接收
memcpy(channel2_1[ch2_num++], &rcv_buffer2[MAX_ACOUNT * MAX_CCOUNT * 0], MAX_ACOUNT * MAX_CCOUNT);
/*memcpy(channel2_2, &rcv_buffer2[MAX_ACOUNT * MAX_CCOUNT * 1], MAX_ACOUNT * MAX_CCOUNT);
memcpy(channel2_3, &rcv_buffer2[MAX_ACOUNT * MAX_CCOUNT * 2], MAX_ACOUNT * MAX_CCOUNT);
memcpy(channel2_4, &rcv_buffer2[MAX_ACOUNT * MAX_CCOUNT * 3], MAX_ACOUNT * MAX_CCOUNT);
memcpy(channel2_5, &rcv_buffer2[MAX_ACOUNT * MAX_CCOUNT * 4], MAX_ACOUNT * MAX_CCOUNT);
memcpy(channel2_6, &rcv_buffer2[MAX_ACOUNT * MAX_CCOUNT * 5], MAX_ACOUNT * MAX_CCOUNT);
memcpy(channel2_7, &rcv_buffer2[MAX_ACOUNT * MAX_CCOUNT * 6], MAX_ACOUNT * MAX_CCOUNT);
memcpy(channel2_8, &rcv_buffer2[MAX_ACOUNT * MAX_CCOUNT * 7], MAX_ACOUNT * MAX_CCOUNT);*/
//SW_BREAKPOINT;
pong_complete = 1;
}
pingpong = !pingpong;
}

else if(EDMA3_CC_DMA_EVT_MISS == status)
{
// 传输导致 DMA 事件丢失错误
irqRaised = -1;
}

else if(EDMA3_CC_QDMA_EVT_MISS == status)
{
// 传输导致 QDMA 事件丢失错误
irqRaised = -2;
}

irqRaised = 1;
}

ParRam:

static struct EDMA3CCPaRAMEntry dmaPar[3] = {
{
(unsigned int)(1<<2 | 1<<20 | \
(EDMA3_CHA_GPIO_BNKINT5 << EDMA3CC_OPT_TCC_SHIFT)),// Opt
(unsigned int)SOC_EMIFA_CS2_ADDR, // 源地址
(unsigned short)(MAX_ACOUNT), // aCnt
(unsigned short)(MAX_BCOUNT), // bCnt
(unsigned int) rcv_buffer1, // 目标地址
(short) (MAX_ACOUNT), // 源 bIdx
(short)(MAX_ACOUNT * MAX_CCOUNT), // 目标 bIdx
(unsigned short)(32u * 40u), // 链接地址
(unsigned short)(MAX_BCOUNT), // bCnt 重装值
(short)(MAX_ACOUNT * MAX_BCOUNT), // 源 cIdx
(short)(MAX_ACOUNT), // 目标 cIdx
(unsigned short)MAX_CCOUNT // cCnt
},
{
(unsigned int)(1<<2 | 1<<20 | \
(EDMA3_CHA_GPIO_BNKINT5 << EDMA3CC_OPT_TCC_SHIFT)),// Opt
(unsigned int)SOC_EMIFA_CS2_ADDR, // 源地址
(unsigned short)(MAX_ACOUNT), // aCnt
(unsigned short)(MAX_BCOUNT), // bCnt
(unsigned int) rcv_buffer2, // 目标地址
(short) (MAX_ACOUNT), // 源 bIdx
(short)(MAX_ACOUNT * MAX_CCOUNT), // 目标 bIdx
(unsigned short)(32u * 41u), // 链接地址
(unsigned short)(MAX_BCOUNT), // bCnt 重装值
(short)(MAX_ACOUNT * MAX_BCOUNT), // 源 cIdx
(short)(MAX_ACOUNT), // 目标 cIdx
(unsigned short)MAX_CCOUNT // cCnt
},
{
(unsigned int)(1<<2 | 1<<20 | \
(EDMA3_CHA_GPIO_BNKINT5 << EDMA3CC_OPT_TCC_SHIFT)),// Opt
(unsigned int)SOC_EMIFA_CS2_ADDR, // 源地址
(unsigned short)(MAX_ACOUNT), // aCnt
(unsigned short)(MAX_BCOUNT), // bCnt
(unsigned int) rcv_buffer1, // 目标地址
(short) (MAX_ACOUNT), // 源 bIdx
(short)(MAX_ACOUNT * MAX_CCOUNT), // 目标 bIdx
(unsigned short)(32u * 40u), // 链接地址
(unsigned short)(MAX_BCOUNT), // bCnt 重装值
(short)(MAX_ACOUNT * MAX_BCOUNT), // 源 cIdx
(short)(MAX_ACOUNT), // 目标 cIdx
(unsigned short)MAX_CCOUNT // cCnt
}
};

(PS:通过检查发现数据在传递进Dst地址后的数据就已经有上面的波形出现了。)

学校这边需要连续采样计算FFT,但是现在出现这样采样点缺失,实在是不知道解决办法了,特地回娘家问问TI的各位技术员这种问题产生的原因以及解决方法。

感激不尽。

Tony Tang:

请问你用的是QDMA,还是EDMA?是哪颗ADC?触发信号用的是什么?

user5301370:

回复 Tony Tang:

你好,我用的EDMA,cpu为C6748。
采集的信号是来自信号发生器,信号400Hz,采样频率409.6KHz。

赞(0)
未经允许不得转载:TI中文支持网 » C6748利用EDMA3 ping-pong的方式来连续采集电压信号时,会在ping(pong)数组的起始处的明显地缺失了一个采样点的数据。
分享到: 更多 (0)