Part Number: TMS320F28374S
Hi,
I'm using this uP to control a 10 kw 3 phase buck. I get strange Udc value on power off of the converter.
I measure current and voltage in this way:
SDFM is free running -> CLA gets data via SDFM data ready interrupt-> CLA computes running average of current and voltage for 3 switching periods -> gives result to uP.
The running average code is:
Sum = Sum - Buffer[Pointer];
Buffer[Pointer] = DataFormSDFM * Scale;
Sum = Sum + Buffer[Pointer];
Result = Sum / (NrOfSamples +1);
if(Pointer >= NrOfSamples){
Pointer = 0;
}
else{
Pointer = Pointer +1;
}
(I'm using float32 for Sum,Buffer,Result,Scale and Uint for pointer)
Now this gives correct result when I use it to measure current (all current measurements are on SDFM1).
But for voltage (measured with SDFM2 ) I get result -600V (or other random big negative number) when I turn off my converter. So I addded
if( Result< -10){
__mdebugstop();
}
at the end of the task that is triggered by SDFM2. And sure enough the second I stop my converter it brakes here.
I get all normal values in Buffer, in it I have 33.8 +/- 0.5V. But the values of Sum is -4614.4. And then it slowly in a couple of minutes goes back to 0 +/-0.5v.
As there is no strange big number in Buffer I thing SDFM is ok, measures ok when the converter is running. My question is now:
1) Why does the large negative value of Add suddenly happen?
2) Why does it go down to 0? Floating point error in calculation?
3) How to fix this?
Best regards,
Marko Ante