Flush_cb function is not called at all

Hi All ,

I am using Infineon XMC 4000 series controllers trying to bring up a display(MSP 3520)
The display has ILI9488 Display controller with resolution 320 * 480.

I am using latest version of LVGL library (V9.1.1) with GCC compiler (V4.9.3)
I know the compiler is pretty old and initially i faced some build errors with the preprocessor #if __has_include(LV_INTTYPES_INCLUDE) and i get to know that it is a compiler Bug which was resolved in later version so for now i commented the above preprocessor.

Apart of this the code is building fine and i tried to display a sample hello world but i observed the flush_cb function is not at all getting called.

Below is the code part.

void handler()
{
lv_tick_inc(1);

}
int main(void)
{
DAVE_STATUS_t status;

status = DAVE_Init(); /* Initialization of DAVE APPs */

if (status != DAVE_STATUS_SUCCESS)
{
/* Placeholder for error handler code. The while loop below can be replaced with an user error handler. */
XMC_DEBUG(“DAVE APPs initialization failed\n”);

while(1U)
{

}

}
/* Initialize LVGL and set up the essential components required for LVGL. */
lv_init();

// lv_log_register_print_cb( my_print );

lv_port_disp_init();

/Change the active screen’s background color/
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MAIN);

  /*Create a white label, set its text and align it to the center*/
  lv_obj_t * label = lv_label_create(lv_screen_active());
  lv_label_set_text(label, "Hello world");
  lv_obj_set_style_text_color(lv_screen_active(), lv_color_hex(0xffffff), LV_PART_MAIN);
  lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);

/* Placeholder for user application code. The while loop below can be replaced with user application code. */
while(1U)
{

  lv_timer_handler();

  	  for (int i = 0; i < 120000; i++) {
  	      // do nothing, just waste some CPU cycles
  	  }

}
}
void lv_port_disp_init(void)
{
/-------------------------
* Initialize your display
* -----------------------
/
disp_init();

/*------------------------------------
 * Create a display and set a flush_cb
 * -----------------------------------*/
lv_display_t * disp = lv_display_create(MY_DISP_HOR_RES, MY_DISP_VER_RES);
lv_display_set_flush_cb(disp, disp_flush);

/* Example 1
 * One buffer for partial rendering*/
static uint8_t buf_1_1[MY_DISP_HOR_RES * 10 * BYTE_PER_PIXEL];            /*A buffer for 10 rows*/
lv_display_set_buffers(disp, buf_1_1, NULL, sizeof(buf_1_1), LV_DISPLAY_RENDER_MODE_PARTIAL);

}

Thanks for looking into topic , Please let me know on how i can proceed forward.

Best Regards
Pradeep.

Hi ,

Just a add on to the above topic , I have tried with GCC Compiler (V11.12) without making any changes the library so it compiles fine but still the issue is not resolved.

show where you call handler func ? Read Quick overview — LVGL documentation

Hi Marian,

Thanks for you reply

lv_timer_Handler is called in while loop as below
while(1U)
{

lv_timer_handler();

  for (int i = 0; i < 120000; i++) {
      // do nothing, just waste some CPU cycles
  }

}

If you are talkihg about the handler function then it called by an timer event for every 1ms

Let me know if you need any further info

Are you sure is inc_tick called?

Indeed it is called in the below interrupt handler
Which is triggered for every 1ms

void handler()
{
lv_tick_inc(1);

}

Ahhh i mean - you check it with debuger if real works. And maybe try reorder set flush cb after buffers created not before. Or add too indev cb.

Too i read better and you place label to active screen, but screen i mean require create before. Im not used v9 but without screen i mean flush_cb isnt called…

Indeed the timere handler is wroking , i have checked it.

I am now out of ideas on how to debug this issue.

I have tried debugging and found the code is stuck at a default handler.

Any ideas are much appreciated

What is default handler? How optimize level you use in gcc … empty for isnt realy placed in compilation

Default handler is the handler that will be called when there no definition of the isr or function is not present but the function is called by the cpu.

I have a question in general what should be buffer size ?

