cancel
Showing results for 
Search instead for 
Did you mean: 

Double framebuffer causes Hardfault

DMuño.1
Associate II

Hello,

​I'm using a custom board based on the STM32F779 with external RAM, external QSPI flash and a 800x800 screen running in video mode. When I run the application with one framebuffer (on external RAM) it works but it has some flickering, so I'm trying to test with double buffering but when I change it I get a Hardfault after flushing the buffer the first time.

My buffers addresses are 0xC0000000 and 0xC01D5000 (based on the screen resolution 800x800x3), and the framebuffer region is protected with MPU. How can I solve this?

Thanks​

6 REPLIES 6
Romain DIELEMAN
ST Employee

Hi,

Just to make sure, you created your project using CubeMX to configure your HW? Did you base the settings and code from one ofthe board configuration generated when creating a project from TouchGFX Designer? If yes, did you make sure you correctly enabled the double buffer with the setFrameBufferStartAddresses() function? In some generated projects this function does not have the animation storage enabled with a set address (so in your case 0xC01D5000), so then the double buffer is not truly enabled even if set in CubeMX. This should not cause a hard fault but might still be a source of error.

/Romain

DMuño.1
Associate II

Hi, thank you for your help.

​Yes I configured the project from CubeMX. I initially made a new project with a STM32F769I-DISCO template in TouchGFX, then I modified the CubeMX project according to my HW, then returned to TouchGFX to generate the codea with the new CubeMX configuration.

I checked the setFrameBufferAddresses() function in TouchGFXGeneratedHAL.cpp and it has both addresses the 0xC0000000 and 0xC015D000 but it doesn't have anything in the animation buffer​, should I copy the second buffer address to this buffer in too?

I did my LTDC initialization with the first address (0xC0000000), is this supposed to be like that or should I set he second address? ​

Thank you​

MM..1
Chief II

How is your dotclock. And is recommended start buffers on memory pages start, then second buffer 0xC0200000

Too i dont understand flushing? How you do this? When you mean memory init, you need do this before start LTDC and RTOS

Animation buf is 3. you cant set same address.

Identify the registers and instructions actually faulting, might give you a clearer idea what you're looking at.

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

Hello, yes I do the memory init before LTDC and RTOS.

This is my clock configuration, I'm using DSI Host in video mode:

0693W000003QbsTQAS.png

0693W000003QbsYQAS.png

Regarding the flushing I mean that the HardFault appears after completing the first flushFrameBuffer() function from TouchGFXGeneratedHALl.cpp, it occurs exactly after the funcion Application::cacheDrawOperations() that it's entered as soon as the flushing is done.

Thank you

MM..1
Chief II

How big is your external RAM and how width databus 16 or 32?