3
\$\begingroup\$

I'm faced with an interesting challenge: I'm using a microcontroller with 3.3 V logic, but I need to use a SPI (4-wire) interface with parts operating at three logic levels, namely 1.8, 3.3, and 5 V. Obviously 3.3 V isn't a problem, but I'm curious about the best way to handle the 1.8 and 5 V components. Of course I could use two discrete level translator ICs, but I'm hoping there's a simpler (i.e. cheaper, smaller footprint) solution. I already have ways to generate the voltage supplies, so that isn't an issue.

I'm aware of the following MOSFET level translation technique, which I understand well enough:

enter image description here

This allows a 3.3 V signal from the µC (from the left) to shift up to 5 V to a certain device (to the right). (It would have to be backwards for MISO.) I could similarly change the voltage on the right to 1.8 V to shift down for a different device. Here is my issue: If I were to simply switch the voltage between 5 and 1.8 V, I would almost certainly destroy the 1.8 V pins when at 5 V. Is there an elegant technique for allowing a shift to two different levels, or will I have to suck it up and use two separate circuits for the two translations?

\$\endgroup\$
  • \$\begingroup\$ Every signal line is one directional. A 4 channel isolator ic with tolerance to different supplies can be used. Ti makes some RF based ones that behave like fast optocouplers. \$\endgroup\$ – crasic Nov 12 '15 at 22:08
  • \$\begingroup\$ In my experience, I've only ever found ones that require one side be the higher voltage of the two. Do devices exist that allow lowering as well as raising the logic level? \$\endgroup\$ – dpwilson Nov 12 '15 at 22:11
  • \$\begingroup\$ Yes, I have used these with success on SPI bus \$\endgroup\$ – crasic Nov 12 '15 at 22:17
2
\$\begingroup\$

The first thing you need to do is look at your parts specifications more carefully. You may find that some of your links don't actually need translation at all. What are the input thresholds, are the inputs tolerant of voltages outside the power rails. It's pretty common for 3.3V devices to have 5V tolerant inputs. I don't know about 1.8V devices.

With the mosfet trick you only need one pullup to each rail, also if the translation is unidirectional and the driver is not using an open collector output you only need the pullup on the output side.

You also need to think about speed. At low frequencies the mosfet trick is fine but because of it's open collector nature it doesn't scale well to high frequencies. The resistors must be low enough value to charge the stray capacitance quickly enough to bring the lines to their appropriate "high" level in time. To an extent you can use smaller resistors to speed things up but then the higher currents cause more volt drop in the switching devices (both the level shifting mosfet and the output drivers in your devices) which may cause problems.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thanks for the answer. I don't have any issue with the 3.3V devices—since that's the level my µC uses—so having 5V-tolerant pins is irrelevant. The 5V parts have logic high of 0.7*Vdd = 3.5V, so I definitely have to shift up for those. The 1.8V devices are spec'd to a max of ~2.1, so I definitely have to shift down for those. As for speed, I need this to operate up to 10 MHz, which might be pushing it for the single-transistor implementation. Anyway, you've given me something to think about. \$\endgroup\$ – dpwilson Nov 12 '15 at 18:26
  • \$\begingroup\$ At those kinds of speeds i'd certainly be looking at using proper level shifters (with explicit output enable pins if needed) as the preffered soloution. \$\endgroup\$ – Peter Green Nov 12 '15 at 18:31
  • \$\begingroup\$ That's what I had assumed but was hoping to avoid going into this escapade. Thanks for you help! \$\endgroup\$ – dpwilson Nov 12 '15 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.