2019-04-01 03:12 AM
Hello all,
I am developing a touchGFX application on STM32F7 with the frame buffer stored on an external QSPI flash.
While app is running, I need to write data to this external memory but, to allow the flash write, I have to exit the memory-mapped mode. On this configuration the GUI task can not access the frame buffer so I have tried to block its execution. I have implemented it this way:
1- System starts: QSPI flash configured in memory-mapped mode (GUI task working fine)
2- Disable LCD and DMA interrupts and exit memory-mapped mode
3- Write flash
4- Enter memory-mapped mode and enable LCD and DMA interrupts
Since the data is received from modbus communications, I repeat steps 2-4 on each message reception until I have written all data on external flash. This solution works sometimes but others the GUI task seems to crash and the screen is not refreshed anymore.
My question is: what is the correct way to block GUI task (or frame buffer access) so that it could continue its normal function once I have finished writing the external flash?
Thank you in advance.
Solved! Go to Solution.
2019-04-01 03:17 PM
I would think suspending the task before disabling DMA/LCD interrupts and resuming the task after enabling interrupts would work though haven't done it before.
Is it just assets in your external flash or is your actual frame buffer for the LCD peripheral also on external flash? How often is your frame buffer written to? Are you worried about excessive write cycles on your flash?
2019-04-01 03:17 PM
I would think suspending the task before disabling DMA/LCD interrupts and resuming the task after enabling interrupts would work though haven't done it before.
Is it just assets in your external flash or is your actual frame buffer for the LCD peripheral also on external flash? How often is your frame buffer written to? Are you worried about excessive write cycles on your flash?
2019-04-01 03:20 PM
Forgot to reference the FreeRTOS functions for suspending/resuming tasks:
void vTaskSuspend( TaskHandle_t xTaskToSuspend );
void vTaskResume( TaskHandle_t xTaskToResume );
2019-04-02 06:46 AM
Thanks for your quick response. Suspending the task before disabling the interrupts seems to work!
Regarding your questions:
My first explanation was not correct, what I have stored on QSPI flash is just assets, not the frame buffer. Sorry for that.
I think flash write cycles will not be a problem. On normal operation, flash data is modified only when the app is updated or when device is connected to a new modbus slave.
2021-11-17 08:58 AM
Hello,
I'm having same troubles when QSPI memory mapped mode--> Indirect mode-->memory mapped mode (after few attempts, sometimes TOUCHGFX hang, sometime crash)
I Tried to disable TouchGFX Task and/or LCD and DMA interrupts, but nothing solves.
Someone can write a example about how to do it?
I'm using STM32H745I-DISCO
regards...
2023-04-19 05:44 AM
I have the same issue. I am normally using mammory mapped external flash but sometimes I have to write to the flash. When that happens first I use taskENTER_CRITICAL(); wich should disable all other tasks. Then I disable the interupts and wirite to the flash. After that I enable interrupts and taskEXIT_CRITICAL().
This works 90% of the time but not good enough.
taskENTER_CRITICAL();
NVIC_DisableIRQ(DMA2D_IRQn);
NVIC_DisableIRQ(LTDC_IRQn);
NVIC_DisableIRQ(TIM5_IRQn);
stat = ExtFlash_Abort(&hqspi);
if(stat == EXT_FLASH_OK){
ee_status = EE_WriteVariable32bits(eepromQueueMsg.id,eepromQueueMsg.value);
}
stat = ExtFlash_MemoryMap(&hqspi);
NVIC_EnableIRQ(TIM5_IRQn);
NVIC_EnableIRQ(DMA2D_IRQn);
NVIC_EnableIRQ(LTDC_IRQn);
taskEXIT_CRITICAL();
2023-12-20 11:17 PM
Hello manto.1,
I have the exact situation here which I need to write to external flash during runtime.
Could you please let me know how you implemented the "ExtFlash_Abort(&hqspi)" function.
Do you call HALL_QSPİ_DeInit() function in it.
Thanks in advance
Kutlu