Skip to main content
ETale.1
Associate II
November 18, 2020
Question

Using touchgfx without external RAM

  • November 18, 2020
  • 8 replies
  • 6375 views

I designed a GUI on stm32f746 discovery board and programmed the board successfully and GUI worked perfectly, now I want to redesign the GUI and my programm to be able to use a custom board which doesn't have an external RAM

at first I disabled the MX_FMC_Init fuction but the display is black and nothing shows up, then I read the article below and followed the instruction but display went black again.

I'm a beginner and I would be very gratefull if anyone guides me how to config the CubeMX and touchgfx to work without external RAM.

https://support.touchgfx.com/docs/development/board-bring-up/how-to/03-display-internal

This topic has been closed for replies.

8 replies

Romain DIELEMAN
ST Employee
November 18, 2020

Hi,

Could you maybe share your CubeMX project or screenshots of your configuration (unless confidential)?

First just to check, you put the framebuffer in internal RAM but do you have enough RAM for it ? A framebuffer size is Height * Width * bpp. Depending on your configuration you might be using 2 framebuffers + annimation storage (so in total for that example, it is 3 framebuufers). And be careful as you also need some storage for the TouchGFX framezork and memory for the "heaviest" screen of your GUI.

The number of framebuffer you wish to use can be modified in CubeMX in the X-CUBE-TouchGFX configuraqtion in the framebuffer strategy config.If you already all this then sorry :grinning_face_with_sweat:.

What you can do as well is look at the H7B3 disco board. If i am not mistaken it also does not use external RAM, so have a look at its application template and CubeMX config.

/Romain

ETale.1
ETale.1Author
Associate II
November 18, 2020

Hi,

first of all than you for your response.

the .ioc cubeMX file is attached,

Im using f7 discovery witch uses 480*272 LCD so I need 480*272*16bit/8 = 261120 bytes space and stm32f746NG has got 320kbytes of internal RAM space, configuration is set on 1 framebuffer and the test gui is a simple background so i thaught it wont cause any problem to use this method but all i get is a black screen.

I'm e beginner maybe Im mistaken in storage calculation and I'm not considering something.

the cubeMx configuration screenshots are:0693W000005BoXvQAK.png0693W000005BoY5QAK.png0693W000005BoYAQA0.png0693W000005BoXqQAK.png

Romain DIELEMAN
ST Employee
November 18, 2020

Out of curiosity, why do you put the start address at 0xC0000000 in the last screenshot? When I opened the ioc project you shared, it automatically sets it to 0x20020000. The configuration overall seems ok at first glance, I compared it to the F746G disco AT and the H7b3 disco AT we provide in Designer. The only thing that surprises me yeah is that you set the color frame buffer start address at 0x20010000 and then the start address for the "touchgfx" framebuffer at 0xc0000000

Could you test it real quick if that makes sense?

Romain DIELEMAN
ST Employee
November 18, 2020

In a normal STM32F746G disco board it is the SDRAM configured in FMC that is mapped at 0xC000000 . Are you using a custom hardware or you just modified the generated AT for the F746G disco?

ETale.1
ETale.1Author
Associate II
November 21, 2020

sorry I gave you the old one, in the last configuration I set the address to 0x20000000 but the compiler said that framebuffer there is about 7016 bytes out of range, then i checked the documentation of the mcu and found out somthing about 250 kbytes of internal RAM is accessible so I think theres no way I can procced this way, the only thing that surprises me is the thing I read in touchgfx webpage witch said that it is possible to run a 480x272 TFT with internal RAM of this MCU

Errors:

