Page 1 of 1

FAT failed to mount error 14

Posted: Fri May 31, 2019 8:31 am
by msperandio
I'm trying to mount the FAT FS on a custom c++ project with custom partition table. The error is always:

W (28) vfs_fat_spiflash: f_mount failed (13)
I (28) vfs_fat_spiflash: Formatting FATFS partition, allocation unit size=4096
E (38) vfs_fat_spiflash: f_mkfs failed (14)
E (48) Read CSV example: Failed to mount FATFS (ESP_FAIL)

The wear_levelling example runs fine on my system.

Do you have any idea, I'm using exactly the same lines of code on the example?

Re: FAT failed to mount error 14

Posted: Mon Jul 01, 2019 8:59 am
by k.ifantidis
Hello there,
I have esp-wroom-32d module and I'm using esp-idf v4.0-dev-837-g58df1d93b and I'm using make build system for my programs compilation. I've been using the same library in order to write some data in Flash memory without any problems. Today I've erased the flash and changed a bit my partition table. It seems that i get the same error messages as you, esp doesn't like my changes :D !! My fat partition size is 0xD000 = 52KB and it's type is data.

I'm posting the log below for further info:

Code: Select all

I (14397) FAT: MOUNTING FAT
W (14407) vfs_fat_spiflash: f_mount failed (13)
I (14407) vfs_fat_spiflash: Formatting FATFS partition, allocation unit size=4096
E (14417) vfs_fat_spiflash: f_mkfs failed (14)
E (14417) FAT: Failed to mount FATFS (0xffffffff)
E (14427) FAT: Failed to mount FATFS (ESP_FAIL)
E (14437) FAT: FAILED to open file
I (14437) FAT: UN-MOUNTING FAT
ESP_ERROR_CHECK failed: esp_err_t 0x103 (ESP_ERR_INVALID_STATE) at 0x40087aac
0x40087aac: _esp_error_check_failed at C:/esp/esp-idf/components/esp32/panic.c:720

file: "C:/esp/esp-idf/examples/xxxxxxx/components/xxxxxxx/xxxxxxx.c" line 168
func: fat_unmount
expression: esp_vfs_fat_spiflash_unmount(home_path, wl_handle)

ELF file SHA256: bd315ec32123ea335cf557d88f0ccecca4010655590dfb4a51e478b14f5963cf

Backtrace: 0x40087630:0x3ffc4e70 0x40087aaf:0x3ffc4e90 0x400e753f:0x3ffc4eb0 0x400e75dc:0x3ffc4ed0 0x400e7bcc:0x3ffc4f10 0x40120c4f:0x3ffc4f50 0x4011bc0d:0x3ffc4fb0 0x4011005e:0x3ffc4fd0 0x40089901:0x3ffc4ff0 0x4008d785:0x3ff
c5030
0x40087630: invoke_abort at C:/esp/esp-idf/components/esp32/panic.c:156

0x40087aaf: _esp_error_check_failed at C:/esp/esp-idf/components/esp32/panic.c:721

0x400e753f: fat_unmount at C:/esp/esp-idf/examples/xxxxxxx/components/xxxxxxx/xxxxxxx.c:168 (discriminator 1)

0x400e75dc: fat_write at C:/esp/esp-idf/examples/xxxxxxx/components/xxxxxxx/xxxxxxx.c:103 (discriminator 2)

0x400e7bcc: smartcfg_callback at C:/esp/esp-idf/examples/xxxxxxx/components/yyyyyyy/yyyyyyy.c:245

0x40120c4f: TOUCH_Deal_with at ??:?

0x4011bc0d: sc_PackCallback at ??:?

0x4011005e: ppProcessRxPktHdr at ??:?

0x40089901: ppTask at ??:?

0x4008d785: vPortTaskWrapper at C:/esp/esp-idf/components/freertos/port.c:143


Entering gdb stub now.
$T0b#e6
I'm searching for a solution since this morning but nothing as far :|. If I'll get it working I'll let you know.
Regards, Kostas.

Re: FAT failed to mount error 14

Posted: Mon Jul 01, 2019 9:50 am
by somesh
msperandio wrote:
Fri May 31, 2019 8:31 am
I'm trying to mount the FAT FS on a custom c++ project with custom partition table. The error is always:

W (28) vfs_fat_spiflash: f_mount failed (13)
I (28) vfs_fat_spiflash: Formatting FATFS partition, allocation unit size=4096
E (38) vfs_fat_spiflash: f_mkfs failed (14)
E (48) Read CSV example: Failed to mount FATFS (ESP_FAIL)

The wear_levelling example runs fine on my system.

Do you have any idea, I'm using exactly the same lines of code on the example?
Can you please show me ur partition table and file system initialisation?

Re: FAT failed to mount error 14

Posted: Mon Jul 01, 2019 6:59 pm
by ESP_igrr
k.ifantidis: try increasing the partition size to the same size as used in the example. One of the possible causes of this error is that FATFS library can not find a suitable C:H:S geometry for the given size, which can happen if the partition is too small.

If you find that you need a filesystem partition smaller than about 150kB, then SPIFFS might be a better option. That is, unless you need to protect the contents using Flash Encryption feature, as SPIFFS is not compatible with flash encryption.

Re: FAT failed to mount error 14

Posted: Sat Aug 03, 2019 7:34 am
by k.ifantidis
Hello there!

Thank you all about your replies and I'm sorry for the late response. I've detected the problem and it was that I had set insufficient storage size for FAT. I have read somewhere that minimum sector size for FAT is 128 - 132 sectors so minimum size is calculated like this 132*512B or 132*4096B. When I updated my partition table and set the right FAT size everything worked again.
If someone can point me to the documentation about the FAT size and minimum sectors needed for it I would be grateful :)

CASE SOLVED !!

Re: FAT failed to mount error 14

Posted: Wed Nov 13, 2019 6:35 am
by somesh
k.ifantidis wrote:
Sat Aug 03, 2019 7:34 am
Hello there!

Thank you all about your replies and I'm sorry for the late response. I've detected the problem and it was that I had set insufficient storage size for FAT. I have read somewhere that minimum sector size for FAT is 128 - 132 sectors so minimum size is calculated like this 132*512B or 132*4096B. When I updated my partition table and set the right FAT size everything worked again.
If someone can point me to the documentation about the FAT size and minimum sectors needed for it I would be grateful :)

CASE SOLVED !!
sounds good!!
please read esp idf documentaion for the same. you can also go through following thread.
viewtopic.php?t=6954