cancel
Showing results for 
Search instead for 
Did you mean: 

Floating-point arithmetic interrupts

Hey0256
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions
mƎALLEm
ST Employee

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

 

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
mƎALLEm
ST Employee

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

 

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Hey0256
Associate II

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;