2025-07-22 3:30 AM
Hi everyone!
I am using TouchGFX for STM32H7 and I am using external RAM with 32MB size (start address 0xC0000000).
I enabled LTDC and both TouchGFX(double buffer 0xC0000000, 0xC00EA600) and LTDC(0xC0200000) are using my external RAM and everything works fine (LCD resolution: 600*800).
Now I have to use some dynamic bitmaps for the project and use them in runtime.
according to some tutorials and ST itself I use made them like this :
FrontendApplication.cpp (extract)
#include <gui/common/FrontendApplication.hpp>
#include <touchgfx/Bitmap.hpp>
FrontendApplication::FrontendApplication(Model& m, FrontendHeap& heap)
: FrontendApplicationBase(m, heap)
{
uint16_t* const cacheStartAddr = (uint16_t*)0xC0400000;
const uint32_t cacheSize = 0x200000; //2 MB, as example
Bitmap::setCache(cacheStartAddr, cacheSize, 4);
}
and wanted to use 2 dynamic bitmaps like this:
void Screen1View::setupScreen()
{
Screen1ViewBase::setupScreen();
BitmapId bmpId;
BitmapId bmpId2;
uint16_t* const bitmapPixels;
uint16_t* const bitmapPixels;
bmpId = Bitmap::dynamicBitmapCreate(183, 410, Bitmap::RGB565);
if (bmpId != BITMAP_INVALID)
{
bitmapPixels = (uint16_t*)Bitmap::dynamicBitmapGetAddress(bmpId);
}
bmpId2 = Bitmap::dynamicBitmapCreate(183, 410, Bitmap::RGB565);
if (bmpId2 != BITMAP_INVALID)
{
bitmapPixels2 = (uint16_t*)Bitmap::dynamicBitmapGetAddress(bmpId2);
}
}
the problem is with the second creation of dynamic bitmap. When I create just one bitmap with the same cache configurations and properties everything is ok, but as I create the 2nd dynamic bitmap micro goes to hard fault.
I checked some Q&As and nothing seems wrong.
Thank you in advance for all your support.
Regards,
Ali
2025-07-22 3:33 AM
edited code:
uint16_t* const bitmapPixels;
uint16_t* const bitmapPixels2;