Skip to content

esp_vfs_fat_sdspi_mount function in the ESP-IDF framework, but it's failing with a CRC error #261

@samsfisherCsy

Description

@samsfisherCsy

Describe the bug

I'm trying to mount an SD card using the esp_vfs_fat_sdspi_mount function in the ESP-IDF framework, but it's failing with a CRC error. The card has been formatted as FAT32.

Error Log:

[info] rg_storage_init: Looking for SD Card using SDSPI...
E (909) sdmmc_sd: sdmmc_init_spi_crc: sdmmc_send_cmd_crc_on_off returned 0x106
E (909) vfs_fat_sdmmc: sdmmc_card_init failed (0x106).
[error] rg_storage_init: Storage mounting failed! err=0x106

To Reproduce

Steps to reproduce the behavior:

  1. use 4G HC / SanDisk or Other 32GB HC / SanDisk 64GB XC TF Card
  2. same format to FAT32
  3. put same file
  4. 4G HC ,See error Log
  5. SanDisk 64GB XC fall in error

esp_vfs_fat_mount_config_t mount_config = {
    .format_if_mount_failed = false,
    .max_files = 4,
    .allocation_unit_size = 0,
};

err = esp_vfs_fat_sdspi_mount(RG_STORAGE_ROOT, &host_config, &slot_config, &mount_config, &card_handle);
if (err == ESP_ERR_TIMEOUT || err == ESP_ERR_INVALID_RESPONSE || err == ESP_ERR_INVALID_CRC)
{
    RG_LOGW("SD Card mounting failed (0x%x), retrying at lower speed...\n", err);
    host_config.max_freq_khz = SDMMC_FREQ_PROBING; // Typically 400 kHz
    err = esp_vfs_fat_sdspi_mount(RG_STORAGE_ROOT, &host_config, &slot_config, &mount_config, &card_handle);
}
error_code = (int)err;
disk_mounted = !error_code;

if (disk_mounted)
    RG_LOGI("Storage mounted at %s.", RG_STORAGE_ROOT);
else
    RG_LOGE("Storage mounting failed! err=0x%x", error_code);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions