Esp32 fat filesystem questions
Posted: Wed Apr 29, 2020 8:43 pm
I am trying to use the fat file system with wear leveling and posix file access. Very little documentation on the api's other than what I have found in the idf examples to use. Also I am looking for instructions on creating my own fatfs for my project.
These are the function calls in this order that I am using in code:
esp_partition_find(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_FAT, "/fatfs");
wl_mount(const esp_partition_t *partition, wl_handle_t *out_handle);
ff_diskio_register_wl_partition(BYTE pdrv, wl_handle_t flash_handle);
diskDrive[0] = (char)('0' + pdrv);
diskDrive[1] = ':';
diskDrive[2] = 0;
esp_vfs_fat_register(const char* base_path, const char* fat_drive, size_t max_files, FATFS** out_fs)
then when I call :
f_mount (FATFS* fs, diskDrive, 1);
f_mount returns an error 13
/* (13) There is no valid FAT volume */
here is my partitions.csv:
# Name Type SubType Offset Size
phy_init data phy 0xf000 0x1000
otadata data ota 0x10000 8K
nvs data nvs 0x12000 56K
at_customize 0x40 0 0x20000 0x12000
fatfs data fat 0x32000 0xCE000
ota_0 app ota_0 0x100000 0x180000
ota_1 app ota_1 0x280000 0x180000
#Note: at_customize has had portions removed including fatfs
I also tried to create my own fatfs.img using:
dd if=/dev/zero of=fatfs.img bs=1K count=824
mkfs.vfat fatfs.img
i mounted the image and copied in a file for testing
I used esptool to flash the esp32
esptool --port /dev/ttyUSB0 write_flash --flash_freq 80m -fm dio 0x32000 fatfs.img
and once again the f-mount returned 13.
The questions would be why is it not finding my partition?
and how do I create a filesytem to flash into my project?
Any help or documentation would be appreciated,
thank you in advance,
Andrew
These are the function calls in this order that I am using in code:
esp_partition_find(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_FAT, "/fatfs");
wl_mount(const esp_partition_t *partition, wl_handle_t *out_handle);
ff_diskio_register_wl_partition(BYTE pdrv, wl_handle_t flash_handle);
diskDrive[0] = (char)('0' + pdrv);
diskDrive[1] = ':';
diskDrive[2] = 0;
esp_vfs_fat_register(const char* base_path, const char* fat_drive, size_t max_files, FATFS** out_fs)
then when I call :
f_mount (FATFS* fs, diskDrive, 1);
f_mount returns an error 13
/* (13) There is no valid FAT volume */
here is my partitions.csv:
# Name Type SubType Offset Size
phy_init data phy 0xf000 0x1000
otadata data ota 0x10000 8K
nvs data nvs 0x12000 56K
at_customize 0x40 0 0x20000 0x12000
fatfs data fat 0x32000 0xCE000
ota_0 app ota_0 0x100000 0x180000
ota_1 app ota_1 0x280000 0x180000
#Note: at_customize has had portions removed including fatfs
I also tried to create my own fatfs.img using:
dd if=/dev/zero of=fatfs.img bs=1K count=824
mkfs.vfat fatfs.img
i mounted the image and copied in a file for testing
I used esptool to flash the esp32
esptool --port /dev/ttyUSB0 write_flash --flash_freq 80m -fm dio 0x32000 fatfs.img
and once again the f-mount returned 13.
The questions would be why is it not finding my partition?
and how do I create a filesytem to flash into my project?
Any help or documentation would be appreciated,
thank you in advance,
Andrew