cancel
Showing results for 
Search instead for 
Did you mean: 

DMA usages between memory to peripheral

louiey
Associate II
Posted on October 16, 2015 at 07:51

Hello.

I'm trying to use DMA for graphic LCD control on F429(STM32Cube_FW_F4_V1.8.0).

LCD spec is 160x128 and color is 16bit(RGB565) and bus type is 8bit parallel.

So I'm using FMC to access LCD and now it's working well and I need to improve LCD update speed.

Actually if I increase AHB/SYS clock, its bus clock is increasing so could manage to get fast LCD update but I should increase its clock speed so I'm trying to use DMA to improve its speed. (I think DMA will clear my problem, isn't it?)

I wrote LCD_Write_DMA API to send color data to LCD and testing but it didn't send any data to LCD, external device.

My API code is like as below...

++++++++++++++++++++++++++++++++

uint16_t dma_color;

static void LCD_Write_DMA(uint16_t word, uint32_t word_len)

{

dma_color = word;

/* DMA controller clock enable */

__DMA2_CLK_ENABLE();

/* Configure DMA request hdma_memtomem_dma2_stream0 on DMA2_Stream0 */

hDma2Stream0.Instance = DMA2_Stream0;

hDma2Stream0.Init.Channel = DMA_CHANNEL_0;

hDma2Stream0.Init.Direction = DMA_MEMORY_TO_PERIPH;

hDma2Stream0.Init.PeriphInc = DMA_PINC_

DISABLE

;

hDma2Stream0.Init.MemInc = DMA_MINC_DISABLE;

hDma2Stream0.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;

hDma2Stream0.Init.MemDataAlignment = DMA_PDATAALIGN_HALFWORD;

hDma2Stream0.Init.Mode = DMA_NORMAL;

hDma2Stream0.Init.Priority = DMA_PRIORITY_HIGH;

hDma2Stream0.Init.FIFOMode = DMA_FIFOMODE_ENABLE;

hDma2Stream0.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;

hDma2Stream0.Init.MemBurst = DMA_MBURST_SINGLE;

hDma2Stream0.Init.PeriphBurst = DMA_PBURST_SINGLE;

HAL_DMA_DeInit(&hDma2Stream0);

HAL_DMA_Init(&hDma2Stream0);

/* DMA interrupt init */

HAL_NVIC_SetPriority(DMA2_Stream0_IRQn, 0, 0);

HAL_NVIC_EnableIRQ(DMA2_Stream0_IRQn);

HAL_DMA_Start_IT(&hDma2Stream0, (uint32_t)&dma_color, LCD_DATA, word_len*2);

}

++++++++++++++++++++++++++++++++

I keep calling LCD_Clear() to see there is a data coming out from bus but even though I changed some parameters, I couldn't manage to work with DMA.

As I said, it's working well with FMD without DMA so init and LCD relates config/HW connection is correct.

I could confirm srcAddr/dstAddr/DataLen is valid at DMA API but whenever I call ''LCD_Write_DMA'', I cannot see data coming from F427, there is no CS/RS/BUS/RD/WR signal coming.

Could anyone help what I missing and wrong?

Many thanks.

BR.

Louie Yang.

#fmc-lcd
0 REPLIES 0