What do you want to achieve?
I’d like to get smooth screen changes with animations when using lv_screen_load_anim()
Animations like LV_SCR_LOAD_ANIM_MOVE_LEFT, LV_SCR_LOAD_ANIM_MOVE_RIGHT, & LV_SCR_LOAD_ANIM_FADE_IN.
Some background. I have a functional UI that I originally wrote for an esp32s3, where LV_SCR_LOAD_ANIM_NONE was used. I could never get screen changes to be smooth on the esp. I’m now porting over the UI to the stm32F469AI, for this DragonEye display
I’m hoping the use of its Chrom-ART accelerator/DMA2D will make the animations when changing screens very smooth.
The main issue I’m experiencing is that when I do enable LV_USE_DRAW_DMA2D_INTERRUPT=1 and add lv_draw_dma2d_transfer_complete_interrupt_handler() in the global DMA2D IRQ handler, it breaks the application.
When using LV_USE_DRAW_DMA2D_INTERRUPT and…
lv_st_ltdc_create_partial or direct: The first screen never gets loaded. The screen stays fuzzy white. The application is frozen or crahsed.
What have you tried so far?
- I’ve enabled
LV_USE_ST_LTDCandLV_USE_DMA2D… here are the sections from my lv_conf.h
#define LV_USE_ST_LTDC 1
#if LV_USE_ST_LTDC
/* Only used for partial. */
#define LV_ST_LTDC_USE_DMA2D_FLUSH 0
#endif
/** Accelerate blends, fills, etc. with STM32 DMA2D */
#define LV_USE_DRAW_DMA2D 1
#if LV_USE_DRAW_DMA2D
#define LV_DRAW_DMA2D_HAL_INCLUDE "main.h"
/* if enabled, the user is required to call `lv_draw_dma2d_transfer_complete_interrupt_handler`
* upon receiving the DMA2D global interrupt
*/
#define LV_USE_DRAW_DMA2D_INTERRUPT 1
#endif
- The inclusion of
lv_draw_dma2d_transfer_complete_interrupt_handler()when testing LV_USE_DRAW_DMA2D_INTERRUPT = 1.
* @brief This function handles DMA2D global interrupt.
*/
void DMA2D_IRQHandler(void)
{
/* USER CODE BEGIN DMA2D_IRQn 0 */
/* USER CODE END DMA2D_IRQn 0 */
HAL_DMA2D_IRQHandler(&hdma2d);
/* USER CODE BEGIN DMA2D_IRQn 1 */
lv_draw_dma2d_transfer_complete_interrupt_handler();
/* USER CODE END DMA2D_IRQn 1 */
}
When not enabling LV_USE_DRAW_DMA2D_INTERRUPT, the app runs fine. The screen changing animations will be very choppy and slow though.
- My lvgl initialization calls. I currently have a
lv_st_ltdc_create_partialanddirect, that I’ve been going back and forth testing between.
lv_init();
lv_tick_set_cb(HAL_GetTick);
static uint8_t buf1[480 * 40 * 2];
static uint8_t buf2[480 * 40 * 2];
lv_display_t *disp = lv_st_ltdc_create_partial(
buf1, buf2, sizeof(buf1),
0 /* layer index */
);
// Two full framebuffers in SDRAM
// void *fb1 = (void *)0xC0000000;
// void *fb2 = (void *)0xC0200000; // after 2MB gap
// lv_display_t *disp = lv_st_ltdc_create_direct(fb1, fb2, 0);
My one and only task that tests screen changing every few seconds.
void StartDefaultTask(void *argument)
{
uint32_t counter = 0;
bool showing_status = true;
for (;;)
{
counter++;
if (counter >= 500) // 500 * 10ms = 5 seconds
{
counter = 0;
if (showing_status) {
showing_status = false;
BSP_LED_SetColor(RGB_RED);
lv_screen_load_anim(menu_screen.get_lv_obj(), LV_SCR_LOAD_ANIM_MOVE_LEFT, 1250, 0, false);
} else {
showing_status = true;
BSP_LED_SetColor(RGB_BLUE);
lv_screen_load_anim(status_screen.get_lv_obj(), LV_SCR_LOAD_ANIM_MOVE_RIGHT, 1250, 0, false);
}
}
lv_timer_handler();
osDelay(16);
}
}
Environment
- MCU/MPU/Board: STM32F469AI
- LVGL version: 9.4.0
- RTOS: FreeRTOS