vfs/fatfs/spiflash affected by log level.

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

vfs/fatfs/spiflash affected by log level.

Postby permal » Sun Dec 24, 2017 11:23 am

Hi,

I've stumbled onto another case where the selected log level affects the timing of the ESP-IDF drivers, similar to #1345, but this time in the opposite direction, .i.e. higher log level makes things work.

Background:
I have a custom partition table, as seen here.

At the start of my application, in the main task, I initialize the wear leveling FatFS using

Code: Select all

esp_vfs_fat_spiflash_mount
the full implementation is here.

Later in the application (still in the main task) I read/write entire files using iostreams (note: same behaviour using C-style fopen/fread/fwrite/), full implementation here. (At this point Wifi is also activated (but not using nvs-storage), disabling that seems to make no difference regarding this issue.)

Now, the issue:
As long as as the log level is set to verbose things are working. As soon as I lower the log level to debug, the main task hangs when constructing the iostream (or calling fopen()), at this line, with this being printed:
Tasks currently running:
CPU 0: pthread
CPU 1: ipc1
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
- IDLE (CPU 0)
I've found that if I further delay reading the file until I have started a second task, then things works as expected, but that should not be required.

So, my question to you all is: What makes the vfs/fatfs/spiflash drivers so timing sensitive and affected by the log level? Is there a mutex that needs to be captured when reading/writing files?

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: vfs/fatfs/spiflash affected by log level.

Postby permal » Tue Jan 02, 2018 2:53 pm

Shameless bump.

Who is online

Users browsing this forum: No registered users and 126 guests