-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
TTGOV2 SD card support #1190
Comments
looking at the pinout for that board: and comparing to an example sketch: it looks like you need to use the SD_MMC library, give that a try? |
Nope does not work |
when you say doesn't work, what does happen? there is more than one way that sketch might "not work" |
It failed to mount. Im using a micro sd. SDHC formatted to fat32 |
are you able to turn on extra logging? |
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) |
i was looking more for error messages like this one: those error messages seem to come from the ESP IDF, and not in the arduino libraries. |
I have not turn on extra logging. How am i suppose to enable it? |
Failed to initialize the card (263). Make sure SD card lines have pull-up resistors in place. |
sorry, not sure i can help you any further. I don't know if 10k is the correct value though. only thing i can suggest trying would be commenting out this line to try running at a slower speed? |
Did that still giving the same error message. Thanks for the help though |
what about if you change it to a much lower speed? |
alternatively try changing your begin call to: |
still getting the same error. |
what about using the normal SD lib, but set up the SPI before passing it in. so this example with the setup changed from:
to:
|
@JamesGKent yup it worked flawlessly!! Thanks :D! |
wow, that was a total shot in the dark... |
Thanks a bunch for the help and the great follow up explanation.
…On Mar 9, 2018 7:35 PM, "James" ***@***.***> wrote:
wow, that was a total shot in the dark...
btw just to clarify from my reading here
<http://elm-chan.org/docs/mmc/mmc_e.html> SD cards can be used in 3
modes, one of which is SPI and the other two are SD specific. on AVRs the
SPI mode is normally used because there is hardware built in for it, so it
is faster that software emulating either of the other two modes. on the ESP
it looks like we have the MMC hardware to use the other two modes natively.
I believe those other two modes (particularly the 4 bit mode) should be
faster than SPI, however for you it seems that this didn't work.
when using the SD_MMC lib the 4 bit is the default unless the board
definition says only 1 bit mode is available, so the default didn't work,
my suggestion of using begin("/sdcard", true); should have activated 1
bit mode, which also didn't work. so my last suggestion using the normal SD
lib is using SPI, but configuring the pins of the SPI interface onto the
pins normally used by MMC.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1190 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AY0YQvpI25P2GbVNqMXWxSLnEbTqkDBxks5tcmjugaJpZM4SgRRg>
.
|
@JamesGKent I shared your finding in the Wiki. Thank you. |
@beegee-tokyo would it not be worth trying to add some explanation as to what the setup is doing? |
@JamesGKent You are right, will add some more info to it. Don't have such a board either, so I cannot test anything. |
If i insert a FAT formatted SD card in the card reader slot of my TTGOv2 board, and restart it, it seems trying to boot from SD card:
Any hint how to avoid this and boot from internal flash? |
For the record: this exact solution works also for the LilyGO ESP32 TTGO T4 V1.1 board. You can see this board and the pins used for SD card connection here: https://github.com/LilyGO/ESP32-TTGO-T4 |
@JamesGKent Thanks a lot! |
Have a look at https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card#note-about-gpio12 After having similar problems I followed the espefuse.py set_flash_voltage 3.3V suggestion and all problems went away. I think this is a irreversible operation. |
@JamesGKent thank you very much! I'm now able to use an SD card on a TTGO LoRa32 V2.1 board. Cheers! |
If anyone else runs into this, the problem is that the pins_arduino.h header file has the wrong SPI pins for the TTGOV2 board (it has the V1 pins). You can either manually update your pins_arduion.h file or follow @JamesGKent recommendation in #1190 (comment) and manually initialize the SPI library with the correct pins. By default, the SD library will automatically call the SPI library with the pins (incorrectly) defined by the boards header file. This has been reported in platformio/platform-espressif32#344 |
Has anyone manage to get the SD card library working with this (https://github.com/LilyGO/TTGO-LORA32-V2.0) board. Or is there any other library that you guys can recommend.
The text was updated successfully, but these errors were encountered: