Skip to content

SD_MMC library issue with BOARD_HAS_1BIT_SDMMC #3903

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

Closed
Stanimir-Petev opened this issue Apr 13, 2020 · 7 comments
Closed

SD_MMC library issue with BOARD_HAS_1BIT_SDMMC #3903

Stanimir-Petev opened this issue Apr 13, 2020 · 7 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@Stanimir-Petev
Copy link
Contributor

Hardware:

Board: ESP32-Gateway
Core Installation version: 1.0.4
IDE name: Arduino IDE 1.8.10
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10

Description:

I tried to use the example sketch from SD_MMC library: SDMMC_Test in 1Bit mode. SD card example itself works without problems. But the other 3 pins that are not used in this mode behave like they have been initialized as alternative function so they can't be used as GPIO (I have attached LED on them and tried to blink it). After some research I have found a way to solve the problem but it involved editing the library itself.
In the file SD_MMC.cpp lines 65-67 by default are:

    if(mode1bit) {
        host.flags = SDMMC_HOST_FLAG_1BIT; //use 1-line SD mode
    }

That changes the mode from 4 to 1 bit, but based on what I saw it doesn't change slot_config structure and thus the pins to be initialized. So I added one line within the body of the if operator and is now:

    if(mode1bit) {
        host.flags = SDMMC_HOST_FLAG_1BIT; //use 1-line SD mode
        slot_config.width = 1;
    }

So now it works but I am not sure if this is the best approach to the problem since I have to change library file. Is there another way to be done? If no - is there any chance to see fix for that in one of the future official releases of the Espressif package?

Sketch:

Basically the sketch is the default example SDMMC_Test + added blinking LED on pin 4 and the setup - attached LED on pin 4.
SDMMC_Test_toggle_4.txt

@DanKoloff
Copy link
Contributor

I can confirm this problem exists for both SD card libraries from the examples ("SD_MMC" and "SD"). Defining 1-bit SD card mode still bugs the pins that are used by default for 4-bit SD card mode.

@lbernstone
Copy link
Contributor

If you fork the repository, edit the file (right in your browser), and submit a PR, then this can be fixed.

@Stanimir-Petev
Copy link
Contributor Author

I tried that now. I committed that change into my fork repository. But since I already had a pending pull request (from ~3 weeks ago) it got affected too. Before the commit (on the SD library) the previous pull request had 21/21 checks passed but now is 0/0 and has a yellow dot on it.
What am I supposed to do?
Delete the old PR and create a new one?

@lbernstone
Copy link
Contributor

No, I didn't know you had a pull pending. If you have multiple PRs you need to make a new branch for your new change. Google knows a lot about working with git and github.

@cyberman54
Copy link
Contributor

This issue can be closed.
Fixed by #4020
@Stanimir-Petev

@stale
Copy link

stale bot commented Aug 5, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Aug 5, 2020
@stale
Copy link

stale bot commented Aug 21, 2020

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests

4 participants