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

SD_MMC max_freq_khz is set to HIGHSPEED by default #5631

Merged
merged 1 commit into from
Oct 1, 2021

Conversation

dizcza
Copy link
Contributor

@dizcza dizcza commented Sep 3, 2021

Summary

I noticed that max_freq_khz was set twice to different values; I picked the last one. I made a fix because previously SDMMC_FREQ_DEFAULT was used in the host initialization, and some users elsewhere suggest lowering SDMMC_FREQ_DEFAULT from 20_000 to 5_000. Now it's clearly seen that changing SDMMC_FREQ_DEFAULT won't affect the initialization of an SD card with the SD_MMC driver.

Impact

It has no impact other than improving code clarity.


BTW, I don't understand why host initialization has been changed from

    sdmmc_host_t host = {
        .flags = SDMMC_HOST_FLAG_4BIT,
        .slot = SDMMC_HOST_SLOT_1,
        .max_freq_khz = SDMMC_FREQ_DEFAULT,
        .io_voltage = 3.3f,
        .init = &sdmmc_host_init,
        .set_bus_width = &sdmmc_host_set_bus_width,
        .get_bus_width = &sdmmc_host_get_slot_width,
        .set_bus_ddr_mode = &sdmmc_host_set_bus_ddr_mode,
        .set_card_clk = &sdmmc_host_set_card_clk,
        .do_transaction = &sdmmc_host_do_transaction,
        .deinit = &sdmmc_host_deinit,
        .io_int_enable = &sdmmc_host_io_int_enable,
        .io_int_wait = &sdmmc_host_io_int_wait,
        .command_timeout_ms = 0
    };

to

    sdmmc_host_t host;
    host.flags = SDMMC_HOST_FLAG_4BIT;
    host.slot = SDMMC_HOST_SLOT_1;
    host.max_freq_khz = SDMMC_FREQ_DEFAULT;
    host.io_voltage = 3.3f;
    host.init = &sdmmc_host_init;
    host.set_bus_width = &sdmmc_host_set_bus_width;
    host.get_bus_width = &sdmmc_host_get_slot_width;
    host.set_bus_ddr_mode = &sdmmc_host_set_bus_ddr_mode;
    host.set_card_clk = &sdmmc_host_set_card_clk;
    host.do_transaction = &sdmmc_host_do_transaction;
    host.deinit_p = &sdspi_host_remove_device;
    host.io_int_enable = &sdmmc_host_io_int_enable;
    host.io_int_wait = &sdmmc_host_io_int_wait;
    host.command_timeout_ms = 0;

The first one is more informative, clear, and concise.

@CLAassistant
Copy link

CLAassistant commented Sep 3, 2021

CLA assistant check
All committers have signed the CLA.

@me-no-dev me-no-dev merged commit 3f06a38 into espressif:master Oct 1, 2021
@me-no-dev
Copy link
Member

Thanks @dizcza :)

@dizcza
Copy link
Contributor Author

dizcza commented Oct 3, 2021

It ain't much but it's honest work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants