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.

Comments

  • edited November 4

    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.

  • edited November 4

    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.

  • edited November 4

    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_create to create a low-priority task specifically for handling SPIFFS operations to avoid blocking display refreshes.

    1. 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.

    2. 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.

    3. 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.

    4. Check SPIFFS Capacity: Ensure that the SPIFFS partition size is adequate to prevent fragmentation issues that can significantly slow down file operations.

      @lamuce said:
      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.

Sign In or Register to comment.