Hi,
I'm experiencing sporadic calculation failures with one MSP430F2350 processor. I've tried the same code on a different board with another MSP430F2350 and it never fails. My question is if the problem relies completely on the specific processor or maybe on inputs from that particular board.
I have limited the code to do nothing than a useless floating point division as follows:
...
unsigned long ulTemp = 90000;
while ( 1 )
{
float fTest = (float)ulTemp / 1.0f;
if ( fTest == 8.10288043E+31 )
{
if ( P2IN & 0x04 )
P2OUT &= ~0x04;
else
P2OUT |= 0x04;
}
}
The watchdog timer is disabled and the external crystal (14.7456 MHz) is set as main and sub clock.
fTest is 80% of the time 90000.0 as it should be, but the rest of the time it is 8.10288043E+31. That behaviour shows up with the debug and the release version.
If I change ulTemp to a float variable, the result is always correct (also with more complicated divisions ;). On the other hand, if I just cast a variable from unsigned long to float, it never fails either. Only the combination of floating point division and the unsigned long to float cast seem to cause the problem.
Can anyone think of a reason for the unusual result, so that I can narrow the problem down? Could it be that a register like R6 or R7 is faulty on that particular processor or is it possible that some other condition on that particular board can cause that behaviour?
Maybe I should also mention that the processor seems to work perfectly otherwise. I have a 9KB code running on it and with exception of the division/cast part, everything works fine.
I'm thankful for any kind of ideas!