STM32F746G_DISCO.elf section `.bss' will not fit in region `RAM'

 region `RAM' overflowed by 7016 bytes

Link:

https://www.touchgfx.com/news/high-quality-graphics-using-only-internal-memory/

Romain DIELEMAN
ST Employee
November 18, 2020

I'm also not 100% sure that those 320kbytes of internal RAM are really accessible, maybe only a portion of it is

MM..1
Chief III
November 21, 2020

For internal ram you cannot use direct address for framebuffer (maybe yes but then you need edit linker scripts...). Compiler need manage RAM and too framebuffer.

Then you need in code create array for it and use his pointer in config.

example

uint8_t framebuffer[480x272*2];

then change in ioc By Address to other settings...

And yes you need continuos RAM then here you is over limit , but still exist way to use some workarounds, as first you can dont use full screen and make some border on display, that reduce RAM needed. Example 400x200

Second way is use CLUT , but this isnt supported in TouchGFX, then you need make GUI...

Third as you say is use other framebuffer type, with one byte per pixel, Touch GFX support many options for it ... need manual config

ETale.1
ETale.1Author
Associate II
November 21, 2020

thanks for your response but I tried this method earlier based on the instruction given in this link : https://support.touchgfx.com/docs/development/board-bring-up/how-to/03-display-internal\

the same as you said but It is not working too, this time the compiler says: "region `RAM' overflowed by 268136 bytes"

ETale.1
ETale.1Author
Associate II
November 21, 2020

I did as you instructed the 480*260 framebuffer size was Ok but the display showed nothing, should I do another things in addition to this partial frame buffer?

MM..1
Chief III
November 21, 2020

Not now maybe later you need change ltdc window definition , but showed nothing is bad result. How you create your project?

When you test this on devkit board , good is start with real functional example and then change to internall ram .

MM..1
Chief III
November 21, 2020

Or maybe any memory overflow addressing exist , then you change now 272 to 260 on ltdc_1 and 2 window config and too on touchgfx size automatic change

VChan.2
Associate
May 24, 2021

Hi @ETale.1​ 

May be it is now too late to post an answer

I was also looking to use Touchgfx without external RAM as my application has very minimal graphics. This post helped me a lot to poke at the right places

Here is what I did

  • Open Cube MX configurator
  • Change to single buffer and by allocation

  • This would update TouchGFXGeneratedHAL.cpp as described in here Framebuffer Strategies | TouchGFX Documentation
  • What they dont post is that there is another file TouchGFXHAL.cpp which is not generated and overrides whatever was changed in the base TouchGFXGeneratedHAL class
  • So, we need to comment out the following two lines in the TouchGFXHAL.cpp file below
void TouchGFXHAL::initialize()
{
 // Calling parent implementation of initialize().
 //
 // To overwrite the generated implementation, omit call to parent function
 // and implemented needed functionality here.
 // Please note, HAL::initialize() must be called to initialize the framework.
 
 TouchGFXGeneratedHAL::initialize();
// Commented out
 // setFrameBufferStartAddresses((void*)0xC0000000, (void*)0xC003FC00, (void*)0xC007F800); //enable the animation storage to allow slide animations
 // lockDMAToFrontPorch(false);
 instrumentation.init();
 setMCUInstrumentation(&instrumentation);
 enableMCULoadCalculation(true);
}

  • Now, you have to modify the linker files and create a section named 'TouchGFX_Framebuffer' which is the name used by the code generator
  • Modify STM32F746NGHX_RAM.ld
MEMORY
{
 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
 // frame buffer is 255k long in my case
 RAM_FRAME_BUFFER (xrw) : ORIGIN = 0x20001000, LENGTH = 256K
 FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
}
 
// add at the end
 /*Added for frame buffer */
 .TouchGFX_Framebuffer : {
 __TouchGFX_Framebuffer_start = .;
 KEEP(*(.TouchGFX_Framebuffer))
 __TouchGFX_Framebuffer_end = .;
 } > RAM_FRAME_BUFFER
  • Clean and build

Thanks,

Vimal

Romain DIELEMAN
ST Employee
May 25, 2021

Hi,

Could you maybe add in the "Idea zone" of this forum the demand of improvement of this article ? It makes sense to put a reminder that due to the hierarchy of the code the generated files can be overwritten by the user in the relevant files.

/Romain

BParh.1
Senior III
May 25, 2021

I am interested as well to know this. Would choosing partial framebuffer help in this case?

https://support.touchgfx.com/docs/development/scenarios/lowering-memory-usage-with-partial-framebuffer

MM..1
Chief III
May 25, 2021

0693W00000AMRWmQAP.jpgPartial is usable only when LCD have own memory framebuffer. And too partial cant use acceleration. And one example of custom 1280x480 LTDC layer 0 image in flash, 1024x320 layer 1 320kB (internal ram) TouchGFX framebuffer with alpha 150.