cancel
Showing results for 
Search instead for 
Did you mean: 

Problem using QSPI with STM32F746 and TouchGFX

Charles Blanchard
Associate III

Hello!

I repost my question here as I posted it in an answer yesterday and it didnt get effective.

Thank to hansd empty project I manage to begin my project and conceive my GUI:

https://community.st.com/s/question/0D50X0000AntXX2SQM/simpliest-ide-to-configure-with-touchgfx-and-stm32cubemx

It seems that using the integrated or standalone CubeMX doesn't mess up the project. Also, I succedeed in importing the project under AtollicTrueSTUDIO in order to see the difference between the IDEs.

I followed hands56​'s link in order to configure the QSPI:

https://touchgfx.zendesk.com/hc/en-us/articles/360019884752-Configuring-STM32F746G-DISCO

I followed as well this tuto to configure the linker under CubeIDE (I think that is it the same as AtollicTrueSTUDIO):

https://community.st.com/s/question/0D50X0000AIeS5CSQV/stm32cubemx-touchgfx-atollic-how-to-setup-the-qspi-external-flash-

All is building perfectly and when I look at the Build Analyzer, I can see the ExtFlashSection and my assets under QUADSPI, all seems in order:

0690X000008BgXXQA0.png

The problem is, when I launch the debug, it seems that the flash is not programmed and my screen print this instead of my beautiful picture :(

0690X000008Bf53QAC.jpg

Of course, I tried to use internal flash, and everything works, my picture is well displayed.

Do you have any idea of the source of my problem?

Thank you,

Charles

14 REPLIES 14
BPark.3
Associate II

Hi Charles,

Yes exactly, a reboot stops the images working..

Ben

HP
Senior III

Hey guys,

I don't know if you have read my endeavors in the other thread about getting QSPI flash to work but I think I got it working outside debug as well now 🙂

Maybe you can give it a go and see if it helps?

I'm running my application from cubeIDE so that's a prerequisite.

You will need to do the following:

  1. launch TouchGFX designer and load an application template.
  2. Generate the code and go the the folder where the sources are located.
  3. From the folder Driver-> BSP-> STM32746G-Discovery copy the qspi files - there should be 2, a 'c' and a 'h' file (code and header)
  4. paste the files into your project, preferably into the directory 'STM32746G-Discovery' which you might have in your project root.
  5. Add the following include to the top of your main.cpp file:
#include <stm32746g_discovery_qspi.h>
  1. (6.) change your MX_QUADSPI_Init to this:
hqspi.Instance = QUADSPI;
    hqspi.Init.ClockPrescaler = 1;
    hqspi.Init.FifoThreshold = 4;
    hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_HALFCYCLE;
    hqspi.Init.FlashSize = 24;
    hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_6_CYCLE;
    hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
    hqspi.Init.FlashID = QSPI_FLASH_ID_1;
    hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE;
 
 
  if (HAL_QSPI_Init(&hqspi) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN QUADSPI_Init 2 */
  BSP_QSPI_Init();
 
      BSP_QSPI_MemoryMappedMode();
      HAL_NVIC_DisableIRQ(QUADSPI_IRQn);
 
      MPU_Region_InitTypeDef MPU_InitStruct;
      MPU_InitStruct.Enable = MPU_REGION_ENABLE;
      MPU_InitStruct.BaseAddress = 0x90000000;
      MPU_InitStruct.Size = MPU_REGION_SIZE_256MB;
      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_NUMBER2;
      MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
      MPU_InitStruct.SubRegionDisable = 0x00;
      MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
 
      HAL_MPU_ConfigRegion(&MPU_InitStruct);
 
      /* Configure the MPU attributes as WT for QSPI (used 16Mbytes) */
      MPU_InitStruct.Enable = MPU_REGION_ENABLE;
      MPU_InitStruct.BaseAddress = 0x90000000;
      MPU_InitStruct.Size = MPU_REGION_SIZE_16MB; /* NOTE! Change this if you change QSPI flash size! */
      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_NUMBER3;
      MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
      MPU_InitStruct.SubRegionDisable = 0x00;
      MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
 
      HAL_MPU_ConfigRegion(&MPU_InitStruct);
      HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);

The code should be able to compile and debug. Try unplugging the board and plugging it back in. Does it work now?

Vladislav Leschenk
Associate II

0690X00000DA3ZBQA1.pngHi there! Is somebody have the issue with external memory programming? I nave not issue when i try to run code from TouchGFX designer, but the same code do not work from CubeIDE. And one more strange thing .bin file from CubeIDE have size more than 2GB!!! Debug have been failed every time in stage external flash programming with output: 

(Read)Failed determine breakpoint type

Error! Failed to read target status 

Debugger connection lost.

Shutting down...

I have found only one way to debug - to add files from GFX folder to debug settings. First add external flash file than internal. It works for me...

Do someone have any ideas?

I'm pretty sure that this could be related to the issue mentioned in the bottom of the post: https://community.st.com/s/question/0D50X0000C0y1AqSQI/fix-stm32f746gdisco-v30-touchgfx-application-template-cubeide

@Martin KJELDSEN​ Sorry for bringing this to you - have you heard any news from the Cube Team on this issue?

Many Thanks for that!!!!

Looks like this is the same issue.

 I'll follow this topic.

Additionally i would up some extra topics.

I faced with number of issues that TouchGFX generate two files:

a) 

1)intflash.elf

2)target.elf

But CubeIDE generate one *.elf that have size less then sum of those two, and one BIG *.bin file. (look at the picture above)

b)

I find a tri�?k to run it in debug, but it is annoying - very slow to upload with any types of ICD (J-Ling-mode and native STlink)

0690X00000DA5BfQAL.jpg 0690X00000DA5D2QAL.jpg

c)

Third thing is that if I add any code from CubeMX generator, f.ex. LWIP it stop to build simulator and target from TouchGFX designer.

It looks like they use different make files.

Will be great to post some HOW TO instructions when I could to add my makefile for add extra new source to build with TouchGFX designer?

Thanks for all!