2019-05-06 02:53 AM
Hi,
I setup a project for STM32F429 MCU by using STM32CubeMX with LTDC, DMA2D, FreeRTOS and TouchGFX enabled. It works very well with a splash screen and a main screen. However, when I added another simple screen, the UI freezes after some screen switch operations. The problem can be reproduced 100%, and always at the some place.
After some investigation, I found the UI task is hung in OSWrappers:waitForVSync() -> xQueueReceive() -> prvUnlockQueue() -> xTaskRemoveFromEventList()->configASSERT(pxUnblockedTCB).
The reason is: memory of vsync_q (in OSWrappers.cpp) is overwritten by unknown reason. vsync_q.xTasksWaitingToSend.uxNumberOfItems is no longer 0, which cause the assert fail.
I added a memory write access breakpoint, and tried to catch the 'evil' code, but it breaks in the interrupt handler: DMA2D_IRQHandler(), and the memory has been changed already. So, I lost clue here, and it seems DMA2D did some incorrect operation towards the memory.
Can anyone give me some suggestion to debug and resolve this problem? Many thanks!
BTW, I have tried to increase the stack size and heap size, and the problem still exist.
Br,
Peter
Solved! Go to Solution.
2019-05-07 08:10 PM
The problem is fixed by:
I don't know what happened and how the bug is fixed, but it works. Seems there is some problem in STM32CubeMX, and the generated project has some hidden error.
Br,
Peter
2019-05-07 08:10 PM
The problem is fixed by:
I don't know what happened and how the bug is fixed, but it works. Seems there is some problem in STM32CubeMX, and the generated project has some hidden error.
Br,
Peter
2019-05-08 01:00 AM
Hi @PLan,
Nice find. That sounds like a very weird error. Basically you're saying that you ended up with the same thing you started with - But changing files back and forth made it work?
/Martin
2019-05-09 02:03 AM
Yes. Configuration of FreeRTOS heap mgnt is strange to me.
Before the problem happened, I have NEVER changed heap configuration, and heap_4 is used by default.
Because the corrupted memory is located in heap area, I suspected that it maybe a heap management problem.
So I changed it from heap_4 to heap_2/3/5, but all failed (link error and runtime error).
At last, I changed it back to heap_4, and it gives me a link error, and I must copy the heap_4.c into the project manually.
And the problem is gone (what a surprise!).
2019-05-09 02:21 AM
Yes, that is really strange. Well, i'll keep this in mind as an issue that may be related to project generation in CubeMX.
/Martin
2021-04-16 11:03 AM
@PLan @Martin KJELDSEN Hi
I faced the same problem, what do you mean by adding heap_4.c into the project manually?
2021-04-19 04:30 AM
Hi,
This post is 2 years old. Are you facing the exact same issue ? Are you working on a custom board or on one of the application templates for ST development boards available in TouchGFX Designer ? Are you working with STM32CubeMX ? What RTOS are you using ?
/Romain
2021-07-14 07:53 AM
@Martin KJELDSEN @PLan @Romain DIELEMAN I seem to have run in to a similar problem but my problem started way later when I had around 15-20 screens and loads of hardware interaction with the views. At some point as I was adding a buffer to communicate with hardware, my project starts well, graphic runs and gets stuck as my progress bar is loading and always at the same point, and on debug there seems to be no fault caught. Anywhere on graphics side if i reduced a buffer or a view the program would run normally. Seems like theres a memory limit which when exceeded freezes the whole program. Tried the normal adding stack and heap size but doesnt work. The manually adding heap_4.c seems really strange, so is there any other solution that can be implemented or the cause of this problem explained?
Project uses STM32F746NGH6 on my own custom board, and using STM32CubeIDE and necessary configurations undertaken using MX of CubeIDE.
2022-12-28 07:16 AM
I also faced the same problem. Adding heap_4.c manually to the project fixes the problem. But when I add any widget to the same screen, it still freezes. When I manually add heap_4.c to the project again, the problem is not resolved.
Also, when I move the last widget I added on the same screen, it doesn't freeze.