Floating point in ISR?

cmason
Posts: 9
Joined: Thu Dec 29, 2016 6:39 pm

Floating point in ISR?

Postby cmason » Fri Dec 30, 2016 7:24 pm

Is use of floating point instructions disallowed in interrupt routines?

Thanks,

-c

ESP_Sprite
Posts: 8926
Joined: Thu Nov 26, 2015 4:08 am

Re: Floating point in ISR?

Postby ESP_Sprite » Mon Jan 02, 2017 2:03 pm

It's not a good idea, no. The floating point registers aren't saved on ISR entry, so using floats in an interrupt means that the fpu registers as used by the currently running thread are corrupted. If there's no such thread, I'm not exactly sure what happens, but my guess would be a coprocessor exception resulting in a panic.

We're aware of this restriction, we're brooding on a nice way to fix it in the future, but for now, please do not use floating point stuff in ISRs.

Martin Schultz
Posts: 2
Joined: Wed Jul 07, 2021 11:09 am

Re: Floating point in ISR?

Postby Martin Schultz » Wed Jul 07, 2021 11:12 am

Is it already possible to use floating point in ISR? It's been 4 years since the creation of this topic and I still have this restriction on my esp-wroom-32d.

ESP_Sprite
Posts: 8926
Joined: Thu Nov 26, 2015 4:08 am

Re: Floating point in ISR?

Postby ESP_Sprite » Thu Jul 08, 2021 1:23 am

There's an option in menuconfig now to enable the FPU inside an ISR (ref)

Who is online

Users browsing this forum: No registered users and 130 guests