Shop OBEX P1 Docs P2 Docs Learn Events
Open drain?? — Parallax Forums

Open drain??

Mike B.Mike B. Posts: 31
edited 2010-12-23 07:48 in Propeller 1
The Propeller BackPack docs say that I must use an open drain pin for the serial pin.· This is the first time I have heard this term used in connection with a serial device.

· What are they trying to tell me and how do I do it??

· Thanks.· Mike B.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-07-31 21:38
    "open collector" is a similar term used for the same thing. Both of these refer to a logic circuit where there's a transistor between the output line and ground. When the transistor is turned on, it brings the signal level to near ground. There's a resistor somewhere between the output line and the supply voltage (Vdd) that provides a default voltage near Vdd (when the transistor is off or open). An FET has a drain, so, when the FET is off, it's like having an open drain connection. A bipolar transistor has a collector, so, when the transistor is off, it's like having an open collector.

    This type of connection works well for serial devices if raw speed and high noise resistance are not issues. The resting (idle) state of a serial line is logic high (Vdd) and the serial line is brought to near ground for active (logic zero) signals. A "totem pole" circuit works better for high speeds and high noise resistance since there's a 2nd transistor between the output line and Vdd that quickly raises the signal to logic high. If you connect two "totem pole" outputs to the same line, there's the potential for a short circuit if one device is at logic low and the other is at logic high. An "open drain/collector" output can be paralleled with another without the danger of a short circuit.

    Post Edited (Mike Green) : 7/31/2010 9:45:12 PM GMT
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-07-31 21:41
    Open Drain ( or collector, for bi-polar) is just a way of saying that there is a pull up resistor and you are to ground that point with your side of life, many things may be across this point but the first to pull it down will obviously prevent any of the others from having any effect.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Why did I think a new, more challenging, job was a good idea ??
  • LeonLeon Posts: 7,620
    edited 2010-07-31 21:42
    An open-drain output can be simulated on the Propeller by making a pin an input, with a pull-up resistor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM
  • Mike B.Mike B. Posts: 31
    edited 2010-07-31 22:26
    OK.· Well open collector I am familiar with.· What puzzles me at this point is why they are telling me to do this for the Propeller Backpack and in the next sentenance they say a pullup is not required as it is built into the backpack..

    · As far as I can tell there isn't any feedback from the backpack so it's one directional from the (in my case) Propeller chip.· Can't I just hook it directly to the backpack serial pin and go about my business or am I missing something here??

    · By the way, the 7" display I got from Parallax to use with the Backpack is really nice and complete with 2 video inputs and a REMOTE!· Love it..

    ·Mike B.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-07-31 23:05
    The single I/O pin on the Backpack's 3-pin interface is bidirectional. Input and output occur on the same pin in half-duplex fashion. For that reason, the pin is operated open-drain, and devices that communicate with it are expected to do the same. The necessary pullup resistor is provided on the Backpack board, so you don't have to provide one externally.

    Now, having said that, for certain apps (like the preinstalled TV terminal program) communication is one-way only. So, strictly speaking, there won't be any return communication, and one could get by with a totem-pole output to the board -- at least when the "high" level is 3.3V; not when the "high" is 5V. Moreover, the pin has a series resistor, so bus conflicts are accommodated. Nonetheless, it's still a good idea to get in the habit of using open-drain communication with this board, in case you ever want to write your own software for it -- and always with 5V logic levels.

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 7/31/2010 11:18:15 PM GMT
  • tonyp12tonyp12 Posts: 1,951
    edited 2010-08-01 00:33
    Let me see if I got this right.

    Instead of putting the pin to output and using
    0 (connected to ground)
    and
    1 (connect to 3.3v)
    for commutations that could create a short if both sides are trying to TX communicate)

    But if you use Open Drain.

    Where you use output with a 0 (ground) for sending a zero
    and switch the pin to input (Z as it's 2mega ohm+) with an external pull-up 4k7·resistor to send a 1.

    So the T1 in the below picture represent a prop pin.
    opendrain.jpg

    Post Edited (tonyp12) : 8/1/2010 3:25:24 AM GMT
  • Mike B.Mike B. Posts: 31
    edited 2010-08-01 03:03
    Ok, now I'm more confused than ever.· Could some body post a schematic of the connection from the prop to the backpack??

    · Something is just not sinking in here.· Like they say, a picture is worth a 1,000 words.· Maybe it's the terminology that's screwing me up..· Are we talking about a NPN transistor between the prop and the backpack serial pin??· smhair.gif

    Mike B.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-08-01 03:52
    You're making this way too hard, Mike! All you need to connect a Prop to the Backpack are Gnd, +5V, and a direct connection from any Prop pin to the Backpack's signal pin. That's it: no special drivers, pullups, etc. To communicate open-drain, you set the Prop pin's outa bit to 0. To drive the pin low, set the pin's dira bit to 1; to let go of the pin set the dira bit to 0, and the pin will get pulled up by the Backpack's pullup resistor.

    -Phil
  • Mike B.Mike B. Posts: 31
    edited 2010-08-01 11:22
    Oh brother...· lol.. lol...·tongue.gif· I'm pretty sure that was what I was asking for in the second half of my original question... "What are they trying to tell me and how do I do it? "···lol.

    · Thank so much Phil !!· I have read and re-read all these posts and it sounded like everyone was telling me I needed some sort of additional circuit to make this all work which sounded like "really?· Why on earth would Parallax or any manufacturer make a serial connection so complicated?"· lol..

    · I had my Son measure the actual distance between my ears, only 9.5 inches.· Why then·did·the·information traveling at·the speed of light take so long to get from one side to the other??· smurf.gif· <--(dunce cap)

    Mike B.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-08-01 15:24
    Well, don't blame Parallax. It was I who designed (and wrote the doc for) the Backpack. I'm sorry it caused you so much confusion! I guess an extra example or two would be helpful.

    -Phil
  • Mike B.Mike B. Posts: 31
    edited 2010-08-01 16:58
    No, no.· I'm not blaming anyone, it was I that was thick between the ears!!· Doohh..· See my other post re: backpack and you'll see I finally cracked the mystery of the back pack!! lol..· not sure I have the mode set right although it is working.· Here is the init I did on the FDS:

    · OBJ FDS· : "FullDuplexSerial"

    ·····FDS.start(10,10,%01000,9600)

    · This 7" display and backpack are going to make a dandy display for my submarine controller.

    Mike B.
  • HallMarkHallMark Posts: 1
    edited 2010-12-22 21:09
    Is it Possible to use Open-Drain Pin as Input? i think its not possible. and if anyone have idea about that then let me know.
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-12-23 07:48
    Mike B. wrote: »
    Oh brother...I had my Son measure the actual distance between my ears, only 9.5 inches. Why then did the information traveling at the speed of light take so long to get from one side to the other?? Mike B.
    Mike B., don't worry about it, ears probably communicate with slower sound rather than faster light. This slow-down is the obvious result of two things - a head in motion creating a doppler effect, and the location where one is living resulting in the Coriolis Effect. Additional variances of the speed of sound are the result of living above or below sea level. Then again, sometimes it's just some ear wax in the way.
    :)
Sign In or Register to comment.