2020-11-20 01:27 AM
Hallo,
I am using the TouchGFX framework on an STM32F750Z8T uC on a custom board. Connected to the uC is a SPI-flash and an external RAM. The application is loaded from the SPI flash to the external RAM on startup. After verification the application is started. Stack and heap are located in the internal RAM while all data like the frame buffer are also located in the external RAM. The connected display hast a resolution of 480 * 272.
The application uses FreeRTOSv2 with two tasks. One for the TouchGFX, and the other for reading inputs and sending data.
After startup the application is doing the hardware init, starting the first task and after that the TouchGFX task.
Everythings runs fine until the TouchGFX switches to an other screen. Then the application freezes or completly crashes. With only one screen with colorchanges and anmations the application runs without any problems.
What I have done so far is increasing the heap of the OS to 250 kbytes and the stack of the TouchGFX task to 60 kbytes in case there is memory shortage. But this didn't help.
I reduced the first task to only toggle a led pin, but this alos didn't help.
The freeze/crash doesn't alsways happen immediately on screen change. Some times I could chnage screens several times before that happens. During debugging it also seemed like the crash is somhow related to not or wrong set callback function pointers in the TouchGFX framework.
What I also noticed was, that screen transitions animationts don't work. When switching to another screen, the new screen is not sliding in as defined, but immediately displayed. Could this also be realted to the problem?
The code is generated with STM32CubeMX 5.6.0.
I appreciate any help, thank you.
Best regards
2020-11-20 04:18 AM
Hi,
Cant say my issue is related, except I noticed the same thing when changing from one screen to another - instant change, not slide.
(I had a crash in a complex app, but when I reduced it to absolute minimum as shown in my question, the screen scroll is not part of my problem)
See if if happens in the simulator, and do whatI did, reduce the app to an absolute minimum.
"BUG? Scrollable container/Dynamic graph crashes simulator (and hardware) - with no extra code."
2020-11-20 06:20 AM
Hi,
For the slide transition it might be because the animation storage is not enabled. How did you create your project ? Did you base it on one of the application template provided in TouchGFX Designer ? In the ATs we provide the animation storage is not always set as it requires more memory. Without it, complex animations like slide transitions cannot be done (you can still do cover transitions).
To enable the animation storage you need to modify the setFrameBufferStartAdresses function, which is used in TouchGFXGeneratedHAL.cpp or in TouchGFXHAL.cpp in the TouchGFX/target folder. As you might know, the generated file will be overwritten whenever you generate code again from Designer, so it is better to have something like the function below in TouchGFXHAL.cpp. In this example we have a project with a double buffer strategy, with the first framebuffer at the address 0XC0000000. Since one framebuffer is 3FC00 in our case, the second framebuffer address is 0xC003FC00, and we can put the animation storage at 0XC007F800 (so 3FC00 * 2).
void TouchGFXHAL::initialize()
{
TouchGFXGeneratedHAL::initialize();
setFrameBufferStartAddresses((void*)0xC0000000, (void*)0xC003FC00, (void*)0xC007F800); //enable the animation storage to allow slide animations
lockDMAToFrontPorch(false);
instrumentation.init();
setMCUInstrumentation(&instrumentation);
enableMCULoadCalculation(true);
}
Test it out to see if that is fixed at least
If you are facing the same error as MS.9, it created an internal ticket to see how we can fix this bug.
/Romain
2020-11-21 02:53 AM
Hmm you write, that app and framebufer (singel double anim???) is located in same external RAM, then your MCU must be strange overbus that may result to hardfault and hang as you see. Too optimized work with LTDC and external RAM need place start adress for framebuffers to different banks ... So different bank for app.
2020-11-24 11:22 PM
Hi @Romain DIELEMAN ,
thank you for your reply. The project was configured in STCubeMx and than imported into TouchGFXStudio. After that the generated project was importet into STCubeMxIDE. At the moment we only use one frame buffer at adress 0x60100000.
The initialize code was genereaed by TouchGFXStudio and looks like this:
void TouchGFXGeneratedHAL::initialize()
{
HAL::initialize();
registerEventListener(*(Application::getInstance()));
setFrameBufferStartAddresses((void*)frameBuf, (void*)(frameBuf + sizeof(frameBuf)/(sizeof(uint32_t)*2)), (void*)0);
}
I tried adding your code but "instrumentation" was not defined. Is there some configuration in the TouchGFXStudio missing?
Regarding the crash, I can't really tell, if it is similar to the one MS.9 is reporting, since it looks like the crash only happens on screen change. I have a reduced version with just changing background color and a progress circle, and this works fine when I don't switch to a sceond or third screen. Is there a major difference bewteen a screen change and changing the the color of the current screen regarding memory access (I am thinking about dma for example)? If there is no effect (like scrolling or blending)?
I appreciate any help, thank you.
Best regards
2020-11-24 11:27 PM
Hi, @Community member ,
thank you for your input. I already reduced the app to one screen with changing backgroundcolor and a progress cricle. This version works fine even over a longer period of time (>12h). In the simulator I have absolutly no problem with the app with multiple screens. Changing screens there works fine, but on the target hardware it crashes. I will try adding a scrollable container to the app with only one screen, and see what happens with this.
Best regards
2020-11-24 11:45 PM
Hi @MM..1 ,
thank you for th input, but as far as I understood, you can't use two banks on the same sd ram device, am I wrong here? So I would need a second ram?
I am not using double buffering at the moment, which looks like the cause for not showing the animation as stated by @Romain DIELEMAN , but I have no problems with apps with only one screen. If I add a second one (that is be empty) and switch between screens, the app crashes.
Best regards.
2020-11-25 08:05 AM
You are wrong, for example sdram 8M have 4 banks x 2M . And you can place app to first 2M , framebuffer1 to bank2 ...
Understand banks is controlled with FMC signals BA0 BA1
2020-11-26 03:39 AM
This is how I did it, the application was in the first 16M of the RAM while the framebuffer and data memory was in the second 16M of the 32M RAM. But I didn't do any changes beside the ones in the linker script to place them there.
Best regards.
2020-11-26 05:42 AM
Small update:
I have swapped the F750Z8 for a F767ZI on one board today. First I ran the appliaction from external RAM again to see if there are any differences between these two chips. But I still got crashes on screen changes.
The F7676 has 2M of internal flash and can store the application while the frame buffer is still in external RAM and all other data (stack/heap/vars) are in the internal RAM. So far it looks like I don't get any crashes, but after some time I start getting pixel errors. These errors sum up until I change the screen.