What do you want to achieve?
I have a board where the STM32F7 micro was replaced with an STM32H7. I ported it and the display works. It turns on and displays the home page correctly, but I can’t update the display. The callback to update the frame fires only once. How can I fix this?
With the same code it obviously works on STM32F7
What have you tried so far?
Code to reproduce
void lv_port_disp_init()
{
disp_init();
lv_port_fs_init();
Init_IconFonts();
Init_TextFont(font);
__HAL_LTDC_ENABLE_IT(&hltdc, LTDC_IT_RR);
// HAL_GPIO_WritePin(UD_uC_GPIO_Port, UD_uC_Pin, GPIO_PIN_SET);
/*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);
lv_display_set_rotation(disp, LV_DISPLAY_ROTATION_180);
lv_display_set_buffers(disp, FRAMEBUFFER1_ADDR, FRAMEBUFFER2_ADDR, 800 * 480 * 2 , LV_DISPLAY_RENDER_MODE_DIRECT); //
CreateScreen();
}
static void disp_init() /*Initialize your display and the required peripherals.*/
{
LCD_Startup_Sequence();
}
volatile bool disp_flush_enabled = true;
void disp_enable_update() /* Enable updating the screen (the flushing process) when disp_flush() is called by LVGL */
{
disp_flush_enabled = true;
}
void disp_disable_update() /* Disable updating the screen (the flushing process) when disp_flush() is called by LVGL */
{
disp_flush_enabled = false;
}
/*Flush the content of the internal buffer the specific area on the display.
*`px_map` contains the rendered image as raw pixel map and it should be copied to `area` on the display.
*You can use DMA or any hardware acceleration to do this operation in the background but
*'lv_display_flush_ready()' has to be called when it's finished.*/
//static void disp_flush(lv_display_t * disp_drv, const lv_area_t * area, uint8_t * px_map)
//{
// if(disp_flush_enabled)
// {
// LTDC_Layer1->CFBAR = (uint32_t)px_map;
// LTDC->SRCR = LTDC_SRCR_IMR; // Reload immediato
// }
// //lv_display_flush_ready(disp_drv);
//}
static void disp_flush(lv_display_t * disp_drv, const lv_area_t * area, uint8_t * px_map) /* Funzione di flush LVGL */
{
if(px_map == NULL) return;
pending_buf = px_map;
disp_ref = disp_drv;
LTDC_Layer1->CFBAR = (uint32_t)pending_buf;
LTDC->SRCR = LTDC_SRCR_VBR;
}
/**
* IRQ handler per LTDC
* Deve essere chiamato da LTDC_IRQHandler
*/
void LTDC_ReloadEventCallback()
{
if(disp_ref != NULL)
{
lv_display_flush_ready(disp_ref);
// HAL_GPIO_TogglePin(Check_Display_GPIO_Port, Check_Display_Pin);
disp_ref = NULL; // Reset, attendo un nuovo flush
}
}
Screenshot and/or video
Environment
- MCU/MPU/Board: STM32H743
- LVGL version: 9.3.0