Skip to main content
HDec
Associate II
April 12, 2020
Question

TouchGFX & STM32CUBEMX integration results in a white LCD screen using STM32H7B3I-DK.

  • April 12, 2020
  • 8 replies
  • 4925 views

Hello,

INFO

1- I currently have a problem with the STM32H7B3I-DK that I recently purchased.

2- I followed a tutorial from ST @ https://www.youtube.com/watch?v=mU5eZ_EXW8c . I'm using the same exact board.

3- TouchGFX rev: 4.13.0

4- STM32CUBEMX rev: 5.6.0

5-STM32CUBEIDE rev: 1.3.0

5- I have attached the whole project file to this post as "DK.rar". This .ioc file was generated via STM32CUBEMX using the Boards Selector filter when creating a new project and searching for the board "STM32H7B3I-DK" . The only thing edited in the .ioc file was similar to what was edited in the youtube video above.

Problem

The Code compiles successfully on STM32CUBEIDE however as soon as I enter debug (which runs successfully too) I get a white screen only on the LCD display. Which is different than what I have in the generated TouchGFX .

**It is important to mention that everything works fine if the application is generated by TouchGFX as a standalone program rather than being integrated with STM32CUBEMX.

Could someone please shed some light on this issue as to what the cause might be?

Thanks in advanced to all your replies !

This topic has been closed for replies.

8 replies

GCosta
Associate II
April 12, 2020

Hi HDec,

(I suppose) you have to define the frame buffer area, try with this configuration (reaplce in you project Cube file and linker script).

Ciao.

HDec
HDecAuthor
Associate II
April 12, 2020

Hi @Community member​ Thanks for your reply! Unfortunately your solution did not work. I tried replacing the .ioc file and the linker files as you suggested. I also used your .ioc file to create a project from scratch, also didn't work. Finally, I tried making the same changes you did with my old project file I attached (DK.rar) and didn't work either.

It is my understanding that choosing an allocated buffer vs defining a buffer address doesn't make a difference since in the end they're reserved a space in the RAM. Do you have further suggestions? Thanks again !

GCosta
Associate II
April 13, 2020

Hi,

I don't know (I never used) your uC (I read only its manual).

By your ioc file you have also an external RAM, in this first step you can use only the internal RAM (to check if the LCD work well).

You have to be sure about LCD hw configuration:

- clock (now it is 96Mhz... is it right?)

- LCD synchronization params (LTDC Parameter Settings)

- ram address for the frame buffer (LTDC layer setting)

If you use as frame buffer the area from 0x24000000 to 0x24000000+480*272*2 (it is the internael RAM) you can check if the LCD controller work fine (disabling TGFX),

it is sufficient to write in this area (writing a simple code) a color code (3 bytes per pixel: 0xFF0000) and see if the LCD views the right color or not. after that you can try to enable TGFX. If you use this area you have to exclude this area from linker script otherwise the linker will use this area for the variables of your firmware (see my linker script).

Alexandre RENOUX
Visitor II
April 14, 2020

Hello,

In TouchGFX Designer, you have an Application Template for the STM32H7B3I-DK board which is compatible with TouchGFX Generator.

You can start from here as everything is correctly set up in this project to work on the spot.

Hope this will help you,

/Alexandre

HDec
HDecAuthor
Associate II
April 14, 2020

Hi @Alexandre RENOUX​ Thanks for your reply.... Yes, everything works well with TouchGFX as a standalone program. However, I would like to integrate TouchGFX with CubeMX. Do you know how to integrate them by having CubeMX as the starting point rather than starting from TouchGFX ?

Please refer to the "**It is Important" section of my question.

Looking forward to your reply.. Thanks!

Alexandre RENOUX
Visitor II
April 15, 2020

Hello,

I downloaded your project and I can see that the linker file STM32H7B3LIHXQ_FLASH.ld is not updated. In your case, CubeIDE does not know where is the external Flash so it cannot put anything in it when building.

A part of your .ld file:

MEMORY
{
 DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
 ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
 RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 1024K
 FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K
}

A part of the correct .ld file available in the AT in Designer :

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
}

You can see an OctoSPI Flash of 64M is declared in the correct one.

Replace your linker file by the enclosed one (which is the one from the AT).

We provide ATs to help people having a working project right at the start and as a reference. So that if you want something customized you can already start from a working and clean project with many parameters you can look through.

Creating an AT from scratch is very long and difficult and it depends on the board so I do not recommend this approach especially if it is a board that we support. The AT v3.0.0 work with CubeMX so I do not understand why you try to do it this way. Could you provide your reason ?

Hope this will help you,

/Alexandre

HDec
HDecAuthor
Associate II
April 15, 2020

Hi @Alexandre RENOUX​ ,

I did do this exactly. I compiled a standalone TouchGFX project, copied the linker file (ld) and did exactly what you described. It still does NOT work.

Linker File Differences

The difference between the linker file generated between TouchGFX and the CubeMX is actually further than what you described. The differences are :

1- Memory Section as you described above

