2017-11-20 06:39 PM
I am working on a project based of stm32f746G EVAL board. It uses LCD controller with frame buffer in SDRAM, internal flash for code, external flash to store fonts and media, and external SRAM for RW+ZI data.
Finally got it to run after migrating RW & ZI to external SRAM, but have a whole lot of problems.
As ZI data increases, over 600kB or so LCD starts flickering and windows with images show images all corrupted.
RW+ZI is linked to 0x68000000
I defined DATA_IN_ExtSRAM in 'system_stm32f7xx.c' and used startup.s file from SRAM _DATA_MEMORY example which intializes ext SRAM using temporary stack pointer to internal SRAM.
Here is what i have for MPU configs:
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.BaseAddress = 0x68000000; MPU_InitStruct.Size = MPU_REGION_SIZE_256KB; MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS; MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE; MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE; MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE; MPU_InitStruct.Number = MPU_REGION_NUMBER0; MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0; MPU_InitStruct.SubRegionDisable = 0x00; MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;HAL_MPU_ConfigRegion(&MPU_InitStruct);
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.BaseAddress = 0x60000000; MPU_InitStruct.Size = MPU_REGION_SIZE_16MB; MPU_InitStruct.AccessPermission = MPU_REGION_PRIV_RO; MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE; MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE; MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE; MPU_InitStruct.Number = MPU_REGION_NUMBER2; MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0; MPU_InitStruct.SubRegionDisable = 0x00;MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;HAL_MPU_ConfigRegion(&MPU_InitStruct);
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.BaseAddress = 0xC0000000; MPU_InitStruct.Size = MPU_REGION_SIZE_32MB; MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS; MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE; MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE; MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE; MPU_InitStruct.Number = MPU_REGION_NUMBER3; MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL1; MPU_InitStruct.SubRegionDisable = 0x00; MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;HAL_MPU_ConfigRegion(&MPU_InitStruct);
Fort the 1st region, I could not set
MPU_InitStruct.Size to anything larger than 2
56KB as BSP_SRAM_Init() fails if I do so which is really weird.
Disabling MPU causes LCD flickering and image corruption regardless of code/RW/ZI size.
And I also have RESET issues when after few resets, it will not respond anymore, never goes to main, (stuck at BX R0 line) and the only way to revive my board is to power cycle
None of the problems exist if RW+ZI placed inside of internal SRAM at 0x20000000
2017-11-21 08:20 PM
Most of the issues with LCD were due-to FIFO underrun. As the same bus is used for both frame buffer access and data in SRAM, moving RW/ZI to SRAM reduced the bus throughput and bottlenecked LTDC FIFO. Disabling DMA2d and going from 32 to 16 bit color depth got rid of underrun and consequently solved flickering and image distortion issues.
However reset issue is still there. Changing regions B/C/S flags makes thins better or worse, but never resolves the issue completely. Something very weird is still going