# Level Translator for AVR and microSD

I want to connect a microSD card in my AVR ATMEGA32, through SPI, which its operate with 5V. The microSD card i think that operates with 3.3V so, it is must to connected via bidirectinal level translator.

I found this TI's translator http://www.ti.com/lit/ds/symlink/txs0101.pdf . which its accepts any voltage from 1.65V to 3.6V in input A, and 2.3V to 5.5V in input B.

My matter is: Can i direct wire the chip's I/O between AVR and microSD? or it's only, as the datasheet say, "for open-drain and push-pull applications"?

• What's the model of your microSD? – diverger Nov 15 '14 at 12:07
• Thank You for your reply. I haven't choose the model of my microSD yet. So, i suppose if there's a model which support direct connection via my translator, i will choose it. – MrBit Nov 15 '14 at 12:20
• As diverger points out, the spec of your SD card may make a good deal of difference as to whether this will work. Newer standards are at 1.8V or even lower. That said, the (freely published version of the) SD card specification is pretty clear that any SD card should work in the 3.3V modes (although not necessarily at anything near the potential speeds of the newer standards). The TXB0106 may be a better bet than the TXS0101 for SD, because it uses push-pull drivers instead of open-drain/collector. – markt Nov 15 '14 at 12:21
• Yes i agree for the TXS0106, its much more efficient. The input A supports any voltage from 1.2V to 3.6V therefore i think that it supports any microSD cards which operates in this voltage area. Right? – MrBit Nov 15 '14 at 12:27
• What's stopping you from just running the AVR at 3.3V? – Matt Young Nov 15 '14 at 14:19

The SD specification stipulates 2.7V - 3.6V for all IO and power. Using any other voltage will most likely cause death to your SD card.

Assuming you are running the SD card in SPI mode (most common for small microcontrollers), then you don't need to translate the signal from the SD card to the ATMega32, since 3.3V is a valid HIGH input even when running at 5V.

You will need to translate the 5V from the ATMega32 to the SD card though, and that will only be one way. A simple 74-series buffer or logic gate of almost any kind will do the job. A common one is the 74HC08 AND gate, with both inputs of a gate tied together to form a buffer. Run the chip from 3.3V, feed the 5V signals directly into the inputs via a small series resistor (say 1KΩ) and it should translate the 5V signals to 3.3V quite happily.

simulate this circuit – Schematic created using CircuitLab

The 74HC08 (in common with the other 74HC series chips) has quite robust input clamping. Any voltage that is more than Vcc + 0.5V, so anything above 3.8V in this case, gets routed through input clamping diodes to the Vcc rail, clamping it at Vcc + 0.5V, so 3.8V. That current should be limited to below the "input clamping current limit", which is 20mA limit. The 1KΩ resistors limit the current to a tiny ($5 - 3.8 = 1.2, \frac{1.2}{1000} = 0.0012$) 1.2mA.

• And the inputs of AND gate can driven directly or with a voltage divider though? – MrBit Nov 15 '14 at 13:11
• All you need is a single small resistor to limit the current. The HCT series has an "input clamping current" limit of around 20mA, so a 1KΩ resistor to keep currents low would be all that's wanted. – Majenko Nov 15 '14 at 13:13
• In Vcc+0.5V, = 3.3+0.5V AVR output it's much more high voltage (5V) – MrBit Nov 15 '14 at 13:18
• Pardon? I didn't understand that line and what it has to do with anything? – Majenko Nov 15 '14 at 13:19
• And for what reason we'll must select this circuit instead of TI's translator? What's the positive and negatives? – MrBit Nov 15 '14 at 13:29

SD Card's supply voltage is a "standard", in SD specifications, part 1, Physical Layer Specification version 4.10, it states the operation voltage should be 2.7V~3.6V, so you can safely use it with 3.3V.

If your microSD's I/Os are 5V tolerant, then you certainly can directly connect them, but i've never seen such a card. And for voltage translator, TXS0106 should be OK, and the old 74LVC4245A may be a choice too. In NXP's doc: http://www.nxp.com/documents/application_note/AN10911.pdf, most I/Os are push-pull, so use a translator with push-pull output maybe better.

• But, how can i see my microSD Voltage operation? – MrBit Nov 15 '14 at 12:39
• When you buy one SD card, they should have vendor and model information on it, then you can goto their site and get the docs about them. – diverger Nov 15 '14 at 12:43
• I have one of this microSD sandisk.com/products/memory-cards/microsd/… – MrBit Nov 15 '14 at 12:47
• In their site there's nothing about document information – MrBit Nov 15 '14 at 12:57
• Sorry i can't find the information about if it's 5V tolerant, so you should assume it's not 5V tolerant, i've never saw SD Cards with 5V tolerant. In one old doc from SandDisk: sandisk.com/pdf/oem/ProdManualSDCardv1.9.pdf, in Table 3-6, it states the I/O limits, but not know if applied to their newer products. – diverger Nov 15 '14 at 12:58

your atmega should be 3.3V high state tolerant so you can use incoming data without level translating and to the sd card you can use simply resistor voltage divider. I used that setup with uart with pics and worked well.