Page 1 of 1

Issues Using Multiple SPI Buses w/ HW-CS

Posted: Wed Jul 05, 2017 9:22 pm
by Fuzzyzilla
Hello!

I have two libraries that run off of the same MISO, MOSI, and SCK: A ST7735 TFT library that I wrote and the built-in SPI SD library.

With some modification to both, I was able to get them to run side-by-side. However, for some reason, changing the SPI speed or setting "useHwCs" on the LCD library one breaks the SD Library ("read/write failed", "could not mount", etc) despite them being on different buses (VSPI and HSPI, respectively).

This is super annoying because it makes the LCD run at the SD's speed (wayyyy to slow to refresh a screen in a reasonable amount of time :P )

What's the cause of this? How can I work around it?

Re: Issues Using Multiple SPI Buses w/ HW-CS

Posted: Thu Jul 06, 2017 1:28 am
by ESP_Sprite
I'll see if I can look into this. Meanwhile, can you find out *why* this breaks communication? As in: signal-wise, what happens that shouldn't happen?

Re: Issues Using Multiple SPI Buses w/ HW-CS

Posted: Fri Jul 07, 2017 8:04 pm
by Fuzzyzilla
Hmmm, that might be a challenge! I do not have an oscilloscope, how else could I test it?

I could give some more details, though!

If I change the SPI speed, the screen works fine. The SD card initializes, reads properties (Name, type, size) but then fails to read, write, rename, or open files.

If I set the screen to useHwCs, the screen fails to initialize, and so does the SD card ("SD Mount Failed").

If I change no settings, and instead manually update the screens CS pin with digitalWrite, both the screen and SD card initialize and work. However, the SPI speed the SD card uses is too slow to update the screen at a reasonable pace!

Thank you for investigating!