2025-10-14 7:49 AM - last edited on 2025-10-14 7:53 AM by Andrew Neil
Hello All,
I am working on the touchgfx project and have an application where I have created some screens and performing the different operations while button pressed.
I am writing and reading the data content to external EEPROM, eg, some 10-15 parameters while button is pressed and reading it while other button is pressed.
Before adding the Eeprom operation My Screens and operations were working fine and fluently, but after adding the code for writing the parameters to eeprom, the screens started to flicker between screens and the GUI is getting distorted.
This is not normal behavior, Can any one suggest how shall I take care of it or what would be the best way to perform external Eeprom read write operations, without interrupting the GUI ?
Regards,
Shi
2025-10-14 8:02 AM
Shi Shi, show your code or ideas. And primary in gfx task you cant use any blocking code, same for other tasks not blocking gfx task level...
2025-10-14 9:14 PM
Hello @MM..1
Thanks for the quick reply, so the idea is I have to save and load the parameters when the user provides some data, 20-30 bytes of data, when buttons are pressed the data has to be stored in EEPROM, and when other is pressed the Data has to read from EEPROM and then display it. currently I am doing these operations in model, I can susseccfully write and read from EEPROM, but the screens are now fluctuating and flickering. The EEPROM write would require 5 ms delay.
If I have to perform same operations, you are suggesting to use other thread for EEPROM read write is it correct ?
or if there is any better idea then kindly suggest, will try the same.
Regards,
Shi
2025-10-14 10:28 PM
> currently I am doing these operations in model, I can susseccfully write and read from EEPROM, but the screens are now fluctuating and flickering.
It is questionable if this (i.e. model behavior) is meaningful in this regard.
> The EEPROM write would require 5 ms delay.
Not exactly, it returns "busy" as long as a write is ongoing, which can take several milliseconds. I suppose 5ms is the average or worst-case number from the datasheet.
If your code busy-waits for that time, you definitely have problems with flickering screens.
2025-10-14 10:58 PM
Hello @Ozone,
Just for clarification, What would be best idea to perform both the operations without getting impact on GUI ?
Currently from view I am sending data to Model via presenter and then in Model I am performing the Read write operation for EEPROM.
The data is at View.
Shall I try to create other task and send the data from Model to other new task using message queue and do read write in other task would this help to solve it ?
If there are any references or any suggestion, then please let me know. Will try that way.
Regards,
Shi
2025-10-15 1:31 AM
I don't know how you design your application, and which components you ar using.
> Shall I try to create other task and send the data from Model to other new task using message queue and do read write in other task would this help to solve it ?
And here I don't know what the term "task" refers to. A FreeRTOS task, or a similiar RTOS ?
That would be an option.
In a bare-metal environment, I would handle this via polling in a periodic timer event, since EEPROM writes happen infrequently, and don't require high throughput.
I personally would use the Systick timer for such purposes.
2025-10-17 4:09 AM
Hello @Ozone ,
Yes I am using the freertos task, trying to create one and use it.
Only my question is why the screen gets fluctuating, the buttons and icons which were working earlier fluently, now after adding the write /Read function got messed up.
What all things shall I verify and check to make GUI working smooth and fluent ? I mean the settings and initializations for frame and screen.
2025-10-17 7:29 AM
Yes, you should have a separation of frontend and backend. The model can communicate with your backend (see https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/backend-communication)
2025-10-19 10:27 PM
Most likely your EEPROM task blocks the Touchgfx screen update during a write and the associated busy period.
I have only very superficial knowledge of Touchgfx, so I can't comment on details. I suppose either via timer-triggered interrupt handler or DMA.
You did not disclose any of the code you are using for EEPROM access, especially write access.
Either check and correct interrupt priorities (I2C versus screen update), or implement the EEPROM write via polling.
2025-10-22 3:39 AM
Hello @jchernus-fikst ,
Thanks for the reply, Yes I tried the same way, I am using MVP flow to send and receive data. Model->presenter->view and vise versa. I can see the data been sent and updated on screen.
Though I have been using the Message queue between GUI thread and other UART thread which doesn't cause lot trouble but when only when, Tring to write some data with delay (Changed from 5 millisec to 1 milli sec), still able to see flickering and fluctuations on screen with buttons.
Tried to look at other STM32 tickets, if someone have faced this issue, then found one where the clock is reduced for LTDC. I also tried to change the clock of LTDC from 51 mhz to 18.1 mhz, then the intensity of flickering reduced a lot.
Even in my case this worked a better but it didnt resolved the issue completely.
If there is something more to try just let me know will try whatever is possible to make it stable.
Br,
Shi