Flush_cb()does not called when lv_task_handler() run

i modify code as below and display half screen,would you help to check?

for(y = area->y1; y <= area->y2 && y <disp_drv->ver_res; y++)
{
for(x = area->x1; x <= area->x2; x++)
{
FrameBuffer[(x * disp_drv->ver_res)+y] = (uint)lv_color_to16 (*color_p);
color_p++;

    }

}

volatile u8 *FrameBuffer = (u8 *)0x2005A800;
volatile u8 *DispBuffer = (u8 *)0x20035000;

What is your physical display resolution?
Is it 320 x 240 or
is it 240 x 320?
In other words, is it portrait or landscape mode?
That makes a difference.

And what do you want to use for the display?
If your display is physically a portrait mode display, but you want to use is it in landscape you have to rotate the output within the flusch function.
The same is true if you have landscape mode display and you want to use it in portrait mode.

You have a little confusion in setting up your LCD display driver, configuring lvgl and flush function.

width is 320 high is 240
it should be landscape mode.
i just want to make lVGL on my screen display correctly.


my LCD driver work as landscape mode.But when i execute below code,display is wrong
for(y = area->y1; y <= area->y2 && y <disp_drv->ver_res; y++)
{
for(x = area->x1; x <= area->x2; x++)
{
FrameBuffer[(y * disp_drv->hor_res)+x] = (uint)lv_color_to16 (*color_p);
color_p++;

    }

}

so i try to debug in Flush_cb().when i execute below code,display as picture

for(y = area->y1; y <= area->y2 && y <disp_drv->ver_res; y++)
{
for(x = area->x1; x <= area->x2; x++)
{
FrameBuffer[(x * disp_drv->ver_res)+y] = (uint)lv_color_to16 (*color_p);
color_p++;

    }

}

What is the display’s type name?
I don’t know the controller you are using, so I don’t know how the display controller can be setup.
Is it something similar to the STM32 family?
I can only find information in chinese.
Take a look into setting up the display controller.
I think there is some missmatch.

it’s similar to STM32.LCD’s Color depth is RGB565.
LCD Buffer size is 320*240 bytes.

when display content ready,call LCD driver,then DMA transmit data by SPI to screen

Your LCD is kind of ‘smart’ display. It has it’s own controller!?
So it’s not a ‘dump’ display which is directly connected to a microcontrollers LCD driver as with e.g. a STM32F7xx/H7xx.

In this case, you feed your LCD (via SPI) directly from flush function.
There is no need for copying the ‘working’ buffer into a frame buffer, and then into display (via SPI).

you mean i just need to update ‘working buffer’ by my LCD driver directly.no need to copy buffer,right?


when i disable copy ‘working buffer’ in Flush_cb(),display as picture.
do you need other information to check?

The working buffer has data for a specific area within the (full) display area.
This area is defined by the x1, y1 and x2 and y2 when the flush function is called.

Before you send the data to the display (via SPI) you have to configure the display controller (also over SPI) to accept the data for the specific area.
There should be appropriate functions for doing this.

Normally it is not necessary to always transfer the entire display data to the display controller, when there are only small changes.

There should be a manual for the display controller, or some example code.
As I don’t know your microcontroller and as I don’t know your display (with the display controller),
I cannot give you more hints.

what a bout color_p? how to handle it.
x1,y1,x2,y2 are position of area

For debug purpose,update entire display to screen is same with update area.
maybe Color_p need to make specific handle.Then call LCD driver to update these data to screen.


it’s a demo code to draw pixel for my LCD.

if i update ‘working buffer’ to screen directly.it will be show as picture.So i think ‘working buffer’ data must need to modify follow specific format.
for my LCD driver,it only transmit “FrameBuffer buffer” data to screen.i just dont know how to config ‘working buffer’ data in format.
image

when i output ‘working buf’ data,i can’t find ‘H’.so i dont understand how display “Hello word”

As far as I can see, you are using a demo code for your controller board with function for using the ST7789 display.
I didn’t find anything when searching for st7789_draw_pixel (or st7789_set_cursor) within the internet.
So far, I can see, that the ST7789 controller has a lot of registers for controlling the display.
Whether the display shows from left to right or right to left, etc. Also rotation seems to be possible.

You are trying to put lvgl on top of this code. But my guess is, that you are not really experienced with it.
At first you should get familiar with that demo code and the display controller.
You should find the code which does the initialization of the display controller and does the transfer of the display data.

Don’t use the SPI_DMA on the first steps. Use simple functions.
You can see that simple functions within the st7789_draw_pixel, after the #else
These functions (and macros) write directly to the ST7789 controller.
Try to draw lines, pixels, boxes, as your demo code supports it.

Then, if you understand all the display controller stuff, you can go forward trying to use lvgl.
At first, avoid using SPI DMA, use the simple (direct) functions for writing to the ST7789.

1 Like

would you tell ‘working buffer’ data format?

because i output “working buffer” data,i want to check the data format.but i cant understand it.
i even cant find “hello Word” in buffer data