Lv_timer_handler() HardFault on stm32f746G-Discovery board


I’m trying to get a “Label example” to run on the stm32f746G-Discovery board.
I’m getting a HardFault somewhere inside lv_timer_handler().
I was using the master branch of LVGL and master branch of the stm32f746-port aswell. Not sure if I should use a specific version of them both?
So far I’m not using external SDRAM, so I did some modifications to the LVGL code, for example change my_fb[] to use the one stored in internal RAM, and changed LV_MEM_SIZE to a smaller size.
What can be the issue with lv_timer_handler()?

I should also mention that I call lv_tick_inc(1) in SysTick_Handler()

What MCU/Processor/Board and compiler are you using?


What do you want to achieve?

Get example code to run on the device.

What have you tried so far?

Followed a course ( on Udemy to get some teoretical background on LCD/Graphics programming.
I’m using VSCode and CMake based build system, and generating the HAL layer from STMCubeMX. Both I2C3 and LCD peripherals are enabled.

Code to reproduce

Add the relevant code snippets here.

The code block(s) should be between ```c and ``` tags:

/*int main(void)



	while (1)
		my_printf("--hello from stm32f7--");

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

worth noting is that I use the following configurations for memory:

_Min_Heap_Size = 0x200; //required amount of heap
_Min_Stack_Size = 0x4000; //required amount of stack

#define LV_MEM_SIZE (18U * 1024U) // [bytes]

It now works sometimes, but all of a sudden it doesn’t work anymore. Very strange behavior.
I’ve updated everything, using master-branch of stm32f746_port and the branch/commit of LVGL pointed to by stm32f746_port.
So memory shouldn’t be any issue since the Frame Buffer is now in external SDRAM.
Sometimes it works, but sometimes I still get HardFault in lv_timer_handler()

Problem solved!

After debugging deep inside LVGL I found that these two functions where called in tft.c:


So I needed to enable D-Cache and I-Cache in STMCubeMX.
Now it’s working fine!