Issues Using Multiple SPI Buses w/ HW-CS

User avatar
Fuzzyzilla
Posts: 22
Joined: Sun Apr 23, 2017 3:19 am

Issues Using Multiple SPI Buses w/ HW-CS

Postby Fuzzyzilla » Wed Jul 05, 2017 9:22 pm

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?

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Thu Jul 06, 2017 1:28 am

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?

User avatar
Fuzzyzilla
Posts: 22
Joined: Sun Apr 23, 2017 3:19 am

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

Postby Fuzzyzilla » Fri Jul 07, 2017 8:04 pm

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!

Who is online

Users browsing this forum: No registered users and 122 guests