最近在调试DSP-28377s,但是ADC有两路不对。试了50个DSP板子,有20是好的,30个是采样值有问题的。如下图所示:
1、有问题的
2、没问题的
ADC都是16位差分模式,红色的是.ADC–A0-A1通道,白色的是A2 -A3通道,绿色的是A4 – A5通道。
感觉采样值保持时间过长,A0-A1通道的值没问题,平滑曲线,但是A2 -A3,A4 – A5通道就有问题。
下边是我的配置:
void ADC_capture() { AdcaRegs.ADCSOCFRC1.all = 0x007F; //SOC0 and SOC1 while(AdcaRegs.ADCINTFLG.bit.ADCINT1 == 0); AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; AdcaResult0 = AdcaResultRegs.ADCRESULT0; ///1--3 AdcaResult2 = AdcaResultRegs.ADCRESULT2; AdcaResult4 = AdcaResultRegs.ADCRESULT4; } //Write ADC configurations and power up the ADC for both ADC A and ADC B void ConfigureADC(void) { EALLOW; //write configurations AdcaRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4 AdcSetMode(ADC_ADCA, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL); AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1; // AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1; AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1; EDIS; } void SetupADCSoftware(void) { Uint16 acqps; //determine minimum acquisition window (in SYSCLKS) based on resolution if( 0 && ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION){ acqps = 14; //75ns } else { //resolution is 16-bit acqps = 63; //63--320nS } //Select the channels to convert and end of conversion flag //------------------ADCA------------------------------------------------------- EALLOW; AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0; //SOC0 will convert pin A0 AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample win AdcaRegs.ADCSOC1CTL.bit.CHSEL = 1; //SOC1 will convert pin A1 AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps + 1 SYSCLK cycles // AdcbRegs.ADCSOC1CTL.bit.TRIGSEL = 1; AdcaRegs.ADCSOC2CTL.bit.CHSEL = 2; //SOC1 will convert pin A1 AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps; //sample window is acqps + 1 SYSCLK cycles //AdcbRegs.ADCSOC2CTL.bit.TRIGSEL = 1; AdcaRegs.ADCSOC3CTL.bit.CHSEL = 3; //SOC1 will convert pin A1 AdcaRegs.ADCSOC3CTL.bit.ACQPS = acqps; //sample window is acqps + 1 SYSCLK cycles AdcaRegs.ADCSOC4CTL.bit.CHSEL = 4; //SOC1 will convert pin A1 AdcaRegs.ADCSOC4CTL.bit.ACQPS = acqps; //sample window is acqps + 1 SYSCLK cycles //AdcbRegs.ADCSOC4CTL.bit.TRIGSEL = 1; AdcaRegs.ADCSOC5CTL.bit.CHSEL = 5; //SOC1 will convert pin A1 AdcaRegs.ADCSOC5CTL.bit.ACQPS = acqps; //sample window is acqps + 1 SYSCLK cycles AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 5; //end of SOC1 will set INT1 flag AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; //enable INT1 flag AdcaRegs.ADCINTFLGCLR.bit.ADCINT1= 1; //make sure INT1 flag is cleared }
请问是哪里的问题,有没有人遇到和我一样的问题,谢谢!!
mangui zhang:从图看感觉是采样率低的原因。看看有问题板子的时钟 应该是跑的比较低