Hard Fault with Floating point and DSP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-15 7:30 AM - last edited on ‎2024-05-15 7:34 AM by mƎALLEm
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):
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.
- Labels:
-
STM32F3 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-15 8:06 AM
>>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?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-15 11:28 AM - edited ‎2024-05-15 11:28 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-15 12:45 PM
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
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-15 2:21 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-16 5:13 AM
The error appears the same with all types of optimizations, I just tried.
