Propeller Interface to Atmega Processor at 5 Volts
Chuck Davis
Posts: 23
Sorry if this has been asked and answered previously, but I searched and did not find a specific answer to this question.
I'm wanting to interface the OUTPUT of the propeller to an Input of an Atmel processor (Atmega1284) running at 5 volts. According to the two data sheets, the high output of the propeller and the required minimum required input for the Atmel input port are very close, but looks to be marginal. However the Atmel has "weak pull ups" available on the inputs, that switch in a resistor (of about 40K, I think) to pull it up to 5 volts.
Don't need to interface the other direction, so there is no 5 volt input to the Propeller.
Has anyone ever done this, and is it safe and reliable? I could run the Atmega at 3.3 volts, but I have a need for speed, and I'd have to slow it down quite a bit at that voltage.
Thanks for any help.
Chuck
I'm wanting to interface the OUTPUT of the propeller to an Input of an Atmel processor (Atmega1284) running at 5 volts. According to the two data sheets, the high output of the propeller and the required minimum required input for the Atmel input port are very close, but looks to be marginal. However the Atmel has "weak pull ups" available on the inputs, that switch in a resistor (of about 40K, I think) to pull it up to 5 volts.
Don't need to interface the other direction, so there is no 5 volt input to the Propeller.
Has anyone ever done this, and is it safe and reliable? I could run the Atmega at 3.3 volts, but I have a need for speed, and I'd have to slow it down quite a bit at that voltage.
Thanks for any help.
Chuck
Comments
I have lots of projects where I interface the Propeller with 5V devices and the only 5V device I've had some trouble with are the WS2812 LEDs.
e.g open drain signaling system, as long you never by mistake put the atmega pin as output-high it will work forever.
You could communicate bi-directional this way too as by mistake both sides do hard-pulls low at the same time no harm done.
maybe using a external 20K pull-up resistor to 5v as the 40K internal you have go a little slower, should not go above 50Kbits/s
As you are putting continues drain through Props protection diode, I would not go to down 10K
I would also put a 2K series resistor, as to get slighlty higher pull-up voltage as protection diode will continues trying to stop it from going above 3.6v
Use an XMega ?
How close are the Prop / Mega ? If they are on the same Board, adjacent, you may be ok.
As #2 alludes,if you have long cables and current added into the mix, then level shifters are better.
Your risk case is a combined error of worst-case LOW on Prop Vcc and worst case HIGH on ATMega, if you can ratio the supplies or ensure they are tight specs (not +/- 10%) you buy some margin.
You can also run Prop at 3.4V and Mega at 4.6V, to still meet Mega MHz and buy more margin.
5V pull-ups don't really pullup to 5V as the Prop I/O is standard CMOS and even if it was driven open-drain it will still look like a CMOS input and current would flow from the pullup to the Prop's 3.3V supply. However since there is a voltage drop from the pin to the supply and also effective series resistance you will find that the pin will still float up above 3.6V somewhat. Just measuring this with a 39K pullup to 5V reveals that it floats up to 3.67V if you do drive it open-drain (releasing DIR when driving pin high).
You could also put a diode in the line (anode to 5V pullup) so that the ATMEGA sees around 4.3V high and 0.6V low but logic gates are cheap too and I would use 74HCT powered from 5V as the inputs accept 2V and higher as a logic high.
I guess I'm confused by that. I was thinking that if the output pin on the Prop were set to input, it was basically floating, and then the external pull up would take it all the way up to 5 volts. I better go back to school on my cmos logic. I'm basically a programmer, not an electronics guy. Thoughts???.
Simplified electrical path:
+5V
RESISTOR
[ATMEGA IO]
[PROP INPUT]
[+DIODE-]
[ESR]
3.3V
The IO pins in this diagram are not in series, simply nodes.
So the voltage at the Prop input would be always try to conduct because +5V is higher than 3.3V and conventional current would flow from the ATMEGA pullup through the CMOS "diode" to 3.3V. Since the diode drop is around 0.3V this means the voltage at the Prop input would be clamped to around 3.6V. If the Prop were run from 3.6V then that input voltage would be 3.9V etc. Once you make the Prop pin a high output then the pin is effectively clamped directly to 3.3V which is why we float the pin to get the 3.6V instead.
EDIT: that's why inserting a diode between the two devices will "boost" the logic high by another 0.6V and the logic low is still well within limits too.
It would if it was not for the Protection Diodes the Prop have on its pins, anything over 3.6V gets channeled it to the Vcc rail to be used up.
You could use an external mosfet to isolate the Prop Pin from this dilemma, of course the signal will be inverted but it's easy fix in software.
http://www.scienceprog.com/using-current-limiting-resistors-on-avr-io-pins/
Rather than engage in any "un-natural acts", I believe I will resort to running the Atmega processor at 3.3 volts. At this voltage, it will still run at 13 Mhz - not the 20 Mhz I had hoped for, but should be more than fast enough. It actually simplifies the design a bit by only needing one voltage regulator instead of two, and should allow me to connect the Prop and the Atmega directly to each other. The board design is very tight, so I don't really have room to put any level-shifting circuitry in between.
Thanks again!
Why not a compromise, run it at 4.3V
As with most cmos devices guaranteed input-as-high is 70% of its Vcc = 3v in this case (but if it have schmitt trigger you have to read the specs in its manual)
The Prop pins ouput will be at 3.2 to 3.3v (under load it little lower, but there is no load on this trace here)
Never be afraid to get into SMD, it's a lot easier than you think. We have had plenty of discussions here on how easy it is and lots of tips too. I do a lot of my protos just with a cheap toaster oven and a syringe of solder paste. Sure beats soldering all those TH components by hand.
I'm also sure you could do away with the Atmega altogether and just use the Prop chip.