cancel
Showing results for 
Search instead for 
Did you mean: 

Hard fault when drawing bit map using STemWin on STM32F4

rbs3rd
Associate II
Posted on May 19, 2014 at 19:07

When I try to display a bit map on my LCD, the STM32F4 jumps to the hard fault  handler. Because the library is in a binary format, I can't really see whats causing the fault. If I comment out the line, the hard fault doesn't happen. I am using other STemWin functions, GUI_SetColor, GUI_FillRect, GUI_SetFont, GUI_DispStringAt, and the LCD behaves exactly as I expect it to. I know that writing to a protected bank of SDRAM will cause an AHB error, and hard fault, so I've verified that the write protect bits are cleared. I'm looking for a recommendation on how to assess the root cause of the hard fault. 

#stemwin-stm32f429
14 REPLIES 14
Posted on May 20, 2014 at 17:03

I did not think that error could cause the M4 to experience a bus fault/hard fault. 

Well it doesn't directly, it's more likely a side effect of the code reading an unexpectedly large/wrong number and the resultant math causing it to try and access beyond the scope of the memory.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
francescatodiego
Associate II
Posted on May 20, 2014 at 18:52

Second, do you know where IAR specifies the stack size. 

From IAR ide:

Project->options

select Linker in category list

Tab Config press Edit...button

select Stack/Heap Sizes tab

rbs3rd
Associate II
Posted on May 20, 2014 at 20:55

Thanks!

rbs3rd
Associate II
Posted on July 30, 2014 at 16:32

The second revision of my HW did have the byte enables assigned correctly, and the hard fault was an issue no more!

Posted on July 30, 2014 at 16:54

The second revision of my HW did have the byte enables assigned correctly, and the hard fault was an issue no more!

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