0
\$\begingroup\$

I have an ATtiny861 microcontroller powered directly from a Lipo battery. My circuit is designed to operate on supply voltages from 3V - 4.2V (bonus if it tolerates up to 4.6V).

I need to interface with a MicroSD card, which works around 3.3V. I'm using this datasheet from Kingston as a reference (feel free to point me toward a more authoritative spec).

I'm looking for suggestions on sourcing (or building) a level shifter that tolerates the entire 3V-4.2V range on one side, and 3.3V on the other. Initially I looked at the TXB0104 but it's inappropriate because it requires one side always remain lower than the other. (I suppose I could run my SD card under-voltage, eg. at 2.9V, but I'm hoping there's a better way).

Also note I'd like to minimize part count, routing complexity and footprint (in roughly that order).


A few more details:

I only need to read the card, and am limiting myself to SPI mode. That means three unidirectional "output" lines from the uC to the SD (CLK, CMD, CS/DAT3), and one unidirectional "input" line from the SD to the uC (DAT2).

Running the uC at 3.3V isn't an option I'm considering. It spends most of it's time sleeping, and periodically wakes to see if activity is required. I figure putting a linear or buck converter between the battery and uC would likely waste some power due to conversion losses during these periods. It would also necessitate a redesign of some other parts of my circuit.

I'm powering the SD card with a 3.3 buck regulator (PAM2301CAAB330) which is shut down when I'm not reading the card (nor using other devices sharing the same enable line).

I could probably do a quick-and-dirty hack by wiring the input directly to the uC, and the three outputs through voltage dividers. It might work at "typical" values, but would violate the min/max specs of the components.

Some helpful tidbits from the datasheets:

uC input HIGH min: 0.7 * Vcc (so down to 2.1V)
uC input LOW max: 0.2 * Vcc
uC output HIGH min (@3V Vcc): 2.5V
uC output LOW max (@5V Vcc): 0.6V

SD Vdd: 2.7V - 3.6V
SD input HIGH min: 0.625 * Vdd
SD input LOW max: 0.25 * Vdd
SD output HIGH min: 0.75 * Vdd
SD output LOW max: 0.125 * Vdd
\$\endgroup\$
  • 1
    \$\begingroup\$ Related question: Do high and low side labels on bidirectional logic level converters matter? \$\endgroup\$ – rkagerer Aug 4 at 3:42
  • \$\begingroup\$ I'm presently investigating TI's SN74LVC1T45 transceiver which I think may not require one side to always be higher than the other. Would be great if I could find a "quad" version, especially with less Direction pins. \$\endgroup\$ – rkagerer Aug 4 at 4:19
  • \$\begingroup\$ You could try using the lowly (in today's world of switching converters) 3.3v Zener to power the SD card. Just that, with appropriate series resistor, might be all you need. Check it out! \$\endgroup\$ – Kripacharya Aug 4 at 5:24
  • \$\begingroup\$ @Kripacharya: Thanks for the suggestion! Do you mean using Zeners on uC output lines instead of a voltage divider, or as an alternative to my PAM2301CAAB330? I shied away from the latter since the SD card will draw a varying amount of current and I wasn't sure just how much that range (esp. peaks) narrows when use is restricted to just reading (although tests indicate an average might be around 10mA). \$\endgroup\$ – rkagerer Aug 4 at 5:34
  • \$\begingroup\$ Not on the lines. Only to power the SD card. \$\endgroup\$ – Kripacharya Aug 4 at 5:37
1
\$\begingroup\$

For the 3 output signals, use a 74LVC3G16 triple logic buffer with Vdd connected to the SD Card 3.3V supply. This logic family's inputs can take up to 6.5V and have no Vdd clamp diodes, so the ATtiny can safely drive them even when powered with 4.2V.

For the input side you might just get away with a direct connection. Input high voltage of the ATtiny is permitted to go +0.5V above Vcc, but you are powering the SD Card through a step-down converter so it cannot output a voltage higher than the battery voltage anyway.

With a fully charged battery the ATtiny could get as much as 4.2V, while the SD Card's logic high output is nominally 3.3V. This gives a logic high level at the MCU of 3.3/4.2 = 79%, which is above the required minimum of 70%. However the SD Card spec says it might only manage 0.75 * Vdd which is not enough. To ensure that the output reaches 3.3V you could use a 74LVC1G16 single buffer gate.

You might also consider redesigning the circuit work with the MCU's power supply regulated to 3.3V. Regulators such as the MCP1700 have quiescent current of less than 2uA, and will help prevent possible misoperation of the MCU due to rapid supply voltage changes.

\$\endgroup\$
  • \$\begingroup\$ Thanks! I just finished checking all the edge cases for a SN74LVC1G34 and will check out your recommendation for the denser buffer IC. I don't think a direct input is quite fully in spec, as SD's min. guaranteed HIGH output is 0.75 * 3.3V = 2.475V, while the ATtiny requires a min. HIGH input of 0.7 * 4.2V = 2.94V. So I may be safer with the quad version. Thanks for the tip about the MCP1700! \$\endgroup\$ – rkagerer Aug 4 at 9:53

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.