cancel
Showing results for 
Search instead for 
Did you mean: 

SDMMC FATFS and TouchGfx Memory Issues

EthanMankins
Senior

I am using the STM32H7B3I-DK and trying to read and write from an SD card using SDMMC1 with TouchGFX running (also FreeRTOS). I have solved a NO_FILESYSTEM ERROR described here. While this allowed me to mount, open, and write to a file, I still get NO_FILESYSTEM  Error on reads from the card. 

Additionally I have noticed the following line is a defining line that allows the SDCARD to mount, open, and write; however, it also leads to my display flickering in many areas when updating.

  MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;

Can someone help me understand what may be going on here regarding the read Error and how the MPU settings are causing the flicker?

 

 

 The following is my MPU Code and regions defined in linker file:

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 = 0x90000000;
  MPU_InitStruct.Size = MPU_REGION_SIZE_256MB;
  MPU_InitStruct.SubRegionDisable = 0x0;
  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
  MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS;
  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
  MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
  MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
  MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_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.Size = MPU_REGION_SIZE_64MB;
  MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
  MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;

  HAL_MPU_ConfigRegion(&MPU_InitStruct);

  /** Initializes and configures the Region and the memory to be protected
  */
  MPU_InitStruct.Number = MPU_REGION_NUMBER2;
  MPU_InitStruct.BaseAddress = 0x24000000;
  MPU_InitStruct.Size = MPU_REGION_SIZE_1MB;

  HAL_MPU_ConfigRegion(&MPU_InitStruct);

  /** Initializes and configures the Region and the memory to be protected
  */
  MPU_InitStruct.Number = MPU_REGION_NUMBER3;
  MPU_InitStruct.Size = MPU_REGION_SIZE_256KB;
  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
  MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
  MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;

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

}

//Linker File
MEMORY
{
  DTCMRAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = 128K
  ITCMRAM    (xrw)    : ORIGIN = 0x00000000,   LENGTH = 64K
  RAM        (xrw)    : ORIGIN = 0x24000000,   LENGTH = 256K
  RAMFB      (xrw)    : ORIGIN = 0x24040000,   LENGTH = 768K
  FLASH      (rx)     : ORIGIN = 0x08000000,   LENGTH = 2048K
  OSPI	     (xrw)    : ORIGIN = 0x90000000,   LENGTH = 64M
  SDRAM      (xrw)    : ORIGIN = 0xD0000000,   LENGTH = 8M
}

 

Thank you!

0 REPLIES 0