Hi! I want to use the RA8875 driver from Adafruit to control a large TFT Screen. I also want to use a separate SD Card Reader. To my knowledge, both of these devices use SPI communication. So how can I use them both with one Arduino? (Either a Mega or a Due)
Wire them to the same pins except for the Chip Select ( CS ) drive each one from a different pin, and put just that pin low on the device you want to talk to.
If the two devices do not work with the same voltage levels as the Arduino you have to add signal level shifting.
The RA8875 from Adafruit doesn't release the MISO pin. You can't share an SPI bus with this device.
You need to put a switch into the MISO line so that it will only pass data from the RA8875 when the CS for that is asserted. So far, I've never had to do this, so I don't have a circuit diagram close to hand.
Alternatively, put one of the devices on a software SPI - use any other pins on the Arduino. Software SPI will be significantly slower, so I would pick whatever device has less data to be transferred.
Robin2:
Some of the SD Card readers are also reluctant to share.
lnot so much the reader but he way you operate them. You can't leave a file open when you access another device because the act of sending the SD card's chip select line low closes the file.
MorganS:
The RA8875 from Adafruit doesn't release the MISO pin. You can't share an SPI bus with this device.
You need to put a switch into the MISO line so that it will only pass data from the RA8875 when the CS for that is asserted. So far, I've never had to do this, so I don't have a circuit diagram close to hand.
Alternatively, put one of the devices on a software SPI - use any other pins on the Arduino. Software SPI will be significantly slower, so I would pick whatever device has less data to be transferred.
Software SPI? That exists??? Where can I find information on it? Is it like Software Serial?
Grumpy_Mike:
lnot so much the reader but he way you operate them. You can't leave a file open when you access another device because the act of sending the SD card's chip select line low closes the file.
Interesting.
I don't have one of the "errant" devices and my DIY reader does not have a problem but there have been several Threads in which people had difficulty using an SD Card reader with another SPI device.
I don't have one of the "errant" devices and my DIY reader does not have a problem but there have been several Threads in which people had difficulty using an SD Card reader with another SPI device.
...R
So can I connect my screen to what you called 'Software SPI'? I've been researching, and while I now understand SPI - 'Software SPI' confuses me.
I understand that you can have 2 devices connected to one SPI, but you're saying that I'll have to close the file every time I want to write to the LCD? Yikes. I really won't be able to use them at the same time.
One question: If I were to use it, how much slower is Software SPI than regular SPI. If I were to connect my LCD with Software SPI, would I notice a major difference?
stupid-questions:
So can I connect my screen to what you called 'Software SPI'? I've been researching, and while I now understand SPI - 'Software SPI' confuses me.
I understand that you can have 2 devices connected to one SPI, but you're saying that I'll have to close the file every time I want to write to the LCD? Yikes. I really won't be able to use them at the same time.
One question: If I were to use it, how much slower is Software SPI than regular SPI. If I were to connect my LCD with Software SPI, would I notice a major difference?
Software SPI is unusual because it's rarely needed.
No, the RA8875 absolutely does not allow any other device on the same SPI bus. You have to split the bus to get the RA8875 off the MISO line that it's always sitting on.
Software SPI will be slower by a factor of 10-100. You will notice the LCD goes slower unless you are doing extremely simple things with it. The RA8875 is a good chip, so most operations are in the "extremely simple" category. It only has to send a small command over the SPI to draw a line or a box but drawing an arc will require lots of SPI data.
The Adafruit wav shield uses bit banging for the SPI protocol of the D/A converter because the SD card can not keep a file open without the chip enable being active. While bit banging is slow you can speed it up by using port addressing to do the digital write and read functions.