Lv_scr_load_anim() with lv_chart_set_next_value(), the program freezes

Hello,

I’m calling lv_chart_set_next_value() frequently, every 20ms. However, when a touch event is triggered and lv_scr_load_anim() is called, only a part of the new screen is loaded and the entire program freezes.
If I comment out lv_chart_set_next_value() there is no problem. I’ve also other widgets as slider, arc and there is no problem with them if the screen changes…

I’m using lvgl version 8.3.2.

I’m looking for any hints or workarounds for this issue?

Thank you.

It’s a bit little information you provide.

What does it mean you call lv_chart_set_next_value every 20 ms.
Is it from a lvgl timer call back? Or is it from a e.g. FreeRTOS thread?

Are you running a simulator on PC?
Is it a embedded system? What kind (ESP, STM32…)?
Have you setup it from scratch? Or is it based on example/template project?

here more informations:
Template / example discovery project.

For touch event following function is initialized and called, and lv_chart is called in a simple main while loop:

Touch event:

lv_obj_add_event_cb(ui->screen, screen_event_handler, LV_EVENT_GESTURE, ui);

 static void screen_event_handler(lv_event_t *e)
{
..
									lv_obj_t * act_scr = lv_scr_act();
									lv_disp_t * d = lv_obj_get_disp(act_scr);
									if (d->prev_scr == NULL && (d->scr_to_load == NULL || d->scr_to_load == act_scr))
									{
										if (ui.screen_1_del == true){
											setup_scr_screen_1(&ui);
											lv_scr_load_anim(ui.screen_1, LV_SCR_LOAD_ANIM_OVER_BOTTOM, 100, 100, true);
											ui.screen_del = true;
										}

									}
..
}

Chart update:

while (1)
  {
	  BSP_LED_Toggle(LED2);
	  HAL_Delay(5);
	  lv_task_handler();

	  if( (millis()-lastMillis2) > 20){

		  lastMillis2 = millis(); 

			lv_chart_set_all_value(ui.screen_chart_1, screen_chart_1_0, LV_CHART_POINT_NONE);
			lv_chart_set_all_value(ui.screen_chart_1, screen_chart_1_1, LV_CHART_POINT_NONE);

			lv_chart_set_next_value(ui.screen_chart_1, screen_chart_1_0, lv_rand(10,90));
			lv_chart_set_next_value(ui.screen_chart_1, screen_chart_1_0, lv_rand(10,90));
			lv_chart_set_next_value(ui.screen_chart_1, screen_chart_1_0, lv_rand(10,90));
			lv_chart_set_next_value(ui.screen_chart_1, screen_chart_1_0, lv_rand(10,90));
			lv_chart_set_next_value(ui.screen_chart_1, screen_chart_1_0, lv_rand(10,90));

			lv_chart_set_next_value(ui.screen_chart_1, screen_chart_1_1, hallValue1);
			lv_chart_set_next_value(ui.screen_chart_1, screen_chart_1_1, hallValue1);
			lv_chart_set_next_value(ui.screen_chart_1, screen_chart_1_1, hallValue1);
			lv_chart_set_next_value(ui.screen_chart_1, screen_chart_1_1, hallValue1);
			lv_chart_set_next_value(ui.screen_chart_1, screen_chart_1_1, hallValue1);
   }
}

EDIT:
With #define LV_USE_ASSERT_MEM_INTEGRITY 1 it freezes much earlier…

It is already a little more information, but not enough to isolate the problem.

Therefore, I can only try to give a few hints:
Freezing can have several causes. If you have a debugger running you can take a look, at which location the ‘freeze’ occurs.
On STM32 this might be caused by an exception. There are different exceptions.
Within the standard exception handlers (e.g. see the HardFault_Handler) there is mostly an endless loop which breaks down the controller:

while (1) {
}

But what is the cause for an exception?
Mostly it’s an accidental writing into a memory location. With C that can be done very easily.
E.g non initialized pointers, wrong pointer arithmetics, buffer overflow (wrong buffer sizes when using string functions),
and a lot more.
Or for example, if you use a preemtive multitasking system (like FreeRTOS) and you access lvgl functions from different threads/tasks without mutexes. That can also result in a ‘freeze’.

But as I don’t know your code and I don’t know whether you have any debugging cababilities it’s just poking in the mist.

sorry, I’m not well-versed in debugging in general. On top of that, the program is stored on an external flash and loaded via a bootloader (STM32H750), and I think the “default” debugging method (of STM32CubeIDE) will not work.
However, I do have a working UART/Serial output. But where do I start, and what do I output for example in this HardFault while loop?
But I think if it is already in this while loop UART will also not work…

EDIT:
I do not use FreeRTOS

You are using this board?
As far as I can see this board has also the STLINK-V3E integrated.
That means with a properly setup IDE you can do incircuit debugging.
That is what I would heavily recommend to use. Especially when developing in C.

yes this board, but debug of IDE does not work, I think it’s because the program is not on the internal flash. Internal flash has only a size of 128kb

I think it shouldn’t matter where the code is located.
You are working with the STM32CubeIDE?
I think it’s just a setup/configuration problem.

if it’s just a setup/configuration problem, then the question is how can I configure / change the default setting … I can’t find anything.

Hmm, a little difficult from a distance, as I can not see what you have already setup, and what is already working.
Can you connect STM32CubeIDE to the board (via STLINK-V3E)?
I think there should be some sites on the web where you can find appropriate information.
Maybe you find something on Y…tube.

I connect the board over his st-link USB connection.
I used a template example LTDC_Display_1Layer from STM with default Bootloader Project ExtMem_Boot and added LVGL. All lvgl demos are working without problems.