Shop OBEX P1 Docs P2 Docs Learn Events
Connecting two Propellers for serial communications — Parallax Forums

Connecting two Propellers for serial communications

simonlsimonl Posts: 866
edited 2009-06-01 07:23 in Propeller 1
If connecting two Prop's for serial comm's (Prop1 P31 to Prop2 P30; Prop1 P30 to Prop2 P31); do I need to add resistors (to Vdd or Vss) on each connection? If so, what value would be appropriate?

The reason I ask is I seem to remember reading that, without resistors, there's a possibility of damaging the Propeller under certain conditions. I don't remember (and can't find) the exact reason, but I think it was something to do with protecting against both ends setting their pins high?

I want to get my facts right, before publishing (here) my guide to Propeller communications, so all help will be greatly received.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon

www.norfolkhelicopterclub.com

“Before you criticize someone, you should walk a mile in their shoes. That way when you criticize them, you are a mile away from them and you have their shoes.” - Jack Handey.

Comments

  • Zap-oZap-o Posts: 452
    edited 2009-05-01 13:49
    No resistors are not needed as far as I know. Its 3.3V logic for both ICs. I connect the prop to other ICs and no resistors are needed.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-01 14:11
    Leaving out the resistors works as long as you don't make stupid mistakes (as I've done) by accidentally swapping the receive and transmit pin numbers in your program. If one Prop transmits on pin 30 when it should be transmitting on pin 31, the two transmit pins will be connected together and, for some time, they will have opposite states (one high and one low). This results in a short circuit between +3.3V and ground and can burn out one or more output transistors. There has been some testing of Propeller outputs and they do seem to be built to tolerate this for long periods of time, but the datasheet says that you can't do this (absolute maximum I/O current is 40mA).
  • simonlsimonl Posts: 866
    edited 2009-05-01 14:20
    @Mike: Yeah - that's what I was thinking of - thanks.

    So, if I connect (say) a 1K resistor on each of the lines to GND, would that be a good fail-safe?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,
    Simon

    www.norfolkhelicopterclub.com

    “Before you criticize someone, you should walk a mile in their shoes. That way when you criticize them, you are a mile away from them and you have their shoes.” - Jack Handey.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-01 14:26
    No, the resistors are connected between the two Propellers.

    Propeller #1 Pin 30
    1K resistor
    Propeller #2 Pin 31
    Propeller #1 Pin 31
    1K resistor
    Propeller #2 Pin 30

    They limit the maximum current flowing between the two Propellers.
  • simonlsimonl Posts: 866
    edited 2009-05-01 14:30
    OK. Thanks for your help Mike smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,
    Simon

    www.norfolkhelicopterclub.com

    “Before you criticize someone, you should walk a mile in their shoes. That way when you criticize them, you are a mile away from them and you have their shoes.” - Jack Handey.
  • Zap-oZap-o Posts: 452
    edited 2009-05-01 15:24
    Not to argue Mike but I read the manual and on page 15 it clearly states that "General purpose I/O port A can source/sink 30ma."

    Now I translate this as - a pin designated as pin1 is set to high and the other pin designated as pin2 was set to low. With pin1 set as output and pin2 set as input accordingly. This is as close to a short that we can get with no series resistor, but since the prop sinks 30ma and source 30ma then why bother with a resistor? I see it as a HIGH and a LOW. Am I wrong and if so please let me know?
  • kwinnkwinn Posts: 8,697
    edited 2009-05-01 16:28
    Zap-0, what you say is valid. Having one pin as output going to another pin set as input does not require a resistor. However this is not close to a short since the pin set up as an input pin has a high impedance (resistance). As long as you are perfect and never make a mistake in your wiring or programming you are fine. If on the other hand you are like we mere mortals and you accidentally connect two output pins together by a wiring or software mistake and set one high and the other low you have a short from 3.3V to ground through the prop pins. While the prop pins might survive that, I wouldn't count on it. A small resistor (120 ohms to 1K) is cheap insurance.
  • Zap-oZap-o Posts: 452
    edited 2009-05-01 16:38
    kwinn, I am no super human! I make many mistakes; mostly stupid ones.

    In your own response you contradict your self (I think). You say "set one high and the other low you have a short from 3.3V to ground through the prop pins"
    Don't you have to set the direction of the pins first or it wont work. e.g.
    dira[noparse][[/noparse]pin1]~
    outa[noparse][[/noparse]pin1]~
    
    


    That would work but this wont will it.
    outa[noparse][[/noparse]pin]~
    
    



    I am at work so I cant test this situation.

    I am only debating in an effort to learn more of this mighty chip that parallax has given to all of us. So no offense is intended to any of you fine people for my badgering questions.
  • JomsJoms Posts: 279
    edited 2009-05-01 18:23
    Sorry for this, but just put the resistors in there and be done with it. No matter how great of a programmer you are at some point you will screw up. I have a whole box of 1k and 10k resistors, and I would much rather add two more resistors to a project then possibly burn up parts of two props. I know they are cheep, but still...

    And second, I have found this out a long time ago, you don't ever argue with Mr Green. He is very very experienced with the parallax stuff, and has never seemed to lead me down the wrong path...
  • simonlsimonl Posts: 866
    edited 2009-05-01 18:34
    Blimey! What've I started?

    I agree - the pragmatic solution is to just add the series resistors.

    My only thought on this is that I'm guessing the resistors might affect the maximum speed of serial communications?

    Thanks to all smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,
    Simon

    www.norfolkhelicopterclub.com

    “Before you criticize someone, you should walk a mile in their shoes. That way when you criticize them, you are a mile away from them and you have their shoes.” - Jack Handey.
  • Zap-oZap-o Posts: 452
    edited 2009-05-01 18:51
    OK;
    All I am asking is why? Why put in a resistor if its not needed. I cant logically see how even a faulty program could mess this up. I understand that Mike Green is very wise; this is why I am asking more on this topic. Sure the quick solution is place a resistor in and not ask why hell place a diode, optically isolate it, or use a buffer. A point comes when I ask WHY?

    I have always been a curious feller. tongue.gif
  • JomsJoms Posts: 279
    edited 2009-05-01 19:19
    Well, most diodes have a .7 volt drop accross them which can affect speed. You can optically isolate it, you can even convert the 232 to 485 and back again at the other end, as I have done in many of my projects that need distance.

    Resistors are normally the product of choice because they are cheep and handy. They normally do not affect speed and they provide extra cheep insurance. You don't know that when the chip is in the process of booting that the pin will always be low, and never end up high. You could accidently load the wrong program on it or mess up a line of code, at which point you would either need to redesign your circuit board, or need to replace the prop.

    I normally like to take protective measures because you never know what will happen. You could even have one prop fail and dont want it to take the other one out. I even use 1k resistors on a lot of my inputs when I am breadboarding, just to project the prop while I am poking wires all around...
  • simonlsimonl Posts: 866
    edited 2009-05-01 19:21
    Hey Zap-o; no harm in asking - that's how we learn more smile.gif

    If I'm reading the explanation right, it goes as follows:
    dira[noparse][[/noparse] pinTx ] := 1
    dira[noparse][[/noparse] pinRx ] := 1   '<--- spot the deliberate error!
    
    outa[noparse][[/noparse] pinTx ] := 1
    outa[noparse][[/noparse] pinRx ] := 0   '<--- Ooops - this causes a short!
    
    



    This is an example of a silly coding mistake.

    I think I've got that right.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,
    Simon

    www.norfolkhelicopterclub.com

    “Before you criticize someone, you should walk a mile in their shoes. That way when you criticize them, you are a mile away from them and you have their shoes.” - Jack Handey.
  • Zap-oZap-o Posts: 452
    edited 2009-05-01 19:35
    @Simonl

    That is possibly an error in code, but since you set both bins as outputs (dira[noparse][[/noparse] pinTX ] , dira[noparse][[/noparse] pinRx ]) then I was assuming that high input impedance - no harm could accrue. This supports my belief that a resistor is not needed. On the other hand if you just ran this code

     outa[noparse][[/noparse] pinTx ] := 1
     outa[noparse][[/noparse] pinRx ] := 0  
    
    



    Without setting the pins to outputs first then my assumption was that the compiler would catch it. Or maybe it would not, perhaps the propeller would not work even if the compiler did not catch it.

    This was my thinking that programming errors were not possiable in this situation. At least, no possiable way to cause the prop to kill itself. So why use a resistor?

    Post Edited (Zap-o) : 5/1/2009 7:40:58 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-01 19:54
    1) The Propeller datasheet gives the absolute maximum current into or out of a single I/O pin as 40mA. The "I/O Port A" and 30mA you mention may be for some other microcontroller like a Stamp or SX.

    2) The compiler does not catch anything about the use of the I/O pins. Programming errors are possible. The scenario I mentioned is where you have two separate Propellers possibly with different programs running on them and, on each, I/O pin 30 is connected to the other Propeller's I/O pin 31 and I/O pin 31 is connected to the other Propeller's I/O pin 30. As long as you define pinTx = 31 and pinRx = 30 in both programs (and use those definitions correctly), you'll be fine. If you somehow get confused when writing one of the programs and swap the definitions in only one program so pinTx = 30 and pinRx = 31, you're in trouble when you turn those Propellers on.

    3) The issue is not whether the resistors are normally needed ... they're not, but would they be helpful in the case of certain programming errors? ... yes. Is this sort of programming error likely? ... that depends. Would the result be catastrophic? ... maybe. Do I put this sort of resistor on all my boards? ... no. Would I build it into a board where I plan to use all sorts of external circuitry from time to time? ... yes.
  • Zap-oZap-o Posts: 452
    edited 2009-05-01 20:31
    Thanks Mr.Green for the response I am still think that the propeller cant kill it self no matter how the pins are arraigned, Ill look into it more when I get home form work. Sorry for being so stubborn.

    As for the 30ma its clearly stated here www.parallax.com/Portals/0/Downloads/docs/prod/prop/WebPM-v1.01.pdf page 15.
  • SRLMSRLM Posts: 5,045
    edited 2009-05-01 21:15
    I may be wrong here, but I think that the maximum current (whatever it is) is the maximum that the propeller can handle safely. It may be able to do more, but at the risk of burning stuff out. So, a pin high and a pin low with no resistor in between may conduct 100 ma for a short amount of time until something fails.
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-05-01 23:39
    If you are doing as you say, P31 -> P30 and P30 -> P31 I would not bother because the normal method of driving FDX would be ok. If you just connected P31 -> P31 and P30 -> P30 then there is a possibility of making a mistake like forgetting to change the input and output pins on one of the props, so a 150+ ohm resistor would be a safe precaution. The same applies if you might connect a PropPlug to these props. I don't use them in my TriBladeProp, but there is a risk - I have caught myself out, but no damage resulted. I recommend you use the crossover P31-P30 & P30-P31 as you suggested and then no resistors should be necessary as the software FDX will be the same on both props so much less chance of errors.

    my 2cents

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
    · Search the Propeller forums (via Google)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
  • Clock LoopClock Loop Posts: 2,069
    edited 2009-06-01 07:23
    SRLM said...
    I may be wrong here, but I think that the maximum current (whatever it is) is the maximum that the propeller can handle safely. It may be able to do more, but at the risk of burning stuff out. So, a pin high and a pin low with no resistor in between may conduct 100 ma for a short amount of time until something fails.

    The original question
    "If connecting two Prop's for serial comm's (Prop1 P31 to Prop2 P30; Prop1 P30 to Prop2 P31); do I need to add resistors (to Vdd or Vss) on each connection? If so, what value would be appropriate?"

    If I connected two props to eachother and one pin to output high, and on the other prop set the output to low, the props would both heat up until they smoked. I use 1k resistors on all inputs and outputs for standard logic. Higher speeds might require lower values to allow the square data wave to rise or fall in time.

    Zap-o asks why,
    and its because all chips have limits which don't actually DO the limiting of the current or even voltage. Say i have a 5v 30ma device, i can still put more than 5v into it, and can also pull more than 30ma from it, eventually frying it.(unless it has protection circuitry)


    There is only 1 reason why anyone should be doing this.
    If they absolutely must have minimal components, and have tested the program and design extensively.
    This would be a production, EE level choice mostly only made to cut costs.

    This is why our electronics fail today,
    As our friends on the other side of the world say,
    "COST DOWN"
    even if it only adds 1$ to the cost per device, they look at it in hundreds of thousands of units that each add 1$ ,,, save 1$ on 100,000 units and you have an extra $100,000. [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Meh. Nothing here, move along.
Sign In or Register to comment.