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.

TMS320F28P550SJ: The ADC sampling result is only half of the actual result.

Part Number: TMS320F28P550SJ

Tool/software:

Dear all,

       When I debug the TMS320F28P55  ADC sampling, an external 3.2V reference voltage is used. Call the library function ADC_setVREF(ADCA_BASE, ADC_REFERENCE_EXTERNAL, ADC_REFERENCE_3_3V), find that all the obtained samples are halved, for example, when the analog port measured 1.6V, and  AD sampling should be 2048, However, the actual read  AD sample is only 1024.

     Is there any other configure to do ?

    

    EALLOW;
    ADC_setOffsetTrim(ADCA_BASE);
    ADC_setOffsetTrim(ADCB_BASE);
    ADC_setOffsetTrim(ADCC_BASE);
    ADC_setOffsetTrim(ADCD_BASE);
    ADC_setOffsetTrim(ADCE_BASE);
    EDIS;

    EALLOW;
    ADC_setVREF(ADCA_BASE, ADC_REFERENCE_EXTERNAL, ADC_REFERENCE_3_3V);
    ADC_setVREF(ADCB_BASE, ADC_REFERENCE_EXTERNAL, ADC_REFERENCE_3_3V);
    ADC_setVREF(ADCC_BASE, ADC_REFERENCE_EXTERNAL, ADC_REFERENCE_3_3V);
    ADC_setVREF(ADCD_BASE, ADC_REFERENCE_EXTERNAL, ADC_REFERENCE_3_3V);
    ADC_setVREF(ADCE_BASE, ADC_REFERENCE_EXTERNAL, ADC_REFERENCE_3_3V);
    EDIS;

    EALLOW;
    //
    // Set ADCCLK divider to /4
    //
    AdcaRegs.ADCCTL2.bit.PRESCALE = 6;
    AdcbRegs.ADCCTL2.bit.PRESCALE = 6;
    AdccRegs.ADCCTL2.bit.PRESCALE = 6;
    AdcdRegs.ADCCTL2.bit.PRESCALE = 6;
    AdceRegs.ADCCTL2.bit.PRESCALE = 6;
    //
    // Set pulse positions to late
    //
    AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdccRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdcdRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdceRegs.ADCCTL1.bit.INTPULSEPOS = 1;

    //
    // Power up the ADC and then delay for 1 ms
    //
    AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdccRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdcdRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdceRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    EDIS;

    DELAY_US(ADC_usDELAY);         // Delay before converting ADC channels

    EALLOW;

  • Hello Jianjun,

    On this device, setting the 3_3V option always means the FSR = 2x the reference voltage (regardless of whether you choose internal or external reference). To get the correct voltage range, use:

    ADC_setVREF(ADCx_BASE, ADC_REFERENCE_EXTERNAL, ADC_REFERENCE_2_5V);

    Best regards,
    Ibukun