My display 320 * 480 with 16bpp but there is an isuue as my display is based on ili9488 with SPI interface but SPI Interface doesn’t support rgb565 format so i need to convert it to rgb 888 althoigh this process is concerned once the flish function is called which is not happening

Ther is no optimization level enabled in my project

lvgl cant work when inctick dont work or is stuck in isr.

I mean you miss SPI ILI is RGB666 not 888

Now i have change the implementation and there is some development.

I am using the LVGL V8.3.5 and i can see the Flush function is getting called.

The entire screen is getting initilaised which is great after that i am displaying some sample Stress example , Here i can see only part of the pixel is getting updates.
Th display i am using is 320 * 480
I tried debugging the issue and see that the flush is getting called only for 320 * 30 pixels which means the area is increased up to 30 pixels and after that the flush function is not getting called any idea what might be the issue ?
So far the image upto 30 Pixels is correct.

You dont show code , then only tip … in flush cb after all pixels is send to display lvgl require notify about end… last line when no dma is used

lv_disp_flush_ready(disp_drv);

Sorry i didn’t post the code.

//The below handler is called be a timer ISR for every 1ms and it is working i have tested in debugging session.
void UserIRQHandler()
{
lv_tick_inc(5);

}

static void btn_event_cb(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * obj = lv_event_get_target(e);
if(code == LV_EVENT_VALUE_CHANGED) {
char buf[32];
lv_roller_get_selected_str(obj, buf, sizeof(buf));
LV_LOG_USER(“Selected month: %s\n”, buf);
}
}
int main(void)
{
DAVE_STATUS_t status;

status = DAVE_Init(); /* Initialization of DAVE APPs */

if (status != DAVE_STATUS_SUCCESS)
{
/* Placeholder for error handler code. The while loop below can be replaced with an user error handler. */
XMC_DEBUG(“DAVE APPs initialization failed\n”);

while(1U)
{

}

}

//Display Initilalization
ili9488_config();

/* Initialize LVGL and set up the essential components required for LVGL. */
lv_init();

 /*Initialize display driver. */
 lv_port_disp_init();


 lv_obj_t * btn = lv_btn_create(lv_scr_act());     /*Add a button the current screen*/
 lv_obj_set_pos(btn, 10, 10);                            /*Set its position*/
 lv_obj_set_size(btn, 220, 120);                          /*Set its size*/
 lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_ALL, NULL);           /*Assign a callback to the button*/

 lv_obj_t * label = lv_label_create(btn);          /*Add a label to the button*/
 lv_label_set_text(label, "Button");                     /*Set the labels text*/
 lv_obj_center(label);

/* Placeholder for user application code. The while loop below can be replaced with user application code. */
while(1U)
{

      lv_timer_handler();
      for(int i=0;i<1200000;i++)
      {

      }

}

I have attached the LVGL Support and Conf file also for reference purpose.
lvgl_support.h (3.6 KB)
lvgl_support.c (7.7 KB)
lv_conf.h (24.8 KB)

then why 5 ?

I have tried giving 1 but the result is same

Just an update ,

I tried printing the logs , Without the logs i can see some part of the display is getting displayed .

After i enabled the logs i am not seeing anything on the display. I have attached the log file for referenc e.
LVGL.txt (59.8 KB)

Hi,

Please try this:

  • In your flush_cb add only lv_display_flush_ready()
  • After lv_timer_handler() add printf("running\n")

If you see a lot of "running" prints, revert the code in flush_cb to see if it changes anything.

This code is strange:

static void btn_event_cb(lv_event_t * e)
{
  lv_event_code_t code = lv_event_get_code(e);
  lv_obj_t * obj = lv_event_get_target(e);
  if(code == LV_EVENT_VALUE_CHANGED) {
  char buf[32];
  lv_roller_get_selected_str(obj, buf, sizeof(buf));
  LV_LOG_USER(“Selected month: %s\n”, buf);
}

lv_roller_get_selected_str is called on a button. Please try removing the event as an experiment.

Hi ,

Thanks for the reply.

I have removed the event part and tested it as you have mentioned.

I haven’t seen any prints when i run it.

If i add the " running " before the lv_timer_handler() i am seeing that it gets printed once.

I have attached the Log
LVGl_1.txt (5.1 KB)