Page 1 of 1

External Flash Logging Issue

Posted: Mon Aug 16, 2021 9:39 pm
by matt001k
Hello all,

I have stumbled upon an issue in which I am logging to a filesystem and randomly during some flash writes the ESP32 will freeze all tasks and trip the watchdog for the task which is writing to the ESP32-Wrover's flash chip. I am just curious as to if this is a known issue or not?
I've implemented littlefs as the filesystem and utilize the

Code: Select all

esp_partition_write
api as the writing writing functionality of the filesystem.
I have tried using the vfs with SPIFFS as well and have run into this issue as well.
The current implementation is, I have a circular buffer that holds a certain amount of data and a task serving log writes, the log writes 512 byte chunks at a time to flash. Randomly, the

Code: Select all

esp_partition_write
api freezes and trips the watchdog.
Is this logging scheme not possible due to running this on the same flash chip that we are executing in place from?
Please let me know!

Task watchdog is currently set at 15 seconds.

Re: External Flash Logging Issue

Posted: Tue Aug 17, 2021 12:59 am
by ESP_Sprite
Can you show your code, and the backtrace when the watchdog is being tripped? The functions you mention should work as you'd expect during normal operation, it's odd that in your case it doesn't.

Re: External Flash Logging Issue

Posted: Tue Aug 17, 2021 2:09 am
by matt001k
Hi and thanks for the response!
I can't show the code sadly it's for a production system for a client.
I currently cannot show the backtrack as well due to the fact I'm implemented custom serial logging with a uart interface.
If I turn off flash writes I do not have this issue(if I just log to the console and not to file system), only when this is enabled is there an issue.
I'll reinstate backtrack tomorrow with user callback functions look at where the error may be occurring.

Re: External Flash Logging Issue

Posted: Wed Aug 18, 2021 1:17 am
by ESP_Sprite
Ah, you're using it for logging? Is there any chance you're writing to the filesystem from an interrupt anywhere? (ISR calls log function, log function tries to flush message to disk)