External Flash Logging Issue

matt001k
Posts: 11
Joined: Thu Sep 03, 2020 2:42 am

External Flash Logging Issue

Postby matt001k » Mon Aug 16, 2021 9:39 pm

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.

ESP_Sprite
Posts: 9770
Joined: Thu Nov 26, 2015 4:08 am

Re: External Flash Logging Issue

Postby ESP_Sprite » Tue Aug 17, 2021 12:59 am

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.

matt001k
Posts: 11
Joined: Thu Sep 03, 2020 2:42 am

Re: External Flash Logging Issue

Postby matt001k » Tue Aug 17, 2021 2:09 am

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.

ESP_Sprite
Posts: 9770
Joined: Thu Nov 26, 2015 4:08 am

Re: External Flash Logging Issue

Postby ESP_Sprite » Wed Aug 18, 2021 1:17 am

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)

Who is online

Users browsing this forum: No registered users and 72 guests