2025-05-09 2:02 AM
Hello to everyone in the forum.
I am using STM32H735.
Is it possible to perform a floating point number operation and generate an interrupt when an exception occurs?
I want to interrupt when the bit for exception generation in the FPSCR register is turned ON.
Or do I have to create a thread for register monitoring and constantly check the bits?
I await your advice.
See you soon.
Solved! Go to Solution.
2025-05-09 7:01 AM - edited 2025-05-09 7:01 AM
Hello,
Normally FPU interrupt handler FPU_IRQHandler() is intended to be used for this kind of check.
So enable the FPU NVIC and try to trigger one of the conditions that sets one of the flags in this register:
Floating-Point Status and Control Register, FPSCR
2025-05-09 7:01 AM - edited 2025-05-09 7:01 AM
Hello,
Normally FPU interrupt handler FPU_IRQHandler() is intended to be used for this kind of check.
So enable the FPU NVIC and try to trigger one of the conditions that sets one of the flags in this register:
Floating-Point Status and Control Register, FPSCR
2025-05-09 6:47 PM
Dear mƎALLEm , thank you for your reply.
I took your advice and added an interrupt process.
The interrupt process was called after the floating point division by zero.
I would like to add more processes as we continue to investigate this.
Again, thank you very much.
#define FPU_DZC_MASK 0x02
void FPU_IRQHandler(void)
{
uint32_t *fpscr = (uint32_t *)(FPU -> FPCAR + 0x40);
(void)__get_FPSCR();
*fpscr = *fpscr & ~(FPU_DZC_MASK);
}
NVIC_SetPriority(FPU_IRQn, 5);
NVIC_EnableIRQ(FPU_IRQn);
float a = 1.0 / 0;