TMS320F2800155-Q1: Wanted to know execution time

Part Number: TMS320F2800155-Q1


hi

i wanted to know that what should be the excution time for adc 

 adcStruct[AIP_IP1].adc_buffer = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);

i am calling this in ISR ..which is triggered by EPWM trigger..

I get the excution time of 2.98 micro second..but i feel its two high..

image.png

 

attaching the settings for the same

  • sys configuration setting 

  • Kindy reply asap..as i am trying to execute something

  • Hi Muntaha,

    Reading ADC results should not take 2.98uS.  That is a long time.  It should only take a few CPU cycles to read a register location.  Are there anything else being executed in the ISR that might be contributing to this?

    Regards,

    Joseph

  • hello..i tried in the example code as well. There also this much time its taking?..i removed all the things from ISR..

  • I checked in the adc example code triggering multiple soc_epwm 

  • Hi Muntaha,

    Let me get back to you on this.  I need to run the example and see if i reproduce what you are observing.  Please allow a day or two since I do not have a set up available currently.

    Regards,

    Joseph

  • Hi Muntaha,

    The example adc_ex10_multiple_soc_epwm has this ISR:

    __interrupt void adcA1ISR(void)
    {
        //
        // Store results
        //
        adcAResult0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
        adcAResult1 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER1);
        adcAResult2 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER2);
        adcCResult0 = ADC_readResult(ADCCRESULT_BASE, ADC_SOC_NUMBER0);
        adcCResult1 = ADC_readResult(ADCCRESULT_BASE, ADC_SOC_NUMBER1);
        adcCResult2 = ADC_readResult(ADCCRESULT_BASE, ADC_SOC_NUMBER2);
    
        //
        // Clear the interrupt flag
        //
        ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
    
        //
        // Check if overflow has occurred
        //
        if(true == ADC_getInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1))
        {
            ADC_clearInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1);
            ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
        }
    
        //
        // Acknowledge the interrupt
        //
        Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
    }

    When an interrupt is triggered, the ISR routine is moved in the stack so all the variables and function used in the ISR will also be copied to the stack.  For execution time, copying of the variables and functions would contribute to the cycle time.  Instead of reading all 6 conversion results, try only one.  This should reduce the execution time that you are observing.

    Regards,

    Joseph

  • I toggled the GPIO in this example code only the execution time is same only...

  • I had tried with one

  • i had tried with one adc conversion only..in the same example code

  • Hi Muntaha,

    Is the GPIO toggled right before the ADC_readResult() function and toggled immediately after it?  If there is only one GPIO toggle done in the ISR then the other SOCs from ADCA and ADCC will have to complete the conversion before the GPIO toggles again.  How you put the GPIO toggles in the code may explain what you are seeing.

    Thanks,

    Joseph

  • __interrupt void adcA1ISR(void)
    {
    //
    // Store results
    //

     GPIO_writePin(myGPIO28,1);
    adcAResult0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);

    //
    // Clear the interrupt flag
    //
    ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);

    //
    // Check if overflow has occurred
    //
    if(true == ADC_getInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1))
    {
    ADC_clearInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1);
    ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
    }

     GPIO_writePin(myGPIO28,0);

    //
    // Acknowledge the interrupt
    //
    Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
    }

  • Hi Muntaha,

    If you move GPIO_writePin(myGPIO28,0) right after reading the ADC results register, not right after clearing the interrupt, do you still see the GPIO duration to be around 2.98uS?  If checkiing and clearing the interrupt status is the one that takes most of the GPIO time, then there are currently ongoing conversions that generate the interrupt which is not part of the read result cycle.

    Try running only one SOC conversion on one ADC only o see if checking and clearing the interrupt reduces the overall cycle time.

    Regards,

    Joseph