I'm not sure I fully understand the requirements around level shifting.
I have a 5v atmega1284 that I wish to use with a 3.3volt uart (to a xbee device). I was planning on using the 74HC4000 for the TX lines from the atmega and take the RX lines directly from the device into the Arduino. Is that the normal plan, or should I look at using something like the TXB0104 and have both lines shifted?
I have the same issue with SPI to a SD card. I was planning on using the 74HVC and shifting the sck, MOSI and chip select, and having the MISO directly to the arduino. Same question applies - should I look at the TXB01xx. Or are there better solutions?
I would default to the TXB device, but cost are about twice as high. Not a big deal if I only make one of these, but want to know the implications of doing larger scale.
seems you can if you run it at 12mhz. I've heard you might get away with 3.3, but no guarantees it will work, or will work correctly. Am I mistaken about that? I would love to just run it at 3.3
Here are some alternative methods of level shifting:
To convert a 5v output to 3.3v, use a potential divider, e.g. 5k6 to the Arduino pin and 10K to ground.
To convert the the 3.3v outputs direct to the inputs of the 5v Arduino, one option is not to convert. The 5v Arduino needs 3v minimum to guarantee to register a logic high, so if the other chip is pulling to 3.3v for logic high, that is sufficient. Alternatively, use a 74HCT04 or other 74HCT (note the T) logic gate to level shift.
erg144:
seems you can if you run it at 12mhz. I've heard you might get away with 3.3, but no guarantees it will work, or will work correctly. Am I mistaken about that? I would love to just run it at 3.3
That's right, the mcu is not guaranteed to work at 16MHz unless the voltage is 4.5V or more.
I think a careful interpolation of
Figure 27-1. Maximum Frequency vs. VCC, ATmega164PA/324PA/644PA/1284P
will show that ~3.8V minimum is needed for guaranteed operation at 16 MHz.
You have to be careful about bring MISO in unbuffered - maybe the 1284 won't drive it high, but other devices on the SPI 'bus' might.
Somewhere around here is a level shifter that works well and is 4 resistors and 2 2N7000's does a true level shift w/o 'limiting' resistors or other hassles . The HCT04 is an inverting part that would work... with some more work. I found or was shown the link to NXP Semiconductors AN10441 "Level Shifting Techniques in I2C design". Very TTL like in design but a clever twist in using the inherent 'body' diode in all Mosfet's. I modeled a circuit using a 2N3904 in Multisim and it took one more resistor and a diode to make it work . It was based on TTL Logic and simulated well.
Still the NXP article is the best. There is something you might not be aware of and that is that the 3V3 source WILL NOT sink current. Connect a 4K7 resistor from the 3V3 source to the 5V source and measure the 3V3 source, you will find it at about 4V7. That caused me no end of grief until I asked here, I 'fixed' my issues with a clamp, a zener diode from 3V3 to ground (3V3 zener made from a TIL431) but use that interface. A 74C906 would work better it is still an inverter but it is open drain so it could be powered from either supply and work well with the appropriate pull-ups... and likely pure unobtanium as well... The Fet's work.
Not true - TXB0104 is bidirectional:
This 4-bit noninverting translator uses two separate configurable power-supply rails. The A port is designed to track VCCA. VCCA accepts any supply voltage from 1.2 V to 3.6 V. The B port is designed to track VCCB. VCCB accepts any supply voltage from 1.65 V to 5.5 V. This allows for universal low-voltage bidirectional translation between any of the 1.2-V, 1.5-V, 1.8-V, 2.5-V, 3.3-V, and 5-V voltage nodes.
I brought it in in error. Your IC is a great solution for SPI. I do wonder if it is as inexpensive as a couple of garden variety to-92 Mosfets and the same 4 pull-ups that are required anyway or as versatile. 5 wires 2 to 3V3 I/O (W pull-ups) 2 to 5V I/O (W/pull-ups) and the 2 gates tied to 3V3. And it is bi directional from almost any voltage, below about 2V the devices should be n type bi-polar types and a base bias resistor and a 1N4148 are required. the Gates/bases will be tied to the lower bus voltage. I have simulated both and used the Mosfet one. Both simulate in MultiSim11 identically over a 10 to 1 current range and both simulate identically the bi-polar one is based on a TTL gate input circuit (w/ a diode added for bi-directionality).
really only 5 connections 2 in/out 5V and 2 in/out 3V3. The gates are tied together to 3V3. No diode with the Mosfet. So simple it worked first time for me. I modeled it in MultiSim 11, took a very enjoyable half an hour, each.
Granted any simulation is chancy... but it made sense as well so I figured that the model was ok. Two extra parts for the Bi-Polar design I talked about. I gotta get a schematic tool hopefully that will work with both Altuim and Multisim, So I can post drawings too. Any suggestions???