Stm32f401 ili9341 spi dma

Description

Hi all!
STM32F401 SPI DMA bad image picture

What MCU/Processor/Board and compiler are you using?

STM32F401 Keil

What LVGL version are you using?

Configuration file for v7.10.1

What do you want to achieve?

I want to configure the disp_flush function for SPI DMA

What have you tried so far?

Without using DMA everything just works very slowly.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:


static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
	ILI9341_Send_Data_DMA(area->x1, area->y1, area->x2, area->y2, (uint8_t *)color_p);
}

void ILI9341_Send_Data_DMA(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end, uint8_t *p)
{
	ILI9341_Address_Set(x_start, y_start, x_end, y_end);	
	ILI9341_Select();
	HAL_SPI_Transmit_DMA(&ILI9341_SPI_PORT, (uint8_t *)p, (x_end - x_start + 1) * (y_end - y_start + 1) * 2);		
	ILI9341_SPI_WAIT_DMA();
}

void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)
{	
  ILI9341_Deselect();
	HAL_SPI_DMAStop(&hspi1);
	lv_disp_flush_ready(&disp_drv);
}

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Problem solved, #define LV_COLOR_16_SWAP must be specified in lv_conf.h settings 1. Thank you!

1 Like

You solved the problem that troubled me all day, thank you