Cannot mount more than two FATFS partitions

User avatar
brp80000
Posts: 52
Joined: Thu Oct 04, 2018 7:13 pm

Cannot mount more than two FATFS partitions

Postby brp80000 » Wed Dec 05, 2018 7:28 pm

My partitios
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
factory, app, factory, 0x10000, 0x1F0000
ota_0, app, ota_0, 0x200000, 4M
ota_1, app, ota_1, 0x600000, 4M
fat_1, data, fat, 0xA00000, 2M
fat_2, data, fat, 0xC00000, 2M
fat_3, data, fat, 0xE00000, 2M

sdconfig config
# SPIFFS Configuration
#
CONFIG_SPIFFS_MAX_PARTITIONS=3

1. when I initialize only two fatfs partitions (any two of fat_1 fat_2 fat_3), everything is OK. Under adding a third mean problems
2. when I use three I get an error: the maximum count of volumes is already mounted ESP_ERR_NO_MEM
3. In the file ffconf.h I found:
/*---------------------------------------------------------------------------/
/ Drive/Volume Configurations
/---------------------------------------------------------------------------*/

#define FF_VOLUMES 2
/* Number of volumes (logical drives) to be used. (1-10) */

When I change the value to 3 i have
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

My program crash inside
ESP_ERROR_CHECK(esp_vfs_fat_spiflash_mount("/spiflash3", "fat_3", &mountConfig3, &m_wl_handle3));
without any messages from ESP_ERROR_CHECK
Last edited by brp80000 on Wed Dec 05, 2018 7:58 pm, edited 2 times in total.

User avatar
brp80000
Posts: 52
Joined: Thu Oct 04, 2018 7:13 pm

Re: Cannot mount more than two FATFS partitions

Postby brp80000 » Thu Dec 06, 2018 10:26 am

It was a big problem. I found constants that I have never seen described. FF_VOLUMES 2 default, FF_MULTI_PARTITION 1 default, although it says 0 by default. These constants are not accessible from the "make menuconfig" and they need to change the inside of the original IDF files. I lost my working day
Безымянный.jpg
Безымянный.jpg (207.5 KiB) Viewed 124 times
It seems to me that if I update the IDF again I have to remember that they need to be changed

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

Re: Cannot mount more than two FATFS partitions

Postby ESP_Sprite » Fri Dec 07, 2018 2:04 am

If you want, you can open an issue on Github about this, as a feature request to put these things into Menuconfig.

ESP_igrr
Posts: 1261
Joined: Tue Dec 01, 2015 8:37 am

Re: Cannot mount more than two FATFS partitions

Postby ESP_igrr » Fri Dec 07, 2018 3:37 am

Also the reason why you had to set FF_MULTI_PARTITION to 0 is that "VolToPart" array initializer in diskio.c needs to be updated if you need to mount more than two partitions. I.e.:

PARTITION VolToPart[] = {
{0, 0}, /* Logical drive 0 ==> Physical drive 0, auto detection */
{1, 0} /* Logical drive 1 ==> Physical drive 1, auto detection */
{2, 0} /* Logical drive 2 ==> Physical drive 2, auto detection */
};

So switching FF_MULTI_PARTITION off might not be necessary, only FF_VOLUMES configuration needs to be added.

Return to “ESP32 IDF”

Who is online

Users browsing this forum: filipESP and 9 guests