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.

TMS320F28075: math calculation sometimes is wrong when there have interrupt

Part Number: TMS320F28075

Hi Expert,

My customer face an issue that below calculation is sometimes wrong. 

Itemp is local variable and should be always equal to 600000, but sometimes the value is wrong and become 0. 

i32Debug3 save the value when there is wrong,  i32Debug3[2],  i32Debug3[4],  i32Debug3[6] log the value when there is wrong.

There are also have some interrupt function in the code like PWM ISR and timer ISR. if disable the interrupt or add protection for that code, then everything is ok.

Customer use the latest compiler TI v22.6.0  and optimization level is off,  Any suggestion for this issue?

  • Hi Expert,

    The customer use global variable to do the test, also have the same issue. 

  • Hi Strong, I apologize for the delay in replying back. I am reaching out to the expert and will let you know soon. Thanks, Ashwini.

  • Strong,

    1..Can you please share the disassembly view for this code?

    2. Could you explain what you mean by the statement "...or add protection for that code"?

    3. Just for completeness sake, could you enable optimization and check if the issue still occurs?

    4. Also, the way you are logging the error values is a little confusing to me. I am not sure why you have i32Debug3[iChx+8]++. If i32Debug3 is a 32b buffer, and since lTemp is a 64b variable, I would think you should do something like this:

    if(..){

    i32Debug[iChx]=Itemp;

    iChx+=2;

    }

    Let me know if I missed something in my understanding.

    Thanks,

    Sira