cancel
Showing results for 
Search instead for 
Did you mean: 

FMC + LCD STM32H7S7L8 issue

Hamady
Associate III

Hello,

I'm working on a custom STM32H7S7L8 board with this display 

https://newhavendisplay.com/fr/2-4-tft-lcd-ips-high-brightness-display/
Here the schematic of the connection in 8 bit mode and clock three 

Hamady_0-1763028731446.png

Hamady_1-1763028880560.png

The backlight and display are working but I get a glitch image when i try to fill the display. 

Hamady_2-1763028964282.jpeg

with this code i can see the display turning off and on so the command are working 
Below the whole project zip 

	  LCD_Fill(0xFFFF, 0, 0, 10, 10);
	  HAL_Delay(1000);
	  ST7789H2_DisplayOff();
	  LCD_Fill(0xFFFF, 0, 0, 10, 10);
	  HAL_Delay(1000);
	  ST7789H2_DisplayOn();


Does someone have a idea to make this work 


Thanks 

9 REPLIES 9
mƎALLEm
ST Employee

Hello,

Did you modify this line in MPU config or it was generated by CubeMx:

  MPU_InitStruct.SubRegionDisable = 0x0;

 Normally it should be 0x87 not 0x0!

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
mƎALLEm
ST Employee

Also these lines?:

  MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Hamady
Associate III

@mƎALLEm Thanks for the response 
It was generated by cube MX to test if the issue was MPU usage but even without the MPU it doesn't work 

Hamady_0-1763036063526.png

 

Did you change the default MPU config in CubeMx?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Hamady
Associate III

Yeah i made the test without MPU and after enabled MPU that give permsission to the whole chip

You should not modify that MPU region, keep it as is.

You need to add another MPU config for the LCD region and you should disable the cacheability for that region. You need also to enable the cache.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

@mƎALLEm 

 

thanks for the response 

I've done it like this but nothing has changed 

static void MPU_Config(void)
{
  MPU_Region_InitTypeDef MPU_InitStruct = {0};

  /* Disables the MPU */
  HAL_MPU_Disable();

  /** Initializes and configures the Region and the memory to be protected
  */
  MPU_InitStruct.Enable = MPU_REGION_ENABLE;
  MPU_InitStruct.Number = MPU_REGION_NUMBER0;
  MPU_InitStruct.BaseAddress = 0x0;
  MPU_InitStruct.Size = MPU_REGION_SIZE_4GB;
  MPU_InitStruct.SubRegionDisable = 0x0;
  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
  MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
  MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
  MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
  MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;

  HAL_MPU_ConfigRegion(&MPU_InitStruct);

  /** Initializes and configures the Region and the memory to be protected
  */
  MPU_InitStruct.Number = MPU_REGION_NUMBER1;
  MPU_InitStruct.BaseAddress = 0x60000000;
  MPU_InitStruct.Size = MPU_REGION_SIZE_128KB;
  MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;

  HAL_MPU_ConfigRegion(&MPU_InitStruct);
  /* Enables the MPU */
  HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);

}

I'm not telling that I'm giving a solution to your original problem but the MPU config you set is not recommended as you are opening all the access and the instruction execution and the cachability to all the 4G mapping that induce to many issues:

  MPU_InitStruct.BaseAddress = 0x0;
  MPU_InitStruct.Size = MPU_REGION_SIZE_4GB;
  MPU_InitStruct.SubRegionDisable = 0x0;

So what I suggest is to keep the default MPU region 0 as is (like proposed by CubeMx at first time) and add another region dedicated for the LCD. This is the default MPU config. Only region 0 is configured:

  MPU_InitStruct.Enable = MPU_REGION_ENABLE;
  MPU_InitStruct.BaseAddress = 0x00;
  MPU_InitStruct.Size = MPU_REGION_SIZE_4GB;
  MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS;
  MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
  MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
  MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
  MPU_InitStruct.Number = MPU_REGION_NUMBER0;
  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
  MPU_InitStruct.SubRegionDisable = 0x87;
  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;

  HAL_MPU_ConfigRegion(&MPU_InitStruct);

Then you need to add another region (region 1 ) for the LCD:

  MPU_InitStruct.Number = MPU_REGION_NUMBER1;
  MPU_InitStruct.Enable = MPU_REGION_ENABLE;
  MPU_InitStruct.BaseAddress = 0x60000000;
  MPU_InitStruct.Size = MPU_REGION_SIZE_128KB;
  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_SHAREABLE;
  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
  MPU_InitStruct.SubRegionDisable = 0x0;
  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;

  HAL_MPU_ConfigRegion(&MPU_InitStruct);

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Hamady
Associate III

Okay I understand it,

So i changed as you said 

Thanks !