2025-07-07 12:31 AM
Hello
Project based on stm32u5g9 where I enabled TouchGfx in CubeMx settings. Layer 0 is configured to 800x600. I generate code from CubeMx. GPU2D and DMA2D are enabled and configured from CubeMx.
With TouchGfx Designer, I open the ApplicationTemplate.touchgfx.part generated or my ProjectName.touchgfx project, I see that screen dimensions are 800x480, I think it should be 800x600.
In TouchGfxDesigner, I add a screen and a box inside the screen, nothing more.
I generate code from TouchGfxDesigner.
In CubeIde, the only generated or added library I can see is :libtouchgfx-float-abi-hard.a.
I have other project generated by myself though directly from TouchGfxDesigner, chosing a STM32U5G9J-DK2 800x480 kit. Here I can see :libnemagfx-float-abi-hard.a and :libtouchgfxnema-float-abi-hard.a are included in CubeIde project.
In my code, I am trying to draw a scaled line, using ScalableImage, BitmapId, creating a dynamicBitmap.
Indeed the line is scaled and displayed in my display.
However the rendering time is very long, around 300 msec. I have defined RENDER_TIME_Pin, I can see the rendering time in oscilloscope.
Any help would be appreciated.
Regards.
// FrontEndApplication.cpp
static uint8_t dynamicBitmapCache[InstaScreenNamespace::kBaseWidth * InstaScreenNamespace::kBaseHeigth + 256U];
FrontendApplication::FrontendApplication(Model& m, FrontendHeap& heap)
: FrontendApplicationBase(m, heap)
{
Bitmap::setCache((uint16_t*)dynamicBitmapCache, sizeof(dynamicBitmapCache), 1U);
}
// InstaScreenView.hpp
class InstaScreenView : public InstaScreenViewBase
{
touchgfx::ScalableImage scalableImageDynamic;
BitmapId dynamicBitmapId;
uint32_t initialcounter;
int _line;
int _line_1;
int tickCounter;
void fillDynBitMapbuffer(void);
public:
InstaScreenView();
virtual ~InstaScreenView() {}
virtual void setupScreen();
virtual void tearDownScreen();
void handleTickEvent() override;
protected:
};
// InstaScreenView.cpp
extern "C" {extern uint8_t camera_touchgfx_started_fg;}
InstaScreenView::InstaScreenView():
initialcounter(0),
_line(0),
_line_1(InstaScreenNamespace::kBaseHeigth-1),
tickCounter(0){}
void InstaScreenView::setupScreen()
{
dynamicBitmapId = Bitmap::dynamicBitmapCreate(InstaScreenNamespace::kBaseWidth, InstaScreenNamespace::kBaseHeigth,
Bitmap::BitmapFormat::ABGR2222);
if (dynamicBitmapId != BITMAP_INVALID){
fillDynBitMapbuffer();
scalableImageDynamic.setBitmap(Bitmap(dynamicBitmapId));
scalableImageDynamic.setPosition(0, 0, InstaScreenNamespace::kScaledWidth, InstaScreenNamespace::kScaledHeigth);
scalableImageDynamic.setScalingAlgorithm(InstaScreenNamespace::kScalingAlgorithm);
scalableImageDynamic.setVisible(true);
add(scalableImageDynamic);
}
InstaScreenViewBase::setupScreen();
}
void InstaScreenView::tearDownScreen()
{
Bitmap::clearCache();
InstaScreenViewBase::tearDownScreen();
}
void InstaScreenView::handleTickEvent(){
if(initialcounter < 120){
initialcounter++;
if(initialcounter >= 120){
camera_touchgfx_started_fg = 1;
}
}
tickCounter++;
if (tickCounter % 2 == 0){ // Every 33 ms (2 ticks 60Hz)
if (dynamicBitmapId != BITMAP_INVALID){
fillDynBitMapbuffer();
scalableImageDynamic.invalidate();
}
}
}
void InstaScreenView::fillDynBitMapbuffer(void){
uint8_t* dstData = Bitmap::dynamicBitmapGetAddress(dynamicBitmapId);
if (dstData)
{
Bitmap myLocalDynamicBitmap(dynamicBitmapId);
int16_t columnNumber = myLocalDynamicBitmap.getWidth();
int16_t lineNumber = myLocalDynamicBitmap.getHeight();
int line;
// Erase previous line
line = _line_1;
for(int16_t column = 0U; column < columnNumber; column++){
uint32_t j = column + line * columnNumber;
dstData[j] = 0x00;
}
// draw current line
line = _line;
for(int16_t column = 0U; column < columnNumber; column++){
uint32_t j = column + line * columnNumber;
dstData[j] = 0x80;
}
// Inc++ de la linea
_line_1 = _line;
_line++;
_line %= lineNumber;
}
}
2025-07-07 2:06 AM
Hello @rvminsta_01,
Can you provide the ioc file ?
BR,
2025-07-07 2:37 AM