cancel
Showing results for 
Search instead for 
Did you mean: 

why screen transitions does not work

ali_dehbidi
Senior

Hi,

I have a new project based on STM32H750VB, everything works, But when I make some transition between screens, it would just swap screens almost instantly! but the same code works nicely in simulation, what's wrong with the transitions?

9 REPLIES 9
Romain DIELEMAN
ST Employee

Hi,

You have to enable the animation storage in TouchGFXHAL.cpp. This will allow you to do slide transitions and complex animations.

In TouchGFXHAL.cpp, add the setFrameBufferStartAddresses() function and set a starting address for the animation storage. The size of a framebuffer is Width*Height*bpp/8, so in this case 480*272*16/8 = 3C700. If you are using the double framebuffer strategy (initially set in the application template for the STM32H750dk, with the first framebuffer set at 0XD0000000), you should then put the animation storage at 0xD007F800 ( 3C700 * 2 = 7F800) :

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();
    instrumentation.init();
    setMCUInstrumentation(&instrumentation);
    enableMCULoadCalculation(true);
 
    setFrameBufferStartAddresses((void*)0xD0000000, (void*)0xD003FC00, (void*)0xD007F800);
 
}

/Romain

ali_dehbidi
Senior

Dear Romain

Hi,

Thanks for the feedback, my LCD resolution is 480 X 320, so I can only use single buffer

also I have used the LCD buffer with buffer allocation strategy, so my TouchGFXHAL.cpp file is empty like this

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();
 
}

But I have some code like this in my TouchGFXGeneratedHAL.cpp file

void TouchGFXGeneratedHAL::initialize()
{
    HAL::initialize();
 
    registerEventListener(*(Application::getInstance()));
    registerTaskDelayFunction(&OSWrappers::taskDelay);
    setFrameRefreshStrategy(HAL::REFRESH_STRATEGY_OPTIM_SINGLE_BUFFER_TFT_CTRL);
    enableLCDControllerInterrupt();
    enableInterrupts();
    setFrameBufferStartAddresses((void*)frameBuf, (void*)0, (void*)0);
    /*
     * Set whether the DMA transfers are locked to the TFT update cycle. If
     * locked, DMA transfer will not begin until the TFT controller has finished
     * updating the display. If not locked, DMA transfers will begin as soon as
     * possible. Default is true (DMA is locked with TFT).
     */
    lockDMAToFrontPorch(true);
}

If I add instrumentation.init(); to the TouchGFXHAL.cpp file the project would not build, because it can not find it? where are the functions? also what about this line of code? what should I write instead of it?

setFrameBufferStartAddresses((void*)0xD0000000, (void*)0xD003FC00, (void*)0xD007F800);

Also I have noticed something very wired! I have measured my LTDC_IRQHandler handler speed, it's 60Hz, but my handleTickEvent from screens is around 450Hz! why is so?

Romain DIELEMAN
ST Employee

Hi,

Changes made in TouchGFXGeneratedHAL will be overwritten when you generate code from STM32CubeMX again. This is why you have TouchGFXHAL to add user code, you can also overwrite calls made in TouchGFXGeneratedHAL like the setFrameBufferStartAddresses(). What you need to do is just to do this in TouchGFXHAL.cpp:

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();
 
    setFrameBufferStartAddresses((void*)framebufferAddress, (void*)0, (void*)animationStorageAddress);
 
}

The 0xD0000000 address I gave was based on the application template for the STM32H750B discovery kit available in TouchGFX Designer, where two framebuffers are used and set at the addresses I gave. In your case and based on the code I shared you should write instead framebufferAddress the address where you want to put your first framebuffer (this depends on your setup and project, so you decide). Since you only use one framebuffer you can not set the second one. And for the animationStorage you should set it at: address of the first framebuffer + 480*320*2 (*2 if using 16bpp, otherwise *3), so address first framebuffer + 4B000.

Concerning the handleTickEvent frequency I don't know, could be different things. Are you using an OS (like FreeRTOS) ?

How did you setup your project ? Did you use the application template for the STM32H750B-DK board as inspiration ?

/Romain

Romain DIELEMAN
ST Employee

What version of TouchGFX and STM32CubeMX are you using by the way ? Could you also share more on your setup ? (display, flash, ram, ...)

/Romain

ali_dehbidi
Senior

Dear Romain

Thanks for your help, I'm using a 320x480 LCD in 18bit mode, so the buffer is 24bit, also I'm using stm32H750VB, which can have only internal ram with this setup, and that only allow 1 frame buffer (it got 1MB ram, with different addresses and less than 512KB each!), and I have 16MB QSPI flash on board, and I choose to not use any OS, and I use keil as my IDE, since free RTOS does not compile with version 6 of keil compiler, I choose to not use any OS yet, free RTOS can be used with version 5 of Keil, but the compilation time of the project takes about 10 minutes! I think arm compiler version 5 is not fast enough with COrtex M7,

I have made more tests, with the default generated code

setFrameBufferStartAddresses((void*)frameBuf, (void*)0, (void*)0);

The transitions for all the effects works correctly except the slide transition!!!! for the slide transition, it would almost switch to the next screen, maybe because of the 450Hz handleTickEvent.

Also Is it possible to use some other timers instead of systick timer when choosing no OS option? I have tried and it would crash!!! if this can be done, I can at least port embOS from segger to keil version 6 compiler, so I would get a RTOS and graphics with the latest compiler that does do a fast and fantastic job at compilation.

Finally I'm using the latest versions for touchGFX 4.16.1 and 6.2 for cubeMX

Romain DIELEMAN
ST Employee

Hi,

I am confused, you only used the default generated code ? As you can see the third value which is the animation storage is set to 0. In order to have a slide transition you have to set it to something else.

/Romain

I am also a bit confused by what you are experiencing with FreeRTOS and Keil. The majority of the application templates for ST development kits available in TouchGFX Designer use FreeRTOS and work with Keil 5 and 6, and it definitely does not take 10minutes to compile as well :grinning_face_with_sweat: This is strange.

ali_dehbidi
Senior

Hi Roman

Please use this cube file with the latest keil version, which is 5.34 and generate the code use the Version 5 of compiler, I think the default would be version 5, then change that to version 6 and see the different compile time that you get, actually I will attach two versions of the same project, the one that uses NO OS, that can be compiled on both V5 and V6 of keil compiler, and the one with FreeRTOS, this one only compiles on version 5 of Keil, in version 6 it would fail to compile,

 As you can see the third value which is the animation storage is set to 0. In order to have a slide transition you have to set it to something else.

My system have limited RAM, can this buffer be a few kilo bytes, like 16KB?

as far as I'm aware the slide transitions will only work if you have double or triple (animation) buffers. If that is not an option I think you will have a hard time getting the smooth transitions for the screens.