2- A FramebufferSection added at the end of the linker file generated by TouchGFX, i copied that code below

 
 FramebufferSection :
 {
 *(TouchGFX_Framebuffer TouchGFX_Framebuffer.*)
 *(.gnu.linkonce.r.*)
 . = ALIGN(0x4);
 } >RAMFB
 
 FontFlashSection :
 {
 *(FontFlashSection FontFlashSection.*)
 *(.gnu.linkonce.r.*)
 . = ALIGN(0x4);
 } >OSPI
 
 TextFlashSection :
 {
 *(TextFlashSection TextFlashSection.*)
 *(.gnu.linkonce.r.*)
 . = ALIGN(0x4);
 } >OSPI
 ExtFlashSection :
 {
 *(ExtFlashSection ExtFlashSection.*)
 *(.gnu.linkonce.r.*)
 . = ALIGN(0x4);
 } >OSPI

What I have done

1- I copied the linker file generated by TouchGFX and replaced the one generated by CubeMX and simply compiled

The result: Successful compilation but error when clicking debug, See photo below. The error goes away when the linker file is returned to the original generated by CubeMX

0693W000000VpYkQAK.png

2- I simply replaced the memory lines as you described above in the linker file generated by CubeMX and same error above happened.

3-I replaced all the main file generated by TouchGFX with the main file generated by CubeMx and lots of errors showed up

4- I tried to fix all the errors in step 3 one by one such as replacing core files, library files and driver files and the errors got worse.

I tried everything rational I could do but nothing worked. Thanks for your feedback though, do you have other thoughts? It would be nice if you could have access to the actual board so that you can see that nothing works as advertised.

Looking forwards & Thanks for your help again :)

Alexandre RENOUX
Visitor II
April 15, 2020

Hello,

Can you try commenting FramebufferSection, FontFlashSection and TextFlashSection and tell me the error it throws ?

Unfortunately, I don't have the board with me, but I will see if I can find one. In the meantime, I'll try to have a look without debug.

What's very important to notice is that it works if you only use TouchGFX Designer and then it does not work if you use CubeIDE. It might also be due to the .launch file that is created when you make your debug configuration (just an idea).

/Alexandre

Alexandre RENOUX
Visitor II
April 15, 2020

And please can you tell me the goal of your project ? Why not using the AT ? I am still a bit lost on this side.

/Alexandre

HDec
HDecAuthor
Associate II
April 15, 2020

@Alexandre RENOUX​  I commented the FramebufferSection, FontFlashSection and TextFlashSection, all together and individually and it didn't get past compilation. I got this error:

arm-none-eabi-g++ -o "PRO.elf" @"objects.list" -l:libtouchgfx-float-abi-hard.a -mcpu=cortex-m7 -T"A:\Projects\STM32H\Playfield\G8-CUBEMX GENERATED\Content\PRO\STM32H7B3LIHXQ_FLASH.ld" --specs=nosys.specs -Wl,-Map="PRO.map" -Wl,--gc-sections -static -L"A:\Projects\STM32H\Playfield\G8-CUBEMX GENERATED\Content\PRO\Middlewares\ST\touchgfx\lib\core\cortex_m7\gcc" --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group
c:\st\stm32cubeide_1.3.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.0.0.201904181610\tools\arm-none-eabi\bin\ld.exe: PRO.elf section `TouchGFX_Framebuffer' will not fit in region `RAM'
c:\st\stm32cubeide_1.3.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.0.0.201904181610\tools\arm-none-eabi\bin\ld.exe: region `RAM' overflowed by 551856 bytes
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:77: PRO.elf] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.

The reason I'm not using the AT is because I get errors when I try to compile after generating code from the generated cubeMX. Here is the process I used to answer your question on why I'm not using AT.

1- I open TouchGFX, select the STM32H3I-DK board, generate the code, then run on target and everything works well.

2- I open the generated STM32CubeIDE , compile and debug everything works wells !

3- I open the generated .ioc file , select a GPIO pin to blink an LED, and generate the code.

4-Refresh STM32CubeIDE , compile and never ending errors.

So I followed the youtube tutorial https://www.youtube.com/watch?v=mU5eZ_EXW8c and it got me pretty close with no errors but just a white screen.

Hope this answers your question.

Thanks!

Alexandre RENOUX
Visitor II
April 15, 2020

Hi,

Ok the RAM seems overflowed because the internal RAM is too tiny to have the framebuffer inside. So the FramebufferSection is mandatory.

******

I am glad you explained the process you used.

When you change the .ioc file and regenerate in CubeMX, you HAVE TO regenerate code from TouchGFX Designer as well before rebuilding your project otherwise you can get errors as you noticed.

Also something that can help is clean the project and perform a fresh new build.

Please try that using the AT and tell me if it works (but it should). If not, send me the error as you did perfectly in your previous post.

/Alexandre

JMoel.1
Visitor II
March 12, 2021

Hello,

I had the same problem. It worked as long, as I flashed with TouchGFX Designer. When I flashed with STM32CubeIDE it showed a white screen.

Solution: Press the Reset Button or reset in debug mode.

It looks like the board needs an restart after flashing and the TouchGFX Designer resets after flashing. Cube IDE does not.

Hope it helps someone.