what's the minimum size of fat partiton in esp32C3?

hoo_wave
Posts: 14
Joined: Mon Dec 11, 2023 2:57 am

what's the minimum size of fat partiton in esp32C3?

Postby hoo_wave » Thu Jun 13, 2024 7:17 am

This is my partition table

Code: Select all

# Name,		Type,	SubType,	Offset,		Size
nvs,		data,	nvs,	    	0x9000,		0x4000
otadata,	data,	ota,	    	0xd000,		0x2000
phy_init,	data,	phy,	    	0xf000,		0x1000
ota_0,		0,	ota_0,  	0x10000,	0x150000,
ota_1,		0,	ota_1,  	0x160000,	0x150000,
dcu,		data,	fat,	    	0x310000,	0x90000,
when the dcu partition(last item) less than 0x90000,I came across this issue on monitor:

Code: Select all

W (302) vfs_fat_spiflash: f_mount failed (13)
I (312) vfs_fat_spiflash: Formatting FATFS partition, allocation unit size=4096
E (322) vfs_fat_spiflash: s_f_mount_rw(99): f_mkfs failed (14)
E (322) test_fatfs: Failed to mount FATFS (ESP_FAIL)
This is my c code

Code: Select all

static const char *TAG = "test_fatfs";
const char *base_path = "/spiflash";
static wl_handle_t s_wl_handle = WL_INVALID_HANDLE;

void test_fatfs_init(void)
{
    const esp_vfs_fat_mount_config_t mount_config = {
            .max_files = 4,
            .format_if_mount_failed = true,
            .allocation_unit_size = CONFIG_WL_SECTOR_SIZE
    };

    esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(base_path, "dcu", &mount_config, &s_wl_handle);
    if (err != ESP_OK) {
        ESP_LOGE(TAG, "Failed to mount FATFS (%s)", esp_err_to_name(err));
        return;
    }
How can I make a smaller dcu partiton? what I really need just 192kb(0x30000)

Thank you!

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: what's the minimum size of fat partiton in esp32C3?

Postby MicroController » Thu Jun 13, 2024 8:30 am

A 4KB "allocation unit size" (a.k.a. 'cluster size') on a 192KB storage is probably too big. The whole filesystem would only have 48 clusters to work with...

Who is online

Users browsing this forum: Majestic-12 [Bot] and 401 guests