cancel
Showing results for 
Search instead for 
Did you mean: 

Hard Fault with Floating point and DSP

luke514
Senior

I am using STM32F302R8

I have a long code that triggers the Hard Fault interrupt after a few seconds because of these instructions (of the sine in particular):

luke514_1-1715783123103.png

The theta_fi angle is TIM6->CNT and I need to convert it from q15 to floating point.

I tried with both arm_q15_to_float function of DSP ... and arm_q15_to_float_new found online.

I can't figure out what the problem is.

5 REPLIES 5

>>I can't figure out what the problem is.

Perhaps start by looking at what's actually Faulting, what the MCU reports as it's objection, and the registers and code at the site of the fault?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I can't figure it out because with breakpoints the code works .. while it stops working after a few seconds when debugging without breakpoints so I can't trace back as much informations

 

I've never had an error like this happen to me so I'm not sure what to do

Instrument your code so you know what's happening.

A while(1) loops going to tell you, and support staff on a phone, nothing.

https://github.com/cturvey/RandomNinjaChef/blob/main/KeilHardFault.c

Tend to be gross failures:

Corrupt pointers or stack

Over-run local/auto variable space on the stack

Misaligned pointers

FPU not enabled

Interrupts / register corruption

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
STOne-32
ST Employee

Hi @luke514 ,

 

try to change the compiler optimization level from best for debug and best for speed or size and see if you observe the behavior change or occurrence of the timings , this will change the generated assembly sequences and code alignment. Let us know .

Ciao

STOne-32

The error appears the same with all types of optimizations, I just tried.