cancel
Showing results for 
Search instead for 
Did you mean: 

hal_delay causes a hard fault

idrissmc
Associate II

hello,

i'm debugging this code suddenly i got a hard fault as shown in the figure:

0693W000002lZSCQA2.png

how can I solve this

11 REPLIES 11
TDK
Guru

Looks like it’s in the watchdog IRQ handler. Unlikely that HAL_Delay caused the issue.

If you feel a post has answered your question, please click "Accept as Solution".

The watchdog raises the hard fault because it catched an infinite loop in the HAL_Delay my friend, so the HAL_delay causes the hard fault

Is HAL Tick advancing? Or the delay you're attempting spaning the watchdog?

Bringing up the camera before the SysTick/TIM driving the tick has been initialized?

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

i changed the timebase to use TIM6 instead of SysTick. now I get a hard fault in DMA2D. the green line

0693W000002lc30QAA.png

Suggests one of the structures/instances is not properly initialized.

Got to double check the processor registers, and disassembled code at the fault to completely understand which element failed.

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

I generated this with cubeMX, naturally it's compatible with my board.

this is the disassembly with the @ of the error

0693W000002lgaSQAQ.png

Inspect the value in R3, likely bogus

Would likely be hdma2d->Instance pointing at some random location, CHECK IT

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

the value is: 0x7f800, it's ok because cubeMX generated that value too

This is an uphill slog.

DMA2D_BASE is 0x4002B000 as I recall. The structure (hdma2d) is either not properly initialized, or is subsequently corrupted.

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