Part Number: TMS320F280025C
Tool/software:
Hi there,
I have discovered a strange issue where during a float calculation the expected values fluctuate when the result is expected to be around 3328.0f (millivolts measured from an ADC). I am fairly certain this is a silicon / errata issue as no matter where I do this calculation in my code and no matter which variables I use to store the result it continues to fluctuate. (I tried doing this calculation in main() versus in a timer triggered interrupt and the result was the same).
To demonstrate the issue, I did the same calculation using uint32_t and I did not see this fluctuation. I then cast the result to a float (and divide by 10.0f) and I again see the fluctuations.
ch3_voltage_average_dmV is type uint32_t.
ch3_voltage_average_mV[1] is type float
To preserve accuracy when using uint32_t, ch3_voltage_average_dmV is 10x the size of ch3_voltage_average_mV.
You can see the first line where the uint32_t calculation is performed:
ch3_voltage_average_dmV = (sense_voltage_dmV *625)/ 1000; // The fluctuations are between 33281 and 33268. This is a total fluctiation of 1.3mV (when you divide dmV by 10 to get mV).
In the second line where the float cast and divide by 10.0f occurs:
ch3_voltage_average_mV[1] = ((float)ch3_voltage_average_dmV)/10.0f; // The fluctuation is now between 3311 and 3344. This is a total fluctuation of 33 mV.
The relevant code section is circled in red:

I went through the errata for : TMS320F28002x Real-Time MCUs Silicon Errata Silicon Revisions A, 0
I discovered a section titled: FPU-to-CPU Register Move Operation Preceded by Any FPU 2p Operation on pg 14.
Is it possible that this bug is somehow the cause of my issues? I am using the most recent compiler V22.6.1 so I am not sure how this can be possible?
Many thanks in advance for your support with this.
Dissassembly for this section can also be found below:


