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 Card fails to initialize when using M5Stack Core2 v1.0 and Lora 868 v1.0 and M5GFX library with shared SPI bus #114

Open
ifrew opened this issue Jan 23, 2025 · 0 comments

Comments

@ifrew
Copy link

ifrew commented Jan 23, 2025

I upgraded to using the M5Unified.h library from the previous M5Core2.h library and now using V3 of the esp32 Ardunio core framework. M5Unified uses 0.2.1 and M5GFX is currently 0.2.0

When the Lora board is attached the SD fails to initialize. When not attached it works fine. The Lora pins used are

#define SS_PIN 33 //5 for m5stack and 33 for m5core2 using Lora 1.0, 15 Lora v1.1
#define RST_PIN 26
#define DIO0_PIN 36
#define DIO1_PIN -1
#define SPI_MOSI 23 // SPI MOSI pin
#define SPI_MISO 38 // SPI MISO pin
#define SPI_SCK 18 // SPI SCK pin

On using the espi_TFT library with the previous M5Core2.h library all works fine. I have a 4.7Kohm pullup resistor on the Lora CS pin 33 and I have set the pinmode to OUTPUT.

I had similar issues with the espi_TFT library because the SPI bus was shared but adding the pullup and setting the pinmode to output on the CS pin fixed that issue.

I am assuming that this has to do with the shared SPI bus as I have seen many posts with similar issues. However. I do not see any pin conflicts here but I remember that this library does an autodetect and I am wondering if during that phase the SPI bus gets corrupted?
Interestingly, this ONLY happens when power is applied for the first bootup. When I see the card failure, after removing and reinserting the sd card again and doing a reset of the device while power is still applied it see's the SD card and all works fine!!! However, at boot up this fails. This device is used for no user intervention and is in a emote location so I need it to work if power is lost and is resumed at a later time.

I've been working on this issue for over a week now with no success. Any insights appreciated.

Cheers

Iain

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

No branches or pull requests

1 participant