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.

TMS320F28374S: Floating point operation, compare error

Part Number: TMS320F28374S


Hi Team,

There's an issue from the customer need your help:

We are using the [buck_F28004x] project as the base to create a power control project. 

However, problems were found with float type operations and comparisons.

Because the base project has a lot of modifications, it is not easy to describe the parts we have changed. 

Want to ask a TI engineer, can you give a direction to the survey? 

The details of the float type operation error are shown below. 

Data is saved to an array with an ADC sample interrupt, which totals 8 elements, and after an event, 8 elements from the current array are summed (sumVout). Then moving average (buck_vOutSensored_Volts). 

Through the breakpoints we found that the sum of the eight elements had gone wrong, as shown in the figure below. 

Could you help check this case?

Thanks and Regards,

Ben

  • sumVout function as shown below:

    set breakpoint at line 1167, then run it at full speed multiple times, each time the program stops at the breakpoint, look at the sumTemp value, and see that sometimes the sumTemp is 354. Sometimes sumTemp is 175, and the value is different each time. 

    Buck_AVG_ADC_samples is a macro with a value of 8. It is not certain which loop is wrong. 

  • Hello Ben,

    Does the customer have any optimizations turned on for the project? Also, when the customer steps through the loop, what do they see with the individual additions (i.e. temp[0] + temp[1])? Is each and every addition wrong?

    Best regards,

    Omer Amir

  • Hi Omer,

    The customer has observed, it is not certain which individual additions is wrong.

    Add a testing condition:

    If I turn off the ISR in program, the sum operation will not have problem.

    Best Regards,

    Ben

  • Hello Ben,

    Can you confirm the optimization settings that the customer is using?

    If I turn off the ISR in program, the sum operation will not have problem.

    Is it possible for you to test whether the interrupt is happening during the summation loop? A simple way to test this is toggling a global variable before the loop starts and after it ends, and then checking the value within the ISR.

    Best regards,

    Omer Amir

  • Hi Omer,

    He turned off optimization. There are three ISR, two ADC ISR, one Timer ISR. Timer ISR not occurred, two ADC ISR occurred.

    ADC1 ISR

    ADC2 ISR

    Timer ISR

    breakpoint location

    The process is as follows:

    1.When the program stops at line 1167, look at the values of the global variables intr1, 2, and 3.

    2.Run at full speed, program stops at line 1171.

    3.Looking at the values of the global variables intr1, 2, and 3, the values of intr1, 2 have changed and the values of intr3 have not changed.

  • We see that the Errorsheet of the TMS320F28374S has a description of the FPU exception. 

    Now we wonder if we have too much interrupts and each interrupt trigger interval is shorter, so it causes a floating point operation to go wrong? 

  • Hello Ben,

    This erratum mainly refers to having an operation instruction and move instruction with a matching source/destination register, not necessarily caused by interrupts. If this is the case with the customer's code, they can add dummy instructions like NOPs to flush the pipelines (such as at the beginning of the ISR). If the customer's interrupts are using floating-point values, then it may be necessary to double-check that these are stored on the stack during the context save. Additionally, while debugging they can put breakpoints within the ADC ISRs that are triggering and monitoring the floating-point registers that have the previously stored sum, to see if the values are copied to the stack and, if they are not, if the ISR code is modifying their values.

    Best regards,

    Omer Amir