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

CS_Pin has to be driven high on ESP32 (to be low at the SDCARD) because of some logic inbetween #487

Open
ImkereiWetzel opened this issue Jun 11, 2024 · 3 comments

Comments

@ImkereiWetzel
Copy link

Hi,

is there a way to drive the CS_Pin manually, because I have used a little quirk because of lack of pins.
My CS-Pin driven low, drives TFT-CS low and SD-CS high, and if CS-Pin driven high exactly the other ways around.

Thanks in advance

@greiman
Copy link
Owner

greiman commented Jun 12, 2024

I can't suggest a solution since I have no idea what hardware you have.

SdFat does have an option for using a port expander. but this is probably not practical.

You would need to provide the two functions described here.

Also here for another expander.

@ImkereiWetzel
Copy link
Author

Thanks! I have an ESP32 and connected is an Adafruit 3.5 TFT w/ capacitive touch w/ onboard SD slot.
I already use multiple port expanders for other purposes, so my solution uses a little single gate inverter (NOT-Gate) to select the lcd if the pin is low, and select the SD if high.
I will try to define my own functions and will come back if it works.

@greiman
Copy link
Owner

greiman commented Jun 13, 2024

my solution uses a little single gate inverter (NOT-Gate) to select the lcd if the pin is low, and select the SD if high.

It won't work. CS needs to be toggled in many places in the SD driver and is not just low when the driver is active. CS must not go low at random times since this may change the state of the SD.

It may sort of work but you will see instability.

SPI mode for SD cards barely works since the cards are designed for SD mode which is a very different protocol.

Here is one of the strange requirements for SPI on SD cards. It assumes no other device is active even though CS is high.

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

2 participants