Open adam-at-epsilon opened 9 years ago
ARM has a useful page on floating-point in Cortex M4
look here for the address of the FPSCR register which holds the overflow & underflow status bits
This is available among the registers from the debugger, creating an infinte loop like so:
float fl = 2;
while (1) {
fl = fl * 2;
}
Shows the content of the fpscr
register to be 0x14 which precisely matches the documentaiton.
The remaining question is why an interrupt is not generated/detected by HAL.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0553a/BABGHFIB.html
Checking the NVIC->IABR
register with the debugger show all IABR[0-7]
to be zero even though fpscr register says 0x14 so my working theory is that the interrupt was not enabled correctly.
Try using NVIC_GetActive
for a periodic check as a work-around.
Since we're doing the PID controller in hardware FPU, it could be a good idea to implement the
FPU_IRQHandler
.It should be possible to get divide by zero, overflow and underflow exceptions.