Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32-S3-N8R2 SDMMC in 4-bit does not run on 40 Mhz with IDF 4.4.2 (IDFGH-8778) #10210

Closed
NARRob opened this issue Nov 21, 2022 · 5 comments
Closed
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@NARRob
Copy link

NARRob commented Nov 21, 2022

    > @ThanosSiopoudis @ntwallace Thank you for reporting the issue! Could you please try to apply the attached patch and see if it improves the situation?

0001-Draft-sdmmc-fix-unreasonable-i-o-clock-phase-setting.patch.txt

@igrr Can this patch be applied to Stable 4.4.2? Facing the same issue with ESP32-S3-N8. Compiling with latest master is ok, compiling with 4.4.2 can only mount if 20 MHz and always fails on 40 MHz. Using SDMMC/4-bit. We must use the 4.4.2 as the ESP-ADF is not yet fully supported with v5.1 latest (any time frame for v5 to support ADF? or patches?)

Thanks

Originally posted by @NARRob in #8521 (comment)

@espressif-bot espressif-bot added the Status: Opened Issue is new label Nov 21, 2022
@github-actions github-actions bot changed the title ESP32-S3-N8R2 SDMMC in 4-bit does not run on 40 Mhz with IDF 4.4.2 ESP32-S3-N8R2 SDMMC in 4-bit does not run on 40 Mhz with IDF 4.4.2 (IDFGH-8778) Nov 21, 2022
@NARRob
Copy link
Author

NARRob commented Nov 21, 2022

Is there a patch for ESP32-S3 for SDMMC to run at 40 Mhz. The same exact code runs 40 MHz when compiled with v5.1, but fails to mount when compiled with 4.4.2 or 4.4.3. It only can run on 20 MHz.
We need to use 4.4.2 or 4.4.3 for ESP-ADF code.

@chegewara
Copy link
Contributor

I am building and running with arduino (esp-idf v4.4.3) sd_mmc using native esp-idf API and it is working, both, SPI and mmc 4-bits. SPI reporting max 20MHz and mmc 40MHz with my sd card.

        esp_vfs_fat_sdmmc_mount_config_t mount_config = {
            .format_if_mount_failed = true,
            .max_files = 5,
            .allocation_unit_size = 16 * 1024
        };
        _is_mmc = mmc;

        if(mmc)
        {
            sdmmc_host_t host = SDMMC_HOST_DEFAULT();
            host.max_freq_khz = SDMMC_FREQ_52M;
            host.flags &= ~SDMMC_HOST_FLAG_DDR;
            ret = esp_vfs_fat_sdmmc_mount(path, &host, &slot_config_mmc, &mount_config, &_card);
        }
        else
        {
            sdmmc_host_t host = SDSPI_HOST_DEFAULT();
            host.max_freq_khz = SDMMC_FREQ_DEFAULT;
            spi_bus_initialize((spi_host_device_t)host.slot, &bus_cfg, SDSPI_DEFAULT_DMA);
            slot_config_spi.host_id = (spi_host_device_t)host.slot;
            ret = esp_vfs_fat_sdspi_mount(path, &host, &slot_config_spi, &mount_config, &_card);
        }

@NARRob
Copy link
Author

NARRob commented Nov 21, 2022

@chegewara Thanks. You message did not indicate if it was the ESP32-S3. Maybe adding the ESP-ADF got something to do with it. I will try using 4.4.3 alone without ADF to see if that's the case. Thanks

@chegewara
Copy link
Contributor

Yes, of course it is S3. Im just not sure right now if its with or without PSRAM, because i have few different devkits, including N32R8 OPI mode. Here you can see pins i am using, but S3 can use any free pins with matrix:

#define SD_CMD	1
#define SD_CLK  2
#define SD_DAT0 4
#define SD_DAT1 5
#define SD_DAT2 6
#define SD_DAT3 7

@igrr
Copy link
Member

igrr commented Apr 17, 2023

The fix has been merged internally and will be available on Github soon. For reference, commit ID will be ef64e4e. We will also backport the fix to release/v4.4 and release/v5.0.

@espressif-bot espressif-bot added Resolution: Done Issue is done internally Status: Done Issue is done internally and removed Status: Opened Issue is new labels Apr 17, 2023
@igrr igrr closed this as completed Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants