SPIFFS & CrowPanel ESP32 HMI 7.0-inch Display
When I write data to SPIFFS the screen displays incorrect behavior for a short time.
I have modified the example program to show this erroneous behavior.
Each time the ON button is pressed the file is written and each time the OFF button is pressed it is read.
Perhaps the screen and the flash share some pins and this is the reason?
Is there anything i can do to avoid it?
Thanks in advance.


Tagged:
Comments
Hello @Iamuce,
Please pay attention to not refreshing LVGL while reading/writing to the SD card.
If you have any questions, feel free to contact me.
Hi Jennie,
Thanks. That's what i'm doing.
To make sure, I've added a 1 second delay after writing to the flash and before refreshing the screen.
With the same result.
I attach the code.
As I see inside lv_conf.h there is a timer to refresh the screen.
/Default display refresh period. LVG will redraw changed areas with this period time/
#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/My idea would be to disable the timer, write to the flash, and re-enable the refresh timer.
But i dunno how to do it..
Any idea would be appreciated.
Hello Iamuce,
Please try to check if the following measures can be taken to solve the problem:
1. Asynchronous SPIFFS Operations: Consider using asynchronous operations or performing SPIFFS read/write operations in a low-frequency task. You can use
lv_task_createto create a low-priority task specifically for handling SPIFFS operations to avoid blocking display refreshes.File Caching: By caching data, reduce the frequency of direct access to SPIFFS files. For example, you can store data to be written into memory first and then write it to SPIFFS in batches at regular intervals, reducing the frequency of file system calls. This not only reduces the blocking time but also optimizes resource usage.
Optimize LVGL Refresh Rate: If real-time display updates are not necessary, you can adjust the refresh parameters in lv_disp_drv_register to reduce the refresh rate. For instance, set the lv_disp_drv_t to a lower value, allowing the display task to free up more time for SPIFFS operations.
Delay SPIFFS Refresh: After detecting data changes (e.g. oldled != led), temporarily postpone the write operation until the display stabilizes before writing to SPIFFS. This can be achieved by adding delays or incorporating conditional checks in the loop function.
Check SPIFFS Capacity: Ensure that the SPIFFS partition size is adequate to prevent fragmentation issues that can significantly slow down file operations.
Hi,
I can also confirm this problem, that the screen flickers (the picture shifts, blinks, looks like an obvious glitch) while the ESP32 is writing to the flash memory (SPIFFS or LittleFS, it doesn't matter).
In my example (I couldn't upload a comment with images because the site didn't allow it for me), I'm using the
Update.hlibrary to update the firmware using a.binfile located on the SD card. I observe very strong flickering while this file is loading (in my case, it's almost 1MB, and it takes about 10 seconds). The file is loaded in 4KB chunks, and the display flickers slightly as each chunk loads. However, as you can imagine, there are many chunks in a 1MB file, and they load quickly, resulting in very strong flickering (the video is more demonstrative, but I can't upload it here).I'll also share another observation: I save data to the file system every minute using LittleFS. When I'm writing, I notice a slight flickering on the display. Sometimes this flickering is hard to detect, but it definitely happens when I'm writing (there's no such behavior when reading from the file system).
Clarification: I'm sure this isn't happening because I'm updating the display image using lvgl (i.e., lv_timer_handler()). The flickering occurs without any UI operations, only when writing from LittleFS.