I am following the following example inthere there is SD card init() function that is not being init properly.
https://github.com/espressif/esp-idf/bl ... der_main.c
The following is the function that I use for init() sd card.
The error that I get is the following.
E (488) vfs_fat_sdmmc: sdmmc_card_init failed (0x105).
Code: Select all
void start_sd_card(void) {
esp_err_t err;
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
.format_if_mount_failed = true,
.max_files = 5,
.allocation_unit_size = 8 * 1024,
};
printf("initialising SD card\n");
spi_bus_config_t spi_cfg = {
.miso_io_num = GPIO_NUM_39,
.mosi_io_num = GPIO_NUM_40,
.sclk_io_num = GPIO_NUM_43,
.quadhd_io_num = -1,
.quadwp_io_num = -1,
.max_transfer_sz = 4000,
};
err = spi_bus_initialize(host.slot, &spi_cfg, SPI_DMA_CH_AUTO);
if(err != ESP_OK) {
printf("SPI device not init ok\n");
}
sdspi_device_config_t slot_config = SDSPI_DEVICE_CONFIG_DEFAULT();
slot_config.gpio_cs = GPIO_NUM_41;
slot_config.gpio_cd = GPIO_NUM_44;
slot_config.host_id = host.slot;
err = esp_vfs_fat_sdspi_mount(SD_MOUNT_POINT, &host, &slot_config, &mount_config, &card);
if(err != ESP_OK) {
printf("SD mount failed\n");
}
}
