Hi,
The issue is so stark I think it is probably me or something in the setup that is wrong, I just don’t know where to look. I have tried changing the refresh rate to no avail
I am using all NXP stuff, using their SDK example, then just adding in a screen made from gui-guider. I attach the flush function and display driver set-up.
Thank you for any help, I will follow up with NXP as well.
Many Thanks
static void DEMO_FlushDisplay(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
{
#if DEMO_USE_ROTATE
/*
* Work flow:
*
* 1. Wait for the available inactive frame buffer to draw.
* 2. Draw the ratated frame to inactive buffer.
* 3. Pass inactive to LCD controller to show.
*/
static bool firstFlush = true;
/* Only wait for the first time. */
if (firstFlush)
{
firstFlush = false;
}
else
{
/* Wait frame buffer. */
DEMO_WaitBufferSwitchOff();
}
DEMO_FLUSH_DCACHE();
/* Copy buffer. */
void *inactiveFrameBuffer = s_inactiveFrameBuffer;
#if LV_USE_GPU_NXP_PXP /* Use PXP to rotate the panel. */
lv_area_t dest_area = {
.x1 = 0,
.x2 = DEMO_BUFFER_HEIGHT - 1,
.y1 = 0,
.y2 = DEMO_BUFFER_WIDTH - 1,
};
lv_gpu_nxp_pxp_blit(((lv_color_t *)inactiveFrameBuffer), &dest_area, DEMO_BUFFER_WIDTH, color_p, area, LV_OPA_COVER,
LV_DISP_ROT_180);
#else /* Use CPU to rotate the panel. */
for (uint32_t y = 0; y < LVGL_BUFFER_HEIGHT; y++)
{
for (uint32_t x = 0; x < LVGL_BUFFER_WIDTH; x++)
{
((lv_color_t *)inactiveFrameBuffer)[(DEMO_BUFFER_HEIGHT - x) * DEMO_BUFFER_WIDTH + y] =
color_p[y * LVGL_BUFFER_WIDTH + x];
}
}
#endif
DEMO_FLUSH_DCACHE();
g_dc.ops->setFrameBuffer(&g_dc, 0, inactiveFrameBuffer);
/* IMPORTANT!!!
* Inform the graphics library that you are ready with the flushing*/
lv_disp_flush_ready(disp_drv);
#else /* DEMO_USE_ROTATE */
DEMO_FLUSH_DCACHE();
g_dc.ops->setFrameBuffer(&g_dc, 0, (void *)color_p);
DEMO_WaitBufferSwitchOff();
/* IMPORTANT!!!
* Inform the graphics library that you are ready with the flushing*/
lv_disp_flush_ready(disp_drv);
#endif /* DEMO_USE_ROTATE */
}
void lv_port_disp_init(void)
{
static lv_disp_draw_buf_t disp_buf;
memset(s_frameBuffer, 0, sizeof(s_frameBuffer));
#if DEMO_USE_ROTATE
memset(s_lvglBuffer, 0, sizeof(s_lvglBuffer));
lv_disp_draw_buf_init(&disp_buf, s_lvglBuffer[0], NULL, DEMO_BUFFER_WIDTH * DEMO_BUFFER_HEIGHT);
#else
lv_disp_draw_buf_init(&disp_buf, s_frameBuffer[0], s_frameBuffer[1], DEMO_BUFFER_WIDTH * DEMO_BUFFER_HEIGHT);
#endif
status_t status;
dc_fb_info_t fbInfo;
#if LV_USE_GPU_NXP_VG_LITE
/* Initialize GPU. */
BOARD_PrepareVGLiteController();
#endif
/*-------------------------
* Initialize your display
* -----------------------*/
BOARD_PrepareDisplayController();
status = g_dc.ops->init(&g_dc);
if (kStatus_Success != status)
{
assert(0);
}
g_dc.ops->getLayerDefaultConfig(&g_dc, 0, &fbInfo);
fbInfo.pixelFormat = DEMO_BUFFER_PIXEL_FORMAT;
fbInfo.width = DEMO_BUFFER_WIDTH;
fbInfo.height = DEMO_BUFFER_HEIGHT;
fbInfo.startX = DEMO_BUFFER_START_X;
fbInfo.startY = DEMO_BUFFER_START_Y;
fbInfo.strideBytes = DEMO_BUFFER_STRIDE_BYTE;
g_dc.ops->setLayerConfig(&g_dc, 0, &fbInfo);
g_dc.ops->setCallback(&g_dc, 0, DEMO_BufferSwitchOffCallback, NULL);
#if defined(SDK_OS_FREE_RTOS)
s_transferDone = xSemaphoreCreateBinary();
if (NULL == s_transferDone)
{
PRINTF(“Frame semaphore create failed\r\n”);
assert(0);
}
#else
s_transferDone = false;
#endif
#if DEMO_USE_ROTATE
/* s_frameBuffer[1] is first shown in the panel, s_frameBuffer[0] is inactive. */
s_inactiveFrameBuffer = (void *)s_frameBuffer[0];
#endif
/* lvgl starts render in frame buffer 0, so show frame buffer 1 first. */
g_dc.ops->setFrameBuffer(&g_dc, 0, (void *)s_frameBuffer[1]);
/* Wait for frame buffer sent to display controller video memory. */
if ((g_dc.ops->getProperty(&g_dc) & kDC_FB_ReserveFrameBuffer) == 0)
{
DEMO_WaitBufferSwitchOff();
}
g_dc.ops->enableLayer(&g_dc, 0);
/*-----------------------------------
* Register the display in LittlevGL
*----------------------------------*/
static lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
/*Set up the functions to access to your display*/
/*Set the resolution of the display*/
disp_drv.hor_res = LVGL_BUFFER_WIDTH;
disp_drv.ver_res = LVGL_BUFFER_HEIGHT;
/*Used to copy the buffer's content to the display*/
disp_drv.flush_cb = DEMO_FlushDisplay;
#if (LV_USE_GPU_NXP_VG_LITE || LV_USE_GPU_NXP_PXP)
disp_drv.clean_dcache_cb = DEMO_CleanInvalidateCache;
#endif
/*Set a display buffer*/
disp_drv.draw_buf = &disp_buf;
/* Partial refresh */
disp_drv.full_refresh = 1;
/*Finally register the driver*/
lv_disp_drv_register(&disp_drv);
#if LV_USE_GPU_NXP_VG_LITE
if (vg_lite_init(64, 64) != VG_LITE_SUCCESS)
{
PRINTF(“VGLite init error. STOP.”);
vg_lite_close();
assert(0);
}
#endif
}