2022-12-08 01:36 AM
I am currently working on a touch screen for one of our products.
I built an LCD intel 8080 driver with the FMC and it's not working with DMA.
The image is only partially flushed to the screen.
It seems that there is some kind of limits to the transfer size that i don't know of ?
The use of the DMA is major to our application performance as printing a full screens takes 22ms in blocking mode.
I use a Frame buffer of 307200B the size of the screen. In the below example, code structure doesn't allow differences in the buffer data used by the API DMA/NODMA.
WITHOUT DMA
-Code:
CONFIGURATION
RUN
HAL_StatusTypeDef res = HAL_SRAM_Write_8b(&hsram1, (uint32_t *)FMC_DATA_ADDR, (uint8_t *)buffer, len);
ASSERT(res==HAL_OK);
-Display:
WITH DMA
-Code:
CONFIGURATION
INIT
This is the only configuration Added to the gpma.c
/* USER CODE BEGIN GPDMA1_Init 2 */
__HAL_LINKDMA(&hsram1, hdma, DMA_TFT_CHANNEL_HANDLE);
/* USER CODE END GPDMA1_Init 2 */
CB
/* USER CODE BEGIN 0 */
#include "gpdma.h"
#include "02_Mid/LVGL/lvgl_drivers.h"
#include "01_Drv/inc/ecran/ST7796S.h"
/**
* @brief DMA transfer complete callback.
* @param hdma pointer to a SRAM_HandleTypeDef structure that contains
* the configuration information for SRAM module.
* @retval None
*/
void HAL_SRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma)
{
if(hdma == &DMA_TFT_CHANNEL_HANDLE){
st7796s_txCplt_irq(true);
}
}
/**
* @brief DMA transfer complete error callback.
* @param hdma pointer to a SRAM_HandleTypeDef structure that contains
* the configuration information for SRAM module.
* @retval None
*/
void HAL_SRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma)
{
if(hdma == &DMA_TFT_CHANNEL_HANDLE){
st7796s_txCplt_irq(false);
}
}
/* USER CODE END 0 */
RUN
HAL_StatusTypeDef res = HAL_SRAM_Write_DMA(&hsram1, (uint32_t *)FMC_DATA_ADDR, (uint32_t *)buffer, len);
ASSERT(res==HAL_OK);
PRINTLN("len %d",len);
-Log:
-Display:
Solved! Go to Solution.
2022-12-08 05:32 AM
I missed the number max of block in DMA registers p689.
I can only send 64kB max.
Another mistakes was to not change the len in the API when i'm using words.
HAL_StatusTypeDef res = HAL_SRAM_Write_8b(&hsram1, (uint32_t *)FMC_DATA_ADDR, (uint8_t *)buffer, len);
uint32_t buffersize = len/4.
Buffersize is not the size in bytes but the size of the array...
Inside the API this code manage the number of bytes...
if (data_width == DMA_DEST_DATAWIDTH_WORD){
size = (BufferSize * 4U);
}
else if (data_width == DMA_DEST_DATAWIDTH_HALFWORD){
size = (BufferSize * 2U);
}
else {
size = (BufferSize);
}
2022-12-08 05:32 AM
I missed the number max of block in DMA registers p689.
I can only send 64kB max.
Another mistakes was to not change the len in the API when i'm using words.
HAL_StatusTypeDef res = HAL_SRAM_Write_8b(&hsram1, (uint32_t *)FMC_DATA_ADDR, (uint8_t *)buffer, len);
uint32_t buffersize = len/4.
Buffersize is not the size in bytes but the size of the array...
Inside the API this code manage the number of bytes...
if (data_width == DMA_DEST_DATAWIDTH_WORD){
size = (BufferSize * 4U);
}
else if (data_width == DMA_DEST_DATAWIDTH_HALFWORD){
size = (BufferSize * 2U);
}
else {
size = (BufferSize);
}