cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7A3 hardFault with MX_TouchGFX_Init();

LCris.1
Associate II

Hi,

I have one application developed one TouchGFX to run on STM32H7A3 device with a screen of 320*240. I tested all my hardware devices in my board and all of them work well.

When I try to execute MX_TouchGFX_Init() function on main after configure:

-MPU_Config

-NOR flash (images stored on external flash)

-SRAM (for display buffers)

-LTCD and layer configurations

-CRC

-DMA2D

I have one hardfault on Bitmap::registerBitmapDatabase(BitmapDatabase::getInstance(), BitmapDatabase::getInstanceSize());

I made another test, that execute that function MX_TouchGFX_Init() inside one threat, and I get go more forward until get another hardfault when the code try to execute

touchgfx::HAL::getInstance()->setDisplayOrientation(touchgfx::ORIENTATION_PORTRAIT);

What can be the source of my hardFaults or I can solve this problems?

My MPU_Config() is:

static void MPU_Config(void){
  MPU_Region_InitTypeDef MPU_InitStruct;
 
  // /* Disable the MPU */
  HAL_MPU_Disable();
 
  /* Configure the MPU attributes as device for NOR */
  MPU_InitStruct.Enable = MPU_REGION_ENABLE;
  MPU_InitStruct.Number = MPU_REGION_NUMBER0;
  MPU_InitStruct.BaseAddress = 0x64000000;
  MPU_InitStruct.Size = MPU_REGION_SIZE_4MB;
  MPU_InitStruct.SubRegionDisable = 0x00;
  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL1;
  MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
  MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;
  MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
  MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
 
  HAL_MPU_ConfigRegion(&MPU_InitStruct);
 
  MPU_InitStruct.Enable = MPU_REGION_ENABLE;
  MPU_InitStruct.Number = MPU_REGION_NUMBER1;
  MPU_InitStruct.BaseAddress = 0x64000000;
  MPU_InitStruct.Size = MPU_REGION_SIZE_512KB;
  MPU_InitStruct.SubRegionDisable = 0x0;
  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL1;
  MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
  MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
  MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
  MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;
  HAL_MPU_ConfigRegion(&MPU_InitStruct);
 
  /* Enable the MPU */
  HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
}

Best regards,

Luis Cristóvão

3 REPLIES 3
MM..1
Chief II

Hi Luis, im not MPU expert , but first sight two regions with same start addr isnt clean use.

Maybe your trouble is other , try simple test without touchgfx configure LTDC layer to show image stored in region...

>>What can be the source of my hardFaults or I can solve this problems?

A Hard Fault Handler capable of outputting diagnostics should be able to pin-point the failure pretty sharpish..

If the SDRAM, QSPI, FMC aren't initialized and mapping properly any access will fault them.

Identify the instructions that are faulting, and the address they are touching, then focus in on that.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
LCris.1
Associate II

Thanks for your replies,

I solve the problem moved all my project to STM32CubeIDE. Now I only have a new problem with TouchGFX_Process(), don't make nothing :(. My program will stuck in interruptions generated by LTDC module and the TouchGFX never update the buffer.

Best regards,

Luis Cristovao