A comprehensive VFS FAT example
Posted: Sun Jan 12, 2025 8:02 pm
Hi all!
I'm currently studying the FAT FS support in IDF that I would like to use for my project and I really, really am lacking a solid example for what the docs describe. This is the page in question:
https://docs.espressif.com/projects/esp ... fatfs.html
In all of the examples I have been able to find, the all-encompassing esp_vfs_fat_spiflash_mount_rw_wl function is used, which does 4-5 things "for convenience".
Essentially, I would like to do everything that esp_vfs_fat_spiflash_mount_rw_wl does but step-by-step, in order to gain access to lower-level functions and control blocks. So that would mean manually mount WL, register+mount FAT, etc, but it's a little difficult to piece together how all these API layers come together, in what order they should be used, and which read/write/etc functions I will end up using for file operations.
I would like to get to a point where I use the native FAT functions if possible.
Also, some things are just not explained.
To illustrate:
The docs page describes a more detailed process for getting FAT started, using esp_vfs_fat_register, ff_diskio_register, and other stuff, but there are certain function arguments that aren't properly explained. For example, what is the expected "drive number" to pass to esp_vfs_fat_register, where can I find the function pointers to put into the ff_diskio_impl_t struct to pass to the ff_diskio_register function, etc....
I have read everything I could find on WL API, SPI Flash API, and other relevant pieces, but I would be very grateful if someone can provide a neat example where all the levels/features of esp_vfs_fat_spiflash_mount_rw_wl are explicitly set up/initialized/registered/launched/etc in order to get a FAT FS going.
Thank you in advance for any help and clarification!
I'm currently studying the FAT FS support in IDF that I would like to use for my project and I really, really am lacking a solid example for what the docs describe. This is the page in question:
https://docs.espressif.com/projects/esp ... fatfs.html
In all of the examples I have been able to find, the all-encompassing esp_vfs_fat_spiflash_mount_rw_wl function is used, which does 4-5 things "for convenience".
Essentially, I would like to do everything that esp_vfs_fat_spiflash_mount_rw_wl does but step-by-step, in order to gain access to lower-level functions and control blocks. So that would mean manually mount WL, register+mount FAT, etc, but it's a little difficult to piece together how all these API layers come together, in what order they should be used, and which read/write/etc functions I will end up using for file operations.
I would like to get to a point where I use the native FAT functions if possible.
Also, some things are just not explained.
To illustrate:
The docs page describes a more detailed process for getting FAT started, using esp_vfs_fat_register, ff_diskio_register, and other stuff, but there are certain function arguments that aren't properly explained. For example, what is the expected "drive number" to pass to esp_vfs_fat_register, where can I find the function pointers to put into the ff_diskio_impl_t struct to pass to the ff_diskio_register function, etc....
I have read everything I could find on WL API, SPI Flash API, and other relevant pieces, but I would be very grateful if someone can provide a neat example where all the levels/features of esp_vfs_fat_spiflash_mount_rw_wl are explicitly set up/initialized/registered/launched/etc in order to get a FAT FS going.
Thank you in advance for any help and clarification!