Hi!
I encountered a weird problem with float calculation/casting in irq on rm46.
I read some ADC values, do averaging and calculate the millivolts out of the increments.
When I call the handler in FIQ, everything works fine.
Now I wanted to call the handler from IRQ and sometimes the voltage-variable calculates to 0xFFFFFFFF,
although the variable "f" has the right value (verified with debugger).
I think something can go wrong with typecasting while FIQ interrupts the IRQ !?
my code is as follows:
IRQ void irqHandler(void) { float f; uint32_t voltage; uint32_t sum = 0; // averaging for(i=0;i<8;i++) { sum += adcValues[i]; } f = (float)(sum/8) * 8.13f; // calculation of millivolts with some factor voltage = (uint32_t) f; }
What could produce the problem?
Best regards
Falk