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.

TMS320F28377D ADC measurement time

Guru 16800 points

Hello,

Please let me know how I can obtain the ADC result under per 1us.
ADC clock is 33.2MHz and the acquisition window is 75ns.
I want to get the result under per 1us, however I can't.

I use the following setting and code.

ADC = ADC D
CPU clock = 199.2 MHz

- ADC settings
void ConfigureADC(void)
{
    EALLOW;

    // Using DAC ,configure ADCA - C

    //write configurations
    AdccRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
    AdcdRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4

    AdcSetMode(ADC_ADCC, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);
    AdcSetMode(ADC_ADCD, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);

    //Set pulse positions to late
    AdccRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdcdRegs.ADCCTL1.bit.INTPULSEPOS = 1;

    //power up the ADCs
    AdccRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdcdRegs.ADCCTL1.bit.ADCPWDNZ = 1;

    //delay for 1ms to allow ADC time to power up
    DELAY_US(1000);

    EDIS;
}

void SetupADCSoftware(void)
{
    Uint16 acqps;

    //determine minimum acquisition window (in SYSCLKS) based on resolution
    if ( ADC_RESOLUTION_12BIT == AdcdRegs.ADCCTL2.bit.RESOLUTION )
    {
        acqps = 14;     //75ns
    }
    else
    { //resolution is 16-bit
        acqps = 63;     //320ns
    }
    EALLOW;
    //Select the channels to convert and end of conversion flag
    //---------------------------------------------------------------------
    //  ADC C
    //---------------------------------------------------------------------
    //  signal              pin
    //----------------------------------
    //  TP10/TP2            ADCINC2
    //  TP10/TP3            ADCINC3
    //  TP10/TP4            ADCINC4


    AdccRegs.ADCSOC0CTL.bit.CHSEL = 2;              //SOC0 will convert pin C2
    AdccRegs.ADCSOC0CTL.bit.ACQPS = acqps;          //sample window is acqps + 1 SYSCLK cycles
    AdccRegs.ADCSOC1CTL.bit.CHSEL = 3;              //SOC1 will convert pin C3
    AdccRegs.ADCSOC1CTL.bit.ACQPS = acqps;          //sample window is acqps + 1 SYSCLK cycles
    AdccRegs.ADCSOC2CTL.bit.CHSEL = 4;              //SOC2 will convert pin C4
    AdccRegs.ADCSOC2CTL.bit.ACQPS = acqps;          //sample window is acqps + 1 SYSCLK cycles

    AdccRegs.ADCINTSEL1N2.bit.INT1SEL = 2;          //end of SOC2 will set INT1 flag
    AdccRegs.ADCINTSEL1N2.bit.INT1E = 1;            //enable INT1 flag
    AdccRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;          //make sure INT1 flag is cleared
    //---------------------------------------------------------------------
    //  ADC D
    //---------------------------------------------------------------------
    //  signal              pin
    //----------------------------------
    //  ADC_THERM_1         ADCIND0
    //  ADC_THERM_2         ADCIND1
    //  ADC_THERM_3         ADCIND2
    //  ADC_THERM_4         ADCIND3
    //  ADC_CURRENT_MEG     ADCIND4

    // ADC_THERM_1 - 4
    AdcdRegs.ADCSOC0CTL.bit.CHSEL = 0;  //SOC0 will convert pin D0
    AdcdRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps + 1 SYSCLK cycles
    AdcdRegs.ADCSOC1CTL.bit.CHSEL = 1;  //SOC1 will convert pin D1
    AdcdRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps + 1 SYSCLK cycles
    AdcdRegs.ADCSOC2CTL.bit.CHSEL = 2;  //SOC2 will convert pin D2
    AdcdRegs.ADCSOC2CTL.bit.ACQPS = acqps; //sample window is acqps + 1 SYSCLK cycles
    AdcdRegs.ADCSOC3CTL.bit.CHSEL = 3;  //SOC3 will convert pin D3
    AdcdRegs.ADCSOC3CTL.bit.ACQPS = acqps; //sample window is acqps + 1 SYSCLK cycles
    // ADC_CURRENT_MEG
    AdcdRegs.ADCSOC4CTL.bit.CHSEL = 4;  //SOC4 will convert pin D4
    AdcdRegs.ADCSOC4CTL.bit.ACQPS = acqps; //sample window is acqps + 1 SYSCLK cycles

    AdcdRegs.ADCINTSEL1N2.bit.INT1SEL = 3; //end of SOC3 will set INT1 flag
    AdcdRegs.ADCINTSEL1N2.bit.INT1E = 1;   //enable INT1 flag
    AdcdRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //make sure INT1 flag is cleared

    AdcdRegs.ADCINTSEL1N2.bit.INT2SEL = 4; //end of SOC4 will set INT2 flag
    AdcdRegs.ADCINTSEL1N2.bit.INT2E = 1;   //enable INT2 flag
    AdcdRegs.ADCINTFLGCLR.bit.ADCINT2 = 1; //make sure INT2 flag is cleared
}

- ADC measurement
    while (1)
    {
        //convert, wait for completion, and store results
        //start conversions immediately via software, ADCD
        AdcdRegs.ADCSOCFRC1.all = 0x0010; // SOC4

        //wait for ADCD to complete, then acknowledge flag
        while (AdcdRegs.ADCINTFLG.bit.ADCINT2 == 0);
        AdcdRegs.ADCINTFLGCLR.bit.ADCINT2 = 1;

        //store results
        AdcdResult4 = AdcdResultRegs.ADCRESULT4;

        strcat(mesRetBuff, "RESULT:");
        ltoa(AdcdResult4, temp);
        sprintf(temp, "%5d", AdcdResult4);
        strcat(mesRetBuff, temp);
        strcat(mesRetBuff, "\n");

        while (USBBufferSpaceAvailable(&g_sTxBuffer) < strlen(mesRetBuff));

        USBBufferWrite((tUSBBuffer *) &g_sTxBuffer, (uint8_t *) &mesRetBuff,
                strlen(mesRetBuff));

        // clear mesRetBuff
        memset(mesRetBuff, '\0', strlen(mesRetBuff));
        memset(temp, '\0', strlen(temp));

        if ( g_MesCurBreak )
        {
            g_MesCurBreak = 0;
            break;
        }
    }

Best Regards,

Nomoto

  • Hi Nomoto-san,

    How are you measuring the conversion time?

    You can determine exactly how long the set of conversions should take from "Table 6-23: ADC Timings in 12-bit Mode (SYSCLK cycles)" in the datasheet.

    For your example:

    ADCCLK = SYSCLK / 6.

    ADCC: 3 conversions all with S+H = 15 SYSCLK cycles.

    Trigger and set SOC flag = 2 cycles
    Teoc * 2 = 61 * 3 = 183 cycles
    Tlat * 1 = 64 cycles

    Total time from trigger to 3rd sample being latched = 2 + 183 + 64 cycles = 249 cycles. Since SYCLK = 199.2MHz, this = (1/199.2MHz)*249 = 1.25us

    (you can carry out a similar calculation for ADCD)
  • Correction:

    Trigger and set SOC flag = 2 cycles
    Teoc * 2 = 61 * 2 = 122 cycles
    Tlat * 1 = 64 cycles

    Total time from trigger to 3rd sample being latched = 2 + 122 + 64 cycles = 188 cycles. Since SYCLK = 199.2MHz, this = (1/199.2MHz)*188 = 0.944us
  • Hello,

    Thank you for your reply.

    I can understand

    Best Regards,

    Nomoto