Author Topic: 5V to 3.3V SPI with a second device...  (Read 854 times)

0 Members and 1 Guest are viewing this topic.

Offline alank2Topic starter

  • Super Contributor
  • ***
  • Posts: 2196
5V to 3.3V SPI with a second device...
« on: March 07, 2018, 02:03:14 am »
I'm going to have a 5V AVR with 2 SPI devices.  One will be a SD card (3.3V) and the other will be a SPI RTC (1.8V-5.5V).

There seem to be a million ways to level convert with various IC's!

Would you put both devices on the 3.3V side, or level convert for the SD only?

Would you level convert what is coming back FROM the SPI device (MISO)?  I would think that would be the proper way to do it even thought 3.3V would probably drive the 5V input ok.
 

Offline jbb

  • Super Contributor
  • ***
  • Posts: 1231
  • Country: nz
Re: 5V to 3.3V SPI with a second device...
« Reply #1 on: March 07, 2018, 04:41:29 am »
This looks like a 50/50 question.

First up, can you just make everything 3.3V and avoid the problem?

If not, I thoroughly recommend you use a level converter for MISO so that you get reliable signalling. It could be a dedicated chip or just a MOSFET and pull-up resistor.

If you have the RTC on 5V, the advantage is that you can test the RTC before fitting the level converter chip and SD card. The disadvantage is that the level converter must release the MISO line so the RTC can talk.

If you have 3.3V on the RTC it may be easier to find a replacement RTC if necessary, and the level converter won’t have to release MISO.
 

Offline alank2Topic starter

  • Super Contributor
  • ***
  • Posts: 2196
Re: 5V to 3.3V SPI with a second device...
« Reply #2 on: March 07, 2018, 04:47:40 am »
Must stick with 5V.

Ok, what about:

74LVC125 for driving the MOSI, SCK, SD_SS, and possibly RTC_SS in the outgoing direction.  It tolerates 5.5V and can have its VCC connected to 3.3V.

Then in the other direction, I found a single SN74AHCT1G125DBVR for MISO.  It is a TTL part so it should go high at 2V and can be powered at 5V.

The SN74AHCT1G125DBVR also has an OE that could be connected to SD_SS from the AVR so it would only have its output active when the SD is selected with SD_SS.

Then I could put the RTC on the 5V side.  Or it could be put on the 3.3V side if that OE was just tied low all the time.  Any benefit either way?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf