Skip to main content
HMehr.14
Associate
May 3, 2019
Solved

Using any type of text causes HardFault

  • May 3, 2019
  • 16 replies
  • 11264 views

Hello,

I followed this guide (https://touchgfx.zendesk.com/hc/en-us/articles/115002741432-Create-custom-Application-Template) to adding TouchGFX to my existing project.

I'm working with IAR 8.30.1 and tgfx 4.10.0 and STM32F429ZG and FreeRTOS V9.0.0 ( with `heap_4.c` as memory manager ).

Everything works well now, except texts. Every time I added components that contain text, Hard Fault occurs during redraw (*.invalidate()) it.

I added 

virtual void handleTickEvent() { container.invalidate(); }

to my ScreenView class to verifying DMA2D and LTDC configurations. All components work well. But existing just a text component causes HardFault.

By tracking `LR` and `PC`, I find out that HardFault occures in `TextProvider` class.

I think stack corrupted. Due to often times, `PC` is in the `DataSection`.

I increased the stack size of my GUI task and `configTOTAL_HEAP_SIZE` of FreeRTOS configuration, But results not changed. Is there any other stack size ( or heap size ) limitation?

Or, May I has been configured `BoardConfiguration.cpp`, `STM32F4DMA.cpp` or `STM32F4HAL.cpp` in a wrong way ?

For more details :

0690X000008BDbFQAW.png

Please share your suggestions about my problem with me.

Thanks in advance.

Best answer by HMehr.14

Thanks for your guides. My problem solved and everything works well now. I forgot to set the 'Wildcard Characters' and 'Character Ranges' parameters in the designer!

16 replies

RPipi.1
Associate II
January 31, 2022

Sorry for not giving more answers. So this was solved by not using stm32cubeide. I think something was cached by the IDE. not sure.

But since swapping to developing in visual studio code and generating with touchgfx I have no more issues. Previously I built with STM32CUBEIDE.

ASmer.1
Associate II
July 28, 2022

Its old topic, however I just encountered this thing. TouchGFX 4.2 CubeIDE 1.10.1.

Adding static text - no wildcards- causes immediate HF. Has anyone came to some other then "use VS code" solution?

ASmer.1
Associate II
July 29, 2022

Problem is not occuring when Text section is placed in internal flash. It's confusing because all other assets work from external flash perfectly well.

RPipi.1
Associate II
August 1, 2022

I am using vscode for editing and building using touchgfx(makefile). You can edit in cubeidea as well but build with touchgfx(makefile).

since moving things to internal flash works I guess there is something messing up in addressing when content is placed in external flash. Maybe it even works if you explicitly place the content at a certain external address.

could it be that cubeidea / eclipse is configured to make its own makefile? Tried explicitly choosing which makefile to use? I never did this my self.

however to me it seemed like adding removing items to the ui for a number of times eventually messed things out. So I am guessing the position of items is off in regards to where it is in the memory.

however for me after switching to vs code + makefile build everything works all the time :) been developing for a year now.

RPipi.1
Associate II
August 1, 2022

Check what differs in map when building in idea vs in touchgfx

Martin KJELDSEN
Principal III
August 15, 2022

Try to ensure that QuadSpi is initialized before TouchGFX. TouchGFX will attempt to access the flash to init texts, but if not initialized yet then you'll get a HF.

What does your main function look like?

/Martin

ASmer.1
Associate II
August 15, 2022

Martin,

I didn't have time to further investigate the issue, however QSPI is initialized before TGFX. I have all assets including fonts in external memory. I believe RPipi is correct that something is being messed up as widgets are added removed. All worked well - including texts in external flash- fo certain point (lets say 8 text area's) Adding one more caused HT. Removing added area didn't cure the issue. Only removing all text area's got rid of HT. For now i left text in internal flash. Will have closer look at it when time allows.

Martin KJELDSEN
Principal III
August 16, 2022

Okay, let me know. You can just post to this thread and i'll try to help.

MSecr.1
Associate II
July 10, 2024

I was facing that specific issue due to a stack overflow, so make sure you allocated enough memory for the stack