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: eCAP timer is abnormal under -40℃ temperature

Part Number: TMS320F28377D


Hi experts,

During a low temperature test of -40°C, the Cap port of the control board was able to catch pulses normally, but the cap module timer was occasionally incorrect, resulting in incorrect calculation parameters. The problem does not occur at room temperature. This is not an isolated phenomenon, but all chips will have. When a failure occurs, the other modules and the system clock are correct.

They compared the input waveform to the calculation waveform with another IO output from the cap port and found the captured waveform to be correct and the calculation result incorrect. This is done by inverting the state of another IO in a cap interrupt, and the input and output waveforms are below(Yellow is the input waveform and green is the output waveform for the other IO port):

Yellow is the capture calculated waveform, normal is low, high is the fault state (calculated parameter over limit, limited amplitude), red is the output IO waveform, one toggle represents one cap interrupt and also calculate once:

Please help on this issue, thanks a lot!

  • Angela,

    Subject matter expert is looking into this and will get back to you tomorrow.

  • Hi Angela,

    A few questions:

    1. I have annotated your scope shot. I am not quite sure what the red signal is. Can you provide a scope shot of the input signal overlaid with the "yellow" flag signal?

    2. What is the time scale of this scope shot?

    3. Can you provide the ECAP configuration code and also the interrupt code that processes it?

    4. You mentioned you see this issue on multiple devices but Is the issue seen on just one ECAP or all ECAPs?

  • Hi Frank,

    They toggle the I/O in the ecap interrupt. The I/O port toggles once when entering the ecap interrupt .So the red signal is the I/O output waveform. The period of the red signal is 10ms. As they only use this ecap module, not sure other ecap module is ok or not. I attach the codes below:

    /***********************************************************************
    * Function Name :ECAPRegsInit
    * Arguments     :
    * Returns       :
    * Description   :  Configure ECap Register
    * Updated ID    :
    ***********************************************************************/
    void ECAPRegsInit(void)
    {
        EALLOW;
        CpuSysRegs.PCLKCR3.bit.ECAP1 = 1;  //Open EMIF1 clock
        EDIS;
    
        EALLOW;
        ECap1Regs.ECCTL1.bit.CAP1POL=0;   //rising edge cap1
        ECap1Regs.ECCTL1.bit.CTRRST1=1;   // reset ctr
    
        ECap1Regs.ECCTL1.bit.CAPLDEN=1; //enable load on cap;
        ECap1Regs.ECCTL1.bit.PRESCALE=0; //no prescale
    
    
        ECap1Regs.ECCTL2.bit.CAP_APWM=0; //cap mode
        ECap1Regs.ECCTL2.bit.CONT_ONESHT=0;//continous mode
        ECap1Regs.ECCTL2.bit.STOP_WRAP=0;// wrap after cap1
        ECap1Regs.ECCTL2.bit.SYNCI_EN=0;
        ECap1Regs.ECCTL2.bit.SYNCO_SEL=2;
    
        ECap1Regs.ECCLR.all=0xff;
        ECap1Regs.ECCTL2.bit.TSCTRSTOP=1;//ctr runing
        EDIS;
    
    }
    
    /***********************************************************************
    * Function Name�� FreqCap
    * Arguments     :
    * Returns       :
    * Description   :  Cap Frequency
    * Updated ID    :
    ***********************************************************************/
    
    void FreqCap(void)
    {
        unsigned long temp1=0;
        static Uint16 u16EcapRstDelayCnt = 0;
    
        if((ECap1Regs.ECFLG.bit.CEVT1) && (ZERO == u16EcapRstDelayCnt)) // New Ecap Occur
        {
            uwFreCapFlag = 1;
            u16EcapRstDelayCnt++;   // cnt++
            uwCapfreqms=0;
    
            ulGridInperOld=ulGridInperNew;       // load Ecap counter and calculate period
            ulGridInperNew = ECap1Regs.CAP1;
            ulGridInPeriod=ulGridInperNew+ulGridInperOld;
    
    
            if(ulGridInPeriod >=3076923 && ulGridInPeriod<=5000000) //the value is selected for robust to noise ,40Hz~70Hz
            {
                ubCaptureLostCnt=0;
    
                temp1=__divf32(200000000000,ulGridInPeriod);
    
                uwGrdCapFreq = (unsigned int)temp1;//+4;    //5000=50.00Hz   //0.01Hz
            }
            else if(ulGridInPeriod <3076923)//2857143)
            {
                uwGrdCapFreq=65000;
            }
            else
            {
              uwGrdCapFreq=40000;       
            }
            
        }
        else if((ECap1Regs.ECFLG.bit.CEVT1) && (ZERO != u16EcapRstDelayCnt)) // Software Dead band
        {
    
            u16EcapRstDelayCnt++;
    
            if(u16EcapRstDelayCnt >= 22)     //dead band time = (22-1)*Ts/2 = 3ms
            {
                if(ECap1Regs.ECCTL1.bit.CAP1POL)
                {
                    EALLOW;
                    ECap1Regs.ECCTL1.bit.CAP1POL = 0;   // If falling edge then rising edge next time
                    EDIS;
                }
                else
                {
                    EALLOW;
                    ECap1Regs.ECCTL1.bit.CAP1POL = 1;  // otherwise, falling edge next time
                    EDIS;
                }
    
                u16EcapRstDelayCnt = ZERO;      // reset Delay cnt;
    
                EALLOW;
                ECap1Regs.ECCLR.bit.CEVT1 = 1;  //clear CaptureEvent1 flag
                ECap1Regs.ECCTL2.bit.REARM = 1;  // Mod Counter is frozen after Cap1, unfreeze it
                EDIS;
    
            }
        }
        else
        {
            uwFreCapFlag = 0;
        }
    }

  • Hi Angela,

    Thanks for providing the code. A few questions below:

    1. What is generating the interrupt of the "red" output in scope? Looking at the code, it doesn't look like the ECAP. Please provide the scope capture of the input signal as the "red" toggle in this case has no bearing on the signal the ECAP actually sees.

    2. Reading through the code, i noticed they are flipping the ECAP capture polarity after every 22 captures on the fly. I believe there is a race condition here that is causing this issue since nothing that is going on is synchronized. If they need to make big state changes like switching the edge polarity that is being captured on the fly, the proper thing to do will be to stop the counter, reset the state machine and re-arm then start the counter again.