2024-04-26 06:14 AM
Good day,
I'm rather new with TouchGFX and hope someone might be able to help me.
I've got the STM32U5A9J-DK, and I'm trying to use the slide transition between screens, I've been trying to read around and I've seen that I need to use the 'setFrameBufferStartAddresses(void* frameBuffer, void* doubleBuffer, void* animationStorage)' function in TouchGFXHAL.cpp file.
In the STM32CubeMX file, X-Cube-TouchGFX the frame buffer strategy is set to Double Buffer, and the buffer location is set to 'By Allocation'.
In TouchGFXHAL.cpp I did
void TouchGFXHAL::initialize()
{
TouchGFXGeneratedHAL::initialize();
// What I added!
TouchGFXHAL::setFrameBufferStartAddresses(frameBuffer0, frameBuffer1, frameBuffer2);
setAnimationStorage(frameBuffer2);
setButtonController(&btnctrl);
lockDMAToFrontPorch(false);
instrumentation.init();
setMCUInstrumentation(&instrumentation);
enableMCULoadCalculation(true);
}
I'm not sure if this works, I had tried to set everything by address, but then all I got was a black screen when uploading to the board. I might have been overlapping with some other memory region, I'm unsure how to figure that out.
Now at least I get the UI to display but the slide transition only plays in the simulator and not on the board.
I'm quite new at this and would greatly appreciate some help in this matter, thank you for taking the time to read this.
NOTE: This is a reupload due to a misunderstanding with my last post, I had a formatting error in the post. And wrote a reply to indicate that I fixed the formatting error. But due to my poor wording it was accepted as the solution to the post. That was not what I meant. I couldn't message the person that closed the post, so I repost this.
2024-04-26 09:47 AM - edited 2024-04-26 09:54 AM
Hello
Can you show how you have define frameBuffer0 - frameBuffer2
With quick test this, pretty nasty definition, the sliding transitions works on the target (STM32U5G9J-DK2):
//TouchGFXGeneratedHAL.cpp at \TouchGFX\target\generated\
.
.
.
namespace
{
// Use the section "TouchGFX_Framebuffer" in the linker script to specify the placement of the buffer
LOCATION_PRAGMA_NOLOAD("TouchGFX_Framebuffer")
uint32_t frameBuf[(800 * 480 * 2 + 3) / 4 * 2] LOCATION_ATTRIBUTE_NOLOAD("TouchGFX_Framebuffer");
static uint16_t lcd_int_active_line;
static uint16_t lcd_int_porch_line;
}
void TouchGFXGeneratedHAL::initialize()
{
HALGPU2D::initialize(8192);
registerEventListener(*(Application::getInstance()));
setFrameBufferStartAddresses((void*)frameBuf, (void*)(frameBuf + sizeof(frameBuf) / (sizeof(uint32_t) * 2)), (void*)(frameBuf +2*( sizeof(frameBuf) / (sizeof(uint32_t) * 2))));
setAnimationStorage((void*)(frameBuf +2*( sizeof(frameBuf) / (sizeof(uint32_t) * 2))));
/*
* Add DMA2D to hardware decoder
*/
mjpegdecoder1.addDMA(dma);
/*
* Add hardware decoder to video controller
*/
videoController.addDecoder(mjpegdecoder1, 0);
}
linker file STM32U5G9ZJTXQ_FLASH.ld (Not modified):
/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 3008K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 4096K
EXT_FLASH (r) : ORIGIN = 0xA0000000, LENGTH = 128M
}
//.
//.
//.
FramebufferSection (NOLOAD) :
{
*(TouchGFX_Framebuffer TouchGFX_Framebuffer.*)
*(.gnu.linkonce.r.*)
. = ALIGN(0x4);
} >RAM
Animation framebuffer address and setAnimationStorage was needed to add manually for the project generated from TBS.Otherwise transitions didn't work.
Hope this helps
BR JTP
2024-05-30 07:14 AM
Sorry for the late reply, this seems very promising. I'm very sure I was not doing this correctly. I will try this solution and report back when I have the chance to go back to that project.
Thank you JTP1
2024-06-26 02:23 AM