2018-04-01 11:50 PM
Dear every body,
I are using
LCD TFT 7 inch 800x480/external-link.jspa?url=https%3A%2F%2Fwww.buydisplay.com%2Fdefault%2F7-tft-lcd-touch-screen-display-module-800x480-for-mp4-gps-tablet-pc
in our design with STM32F746BTG6 processor working at 200 MHz frequency.We are using STemWin Library on RTOS operating system
/external-link.jspa?url=https%3A%2F%2Fwww.freertos.org%2F
with LTDC support.GUIBuilder.exe software will generate gui data.
I are statically storing the required ARGB format in external SDRAM.
The data is loaded from SDRAM to LTDC (STM32F7 LCD Controller)
using DMA2D and FMC interface(Flexible Memory Controller – Working at 200/2 MHz).Timing LCD TFT 7 inch from datasheet:
/external-link.jspa?url=http%3A%2F%2Fwww.buydisplay.com%2Fdownload%2Fic%2FOTA7001A.pdf
About frequency in system:
- SDRAM: 100MHz, use same bus data 16bit with other device. Examples:nor flash.
/* Timing configuration for 100Mhz as SD clock frequency (System clock is up to 200Mhz) */
Timing.LoadToActiveDelay = 2;Timing.ExitSelfRefreshDelay = 7;Timing.SelfRefreshTime = 4;Timing.RowCycleDelay = 7;Timing.WriteRecoveryTime = 2;Timing.RPDelay = 2;Timing.RCDDelay = 2;sdramHandle.Init.SDBank = FMC_SDRAM_BANK1;sdramHandle.Init.ColumnBitsNumber = FMC_SDRAM_COLUMN_BITS_NUM_9;
sdramHandle.Init.RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_13;sdramHandle.Init.MemoryDataWidth = SDRAM_MEMORY_WIDTH;
sdramHandle.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4;sdramHandle.Init.CASLatency = FMC_SDRAM_CAS_LATENCY_2;sdramHandle.Init.WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE;sdramHandle.Init.SDClockPeriod = SDCLOCK_PERIOD;sdramHandle.Init.ReadBurst = FMC_SDRAM_RBURST_ENABLE;
sdramHandle.Init.ReadPipeDelay = FMC_SDRAM_RPIPE_DELAY_0;- LTDC: 19.2 MHz.
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
PeriphClkInitStruct.PLLSAI.PLLSAIN = 192;PeriphClkInitStruct.PLLSAI.PLLSAIR = 5;PeriphClkInitStruct.PLLSAIDivR = 2;HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);While I'm getting data in norflash, LCD have prolems is flickering.
I know that LTDC will gennerate data to LCD automatically after SDRAM refresh, isn't it?
What is solution to hold data on LTDC while other device use bus data of SDRAM (16 bit data)?
Can you tell me solutions to fix that bug, please?
Thank you so much!
null2018-04-04 04:01 AM
Like this ? :
2018-04-04 05:43 AM
Yes,
STM32F746BTG6
have only single precision (MPU).
2018-04-04 05:48 AM
Dear
Marsh.Nick
,About ''increase the front porch and back porch as much as you can, see if that helps.''
http://www.buydisplay.com/download/ic/OTA7001A.pdf
option 1:
//#define LCD_7_HSYNC ((uint16_t)120) /* Horizontal synchronization */
//#defineLCD_7
_HBP ((uint16_t)88) /* Horizontal back porch */ //#defineLCD_7
_HFP ((uint16_t)40) /* Horizontal front porch */ //#defineLCD_7
_VSYNC ((uint16_t)50) /* Vertical synchronization */ //#defineLCD_7
_VBP ((uint16_t)32) /* Vertical back porch */ //#defineLCD_7
_VFP ((uint16_t)13) /* Vertical front porch */option 2:
I'm doing.
I'll tell you about results.
Thank you.
2018-04-04 06:10 AM
Dear
Marsh.Nick
,
option 2:
//#define LCD_7_HSYNC ((uint16_t)240) /* Horizontal synchronization */
//#defineLCD_7
_HBP ((uint16_t)176) /* Horizontal back porch */ //#defineLCD_7
_HFP ((uint16_t)80) /* Horizontal front porch */ //#defineLCD_7
_VSYNC ((uint16_t)50) /* Vertical synchronization */ //#defineLCD_7
_VBP ((uint16_t)64) /* Vertical back porch */ //#defineLCD_7
_VFP ((uint16_t)26) /* Vertical front porch */Flicker on LCD seems to reduce.
//************************************************************
uint8_t BSP_SDRAM_Init(void)
{ static uint8_t sdramstatus = SDRAM_ERROR; /* SDRAM device configuration */ sdramHandle.Instance = FMC_SDRAM_DEVICE;/* Timing configuration for 100Mhz as SD clock frequency (System clock is up to 200Mhz) */
Timing.LoadToActiveDelay = 2; Timing.ExitSelfRefreshDelay = 7; Timing.SelfRefreshTime = 4; Timing.RowCycleDelay = 7; Timing.WriteRecoveryTime = 2; Timing.RPDelay = 2; Timing.RCDDelay = 2;sdramHandle.Init.SDBank = FMC_SDRAM_BANK1;
sdramHandle.Init.ColumnBitsNumber = FMC_SDRAM_COLUMN_BITS_NUM_9;
sdramHandle.Init.RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_13;sdramHandle.Init.MemoryDataWidth = SDRAM_MEMORY_WIDTH;
sdramHandle.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4; sdramHandle.Init.CASLatency = FMC_SDRAM_CAS_LATENCY_2; sdramHandle.Init.WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE; sdramHandle.Init.SDClockPeriod = SDCLOCK_PERIOD; sdramHandle.Init.ReadBurst = FMC_SDRAM_RBURST_ENABLE; sdramHandle.Init.ReadPipeDelay = FMC_SDRAM_RPIPE_DELAY_0;/* SDRAM controller initialization */
BSP_SDRAM_MspInit(&sdramHandle, NULL); /* __weak function can be rewritten by the application */
if(HAL_SDRAM_Init(&sdramHandle, &Timing) != HAL_OK)
{ sdramstatus = SDRAM_ERROR; } else { sdramstatus = SDRAM_OK; }/* SDRAM initialization sequence */
BSP_SDRAM_Initialization_sequence(REFRESH_COUNT);return sdramstatus;
}
//*******************************************
/**
* @brief Initialize the LCD Controller. * @param LayerIndex : layer Index. * @retval None */ static void LCD_LL_Init(void) { /* DeInit */ HAL_LTDC_DeInit(&hltdc); /* Set LCD Timings */ hltdc.Init.HorizontalSync = (LCD_7_HSYNC - 1); hltdc.Init.VerticalSync = (LCD_7_VSYNC - 1); hltdc.Init.AccumulatedHBP = (LCD_7_HSYNC + LCD_7_HBP - 1); hltdc.Init.AccumulatedVBP = (LCD_7_VSYNC + LCD_7_VBP - 1); hltdc.Init.AccumulatedActiveH = (LCD_7_HEIGHT + LCD_7_VSYNC + LCD_7_VBP - 1); hltdc.Init.AccumulatedActiveW = (LCD_7_WIDTH + LCD_7_HSYNC + LCD_7_HBP - 1); hltdc.Init.TotalHeigh = (LCD_7_HEIGHT + LCD_7_VSYNC + LCD_7_VBP + LCD_7_VFP - 1); hltdc.Init.TotalWidth = (LCD_7_WIDTH + LCD_7_HSYNC + LCD_7_HBP + LCD_7_HFP - 1); /* Initialize the LCD pixel width and pixel height */ hltdc.LayerCfg->ImageWidth = LCD_7_WIDTH; hltdc.LayerCfg->ImageHeight = LCD_7_HEIGHT; /* background value */ hltdc.Init.Backcolor.Blue = 0; hltdc.Init.Backcolor.Green = 0; hltdc.Init.Backcolor.Red = 0; /* Polarity */ hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL; hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL; hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL; hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC; hltdc.Instance = LTDC; HAL_LTDC_Init(&hltdc); HAL_LTDC_ProgramLineEvent(&hltdc, 0); /* Enable dithering */ HAL_LTDC_EnableDither(&hltdc); /* Configure the DMA2D default mode */ hdma2d.Init.Mode = DMA2D_R2M; hdma2d.Init.ColorMode = DMA2D_RGB565; hdma2d.Init.OutputOffset = 0x0;hdma2d.Instance = DMA2D;
if(HAL_DMA2D_Init(&hdma2d) != HAL_OK)
{ while (1); } /* Assert display enable LCD_DISP pin */ HAL_GPIO_WritePin(GPIOI, GPIO_PIN_12, GPIO_PIN_SET);#ifndef BOARD_CNC_R3T
/* Assert backlight LCD_BL_CTRL pin */ HAL_GPIO_WritePin(GPIOK, GPIO_PIN_3, GPIO_PIN_SET); #else /* Assert backlight LCD_BL_CTRL pin */ HAL_GPIO_WritePin(GPIOK, GPIO_PIN_3, GPIO_PIN_RESET); #endif }2018-04-04 06:11 AM
To stop the tearing you will have to adjust the DMA priorities, I would think.
and the bandwidth, hence the question about Sdram being in burst mode.
and making the Flash access low priority and cacheable.
otherwise as suggested,
you may need to upgrade the processor ( that sounds like Bill)
to the new STM32H743, 400MHz
can decode and display 4 MPeg4 channels at 25fps..
at 1% cpu usage.
2018-04-04 10:59 AM
Hi..as per my knowledge you should disable the FMC bank1 if not used, and configure correctly the MPU for the SDRAM.
Please have a look to the AN4861 application note and disable FMC bank1 if not used and configure the memory protection unit.
2018-04-05 03:33 AM
Hi. I has same problem,also use that memory. In my opinion, the reason was a small data bus wight. STemWin library need external buffer for multibufer operation. I could be wrong, library first make picture in buffer, then copy buffer from one region from external memory to other, then that data through dma read to display. And if you store picture in nor flash, you need to read data through same bus, then that data store in temporary buffer, then copied to LTDC buffer and then read to display. And all of this in one 16 bit data line. Try to change SDRAM to 32bit wight data. I use MT48LC4M32B2P , 16 MB enough for LTDC buffer, 2 additional buffers for emWin multibuffer support and you could assign some memory for emWin heap.
pData=(uint32_t*)0xC0E00000;
GUI_ALLOC_AssignMemory(
pData
, GUI_NUMBYTES);Also, I think u could change memory from fmc interface to double data rate quad-spi. It can be mapped to memory, but only for reading. Now I using 1024*600 display and its not flicker. The only disandvantage, draw process in freertos take 86% of mcu time.
2018-04-05 10:10 PM
Thanks
coradias
.Currently in my project:
SDRAMusing bank 5 (0xC0000000).
Norflash using bank 1 (0x60000000).
I'll try to change bank 1 to other bank.After that, disable bank 1.
2018-04-06 04:42 AM
Dear
coradias
.,
DAHMEN.IMEN
, and every body,Currently, i can't disable bank 1, because hardware circuit.
So, my project using bank 1 (0x60000000 - 0x63FFFFFF).
Bank sdram 1 (bank 5): ) 0xC0000000.
I think i have to change circuit for my project or
upgrade the processor to the new STM32H743, 400MHz.Have you any other advise for me?
Thank you so much!
2018-04-06 04:46 AM
Dear you,
Can you tell me detaily, to
configure correctly the MPU for the SDRAM as well
, please?Above is code which i configured MPU, SDRAM.
Thank you.