📬❄️📦Adafruit Holiday Shipping Deadlines 2019: Please place all UPS 3 Day orders by 11am ET Friday December 13 📬❄️📦
0

RA8875 with SD Card
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

RA8875 with SD Card

by jddj_88 on Wed Nov 20, 2019 4:33 pm

Hello,

I have purchased a 7" tft LCD non touch screen, the RA8875, and the adafruit microSD card breakout board. I would like to be able to display images saved to the SD card to the LCD. I see the note that;

"the RA8875 does not tri-state the MISO pin, it should not share that pin with any other SPI device (including an SD card reader) without the use of a 74HC125 or similar"

I have been searching the forms for many hours and see many others have asked to question on how connect the 74HC125. Many of the answers refer to the post from paul stoffregen https://forums.adafruit.com/viewtopic.php?f=47&t=60533&start=45 with a picture of his set up, however i can not follow what he is doing with all the white wires and extra resistors.

It looks like at some point there was a drawing from Local_Dani_21 showing what i am looking for on this page https://forums.adafruit.com/viewtopic.php?f=47&t=60533&start=60 but the picture is no longer up.

Does any one have a diagram on how to wire the 74HC125 in this situation?

Thanks

jddj_88
 
Posts: 3
Joined: Wed Nov 20, 2019 3:42 pm

Re: RA8875 with SD Card

by adafruit_support_mike on Thu Nov 21, 2019 3:23 am

The 74AHCT125 is a quad tri-state logic buffer, meaning it has four sets of three pins named A, Y, and /OE.

- The A pin is the input
- The Y pin is the output
- The /OE pin enables or disables the output

When the /OE pin is high, the Y pin stays in high-impedance mode, regardless of the voltage at the A pin. When /OE is low, the Y pin's voltage has the same logic value as the A pin.

To use a 74AHCT125 to make an SPI device behave properly, it's easiest to connect all four of the SPI signals to the A pins: MOSI, SCK, and CS from the microcontroller, and MISO from the RA8875 (or whatever). Then connect the Y pins to their corresponding inputs: MOSI, SCK, and CS on the RA8875, and MISO on the microcontroller.

Then connect the CS signal to all of the /OE pins.

An SPI slave device is disabled when its CS pin is high, and the 74AHCT125's outputs are all tristated when its /OE pins are high. Under those conditions, the SPI slave device is basically disconnected from the microcontroller's SPI bus.

An SPI slave device becomes active when its CS pin is low, and the 74AHCT125's Y pins are all enabled when its /OE pins are low. Sending the CS-or-/OE signal low basically reconnects the SPI slave device to the microcontroller.

adafruit_support_mike
 
Posts: 59692
Joined: Thu Feb 11, 2010 2:51 pm

Re: RA8875 with SD Card

by jddj_88 on Thu Nov 21, 2019 7:07 pm

Hello Mike,

Thanks for the response, I am pretty new to electronics and am working on understanding how these components work together. Originally i was thinking i would be running the MISO lines and corresponding CS lines from each SPI device thru the 74AHCT125 to the arduino and running the SCK, and MOSI lines in parallel directly from the arduino to each device.

From your response i am getting that one device will be wired directly to the 4 SPI pins on the arduino and the other device will have the 4 SPI wires going from the arduino to the 74AHCT125 then to the device? It seems to me when the /OE pin enables output both devices would be sharing the lines as if the 74AHCT125 was not even there?

Did i misunderstand something?

Thanks for the help

jddj_88
 
Posts: 3
Joined: Wed Nov 20, 2019 3:42 pm

Re: RA8875 with SD Card

by adafruit_support_mike on Fri Nov 22, 2019 1:45 am

jddj_88 wrote:Originally i was thinking i would be running the MISO lines and corresponding CS lines from each SPI device thru the 74AHCT125 to the arduino and running the SCK, and MOSI lines in parallel directly from the arduino to each device.

That should also work, but isn't quite as bulletproof.

Devices that don't release MISO assume they'll be the only thing connected to the microcontroller, and some continue to listen to MOSI and SCK even though their CS pin is high. They don't create problems for other SPI devices that way, but messages for other SPI devices can confuse the one that thinks it's the only one there.

Using tristate buffers for all four signals makes it impossible for such a device to cause problems on MISO, or to listen to things it shouldn't on MOSI. I don't remember if the RA8875 needs to be treated that way off the top of my head, but the 74AHCT125 has four buffers and it doesn't cost anything to use all of them.

If the 74AHCT125 is a new device for you, spend half an hour playing with it using an LED and a breadboard. Connect the LED to one of the output (Y) pins, use a jumper from the corresponding input (A) pin to VCC or GND, and use another jumper from the /OE pin to VCC and GND. Get a feel for how the signals work together. Once you have an intuitive feel for what happens to the signals, you'll find it easier to use the 74AHCT125 to manage the RA8875's SPI signals.

adafruit_support_mike
 
Posts: 59692
Joined: Thu Feb 11, 2010 2:51 pm

Re: RA8875 with SD Card

by jddj_88 on Fri Nov 22, 2019 2:26 pm

Thanks Mike, I have one on order and will give it a try when it arrives.

jddj_88
 
Posts: 3
Joined: Wed Nov 20, 2019 3:42 pm

Please be positive and constructive with your questions and comments.


cron