Spiffs partition formatting

ndjurov
Posts: 65
Joined: Wed Mar 25, 2020 11:34 pm

Spiffs partition formatting

Postby ndjurov » Wed May 11, 2022 9:12 pm

My ESP32 WROVER has 16MB of flash, half of which we use as a spiffs partition to store debug log files. However, it turned out that if the file is large (above 2MB), it really starts slowing the application down. I tried renaming the file, and/or deleting it and logging into a different file, but that didn't help. Then I tried to format the whole partition, and sure, the speed was back. Since the formatting takes about 60 seconds, and the application had to be responsive during that time, the formatting is done from another task.
The application is composed of many different tasks so once in a while the main task checks how much max. stack has been used by each task by calling uxTaskGetStackHighWaterMark(). This information tells us how much stack space to dedicate to each task.
What is interesting is that the formatting task that I just described always shows that 100% of its stack has been used at some point. I started with 2MB and 4MB and it's the same. Since I added this task, the application sometimes crashes, sometimes not.
So, my question - why is it that the task that only calls two functions: esp_spiffs_info() and esp_spiffs_format() uses so much stack size?
Side question - what is the proper way to kill this task - just to exit the task function, or to call vTaskDelete(NULL) at the end?
Thanks a lot.

Who is online

Users browsing this forum: No registered users and 138 guests