This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28377S: 高速采样DMA搬运问题

Part Number: TMS320F28377S

目前项目使用28377s,需要采样10kHz的正弦波形,现在程序配置ADC为连续采样,DMA通过EPWM进行触发,EPWM频率为1M,程序配置如下

EPWM部分:

EPwm5Regs.TBPRD = 100;//p->PERIOD;
EPwm5Regs.TBPHS.bit.TBPHS = 0;
EPwm5Regs.TBCTR = 0x0000;

EPwm5Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;
EPwm5Regs.TBCTL.bit.PHSEN = TB_DISABLE;
EPwm5Regs.TBCTL.bit.PRDLD = TB_SHADOW;
EPwm5Regs.TBCTL.bit.SYNCOSEL =TB_SYNC_IN;
EPwm5Regs.TBCTL.bit.CLKDIV = 0;
EPwm5Regs.TBCTL.bit.HSPCLKDIV = 0;
EPwm5Regs.TBCTL.bit.FREE_SOFT = 0;
EPwm5Regs.TBCTL.bit.PHSDIR = 0;

EPwm5Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm5Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm5Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO_PRD;
EPwm5Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO_PRD;
EPwm5Regs.AQCTLA.bit.CAU = AQ_CLEAR;
EPwm5Regs.AQCTLA.bit.CAD = AQ_SET;
EPwm5Regs.AQCTLB.bit.CBU = AQ_SET;
EPwm5Regs.AQCTLB.bit.CBD = AQ_CLEAR;

EPwm5Regs.DBCTL.bit.OUT_MODE = DB_DISABLE;
EPwm5Regs.AQSFRC.bit.RLDCSF =0x3;
EPwm5Regs.AQSFRC.bit.ACTSFA=0x1;
EPwm5Regs.AQSFRC.bit.ACTSFB=0x1;

EPwm5Regs.AQCSFRC.bit.CSFA = 0;
EPwm5Regs.AQCSFRC.bit.CSFB = 0;


EPwm5Regs.ETSEL.bit.SOCASEL = 1;//周期中断2 下溢1
EPwm5Regs.ETSEL.bit.SOCAEN = 1;
EPwm5Regs.ETPS.bit.SOCAPRD = 1;
EPwm5Regs.ETCLR.bit.SOCA = 1;
EPwm5Regs.CMPA.bit.CMPA = 50;

AD采样部分:

AdcaRegs.ADCCTL2.all = 0; // Single-ended,12bit resolution, not divider
AdcaRegs.ADCCTL2.bit.PRESCALE = 2;//系统时钟2分频//0x6; // 系统时钟4分频--50M //待定
AdcSetMode(ADC_ADCA, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);
// AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;
AdcaRegs.ADCINTFLGCLR.all = 0xFFFF; // 清所有的中断标志位
AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // 禁止连续模式,禁止中断
AdcaRegs.ADCINTSEL1N2.bit.INT1CONT =1;
AdcaRegs.ADCINTSEL1N2.bit.INT1SEL =7;
AdcaRegs.ADCINTSOCSEL1.bit.SOC7 = 1;

AdcaRegs.ADCSOC7CTL.bit.CHSEL    = 15;      //ADCIN15

AdcaRegs.ADCSOC7CTL.bit.TRIGSEL  = 0x0;    // 软件触发模式

 AdcaRegs.ADCSOC7CTL.bit.ACQPS    = 14;

DMA部分:

DMAInitialize();
DMADest = (volatile Uint16 *)rdata;
DMADest2 = (volatile Uint16 *)rdata2;
DMADest3 = (volatile Uint16 *)rdata3;
DMADest4 = (volatile Uint16 *)rdata4;
//
// configure DMA CH1
//
DMACH1AddrConfig(DMADest, (uint16_t *)ADCARESULT_BASE+7);
DMACH1BurstConfig(1,0,1);
DMACH1TransferConfig(1000,0,1);
// DMACH1WrapConfig(0,0,0,1);
DMACH1ModeConfig(DMA_EPWM5A,PERINT_ENABLE,ONESHOT_DISABLE,CONT_DISABLE,SYNC_DISABLE,SYNC_SRC,OVRFLOW_DISABLE,SIXTEEN_BIT,CHINT_END,CHINT_ENABLE);

目前DMA搬运完触发中断后,在DMA中断中停止DMA搬运并处理搬运数组,处理完后打开DMA搬运,经过测试,采样5kHz波形时勉强够用,搬运出的数组幅值基本无衰减,波形存在少量锯齿,如下图所示

存在锯齿是因为搬运数组中有相邻出现重复的数,当尝试采样10kHz波形时,波形幅值等比出现衰减,且波形锯齿变宽(因为相邻重复的数更多了),导致搬运出的数组不符合算法使用要求,波形如下

datasheet中理论单通道28377的采样速率能到3M,为什么1M的采样率采样10kHz波形出来幅值会有衰减,并且相邻会有很多重复的数?导致波形线性度不好。

请问这个问题应该如何解决?万分感谢!