Hans Dorn, Very good hacking, this save my day, I trying avoid to use FreeRTOS notify in my timer of 1ms to not overload the system.
Your code works very well
Thaks a lot
Crash in timer interupt when data type "float" is used
-
- Posts: 59
- Joined: Thu Aug 17, 2017 5:40 pm
Re: Crash in timer interupt when data type "float" is used
Oh that is quite disappointing...ESP_igrr wrote:Floats use the FPU while doubles are calculated in software. For reasons, using the FPU inside an interrupt handler is currently not supported.
So when and how we can use floats? How soon you can add that FPU functionality?
Does this pertain only to Arduino framework or FreeRTOS in general when using bare esp-idf?
This is like one of the major features of ESP32 - like a super huge thing about fast FPU
Should be priority number one to implement it. Please do that asap )
Re: Crash in timer interupt when data type "float" is used
You can already use floats (with the FPU) in both Arduino & ESP-IDF. You can't do floating point calculations in an interrupt handler.Deouss wrote: So when and how we can use floats? How soon you can add that FPU functionality?
Does this pertain only to Arduino framework or FreeRTOS in general when using bare esp-idf?
This is like one of the major features of ESP32 - like a super huge thing about fast FPU
Should be priority number one to implement it. Please do that asap )
The solution is to restructure your code so that floating point calculations happen outside the interrupt handler. This is a good idea anyhow, as even with an FPU floating point math (especially division) can take more cycles than you may want to otherwise spend in the interrupt handler.
If you have code which does floating point math in an interrupt handler and you can't find a good way to structure it so that the math happens outside the interrupt handler, feel free to post it and we can probably make some suggestions.
Re: Crash in timer interupt when data type "float" is used
Yes now when I see how this is normally done it makes sense. Interrupts should be as short as possible when it comes to instruction cycles. I was first thinking to calculate values on interrupts but that could slow down whole measurement process.
-
- Posts: 59
- Joined: Thu Aug 17, 2017 5:40 pm
Re: Crash in timer interupt when data type "float" is used
The sin() and cos() functions of math.h, is for double (as ESP_igrr said -> its is calculated by software and not FPU)ESP_igrr wrote:Floats use the FPU while doubles are calculated in software. For reasons, using the FPU inside an interrupt handler is currently not supported.
Has anyone ever used fastmath.h?
These use float instead of double.
Can I replace sin and cos by sinf and cosf?
Who is online
Users browsing this forum: No registered users and 108 guests