Shop OBEX P1 Docs P2 Docs Learn Events
serial and usb connected to the propeller at the same time. Is it possiable? — Parallax Forums

serial and usb connected to the propeller at the same time. Is it possiable?

grasshoppergrasshopper Posts: 438
edited 2007-10-18 00:09 in Propeller 1
Serial and USB connected to the propeller at the same time, allowing me to choose what protocol to implement when communicating to my computer.

I wonder if any one has a clever solution that can quench my inquisitive concept.

I wish to connect to a computer with my propeller, but I want to have the ability to choose between serial or USB.

The idea is that I have a FTDI (usb ic) and a RS232 (serial ic) hooked up to my propeller board. This will allow me to connect my propeller to a PC that may or may not have serial ports or USB. However the catch is that I want to use only the 2 Com pins on the propeller leaving all the others for i/o. Is this possible?

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2007-10-17 16:12
    The mechanical aspect depends on your board. If you have 4 pins you should solder a fifth pin nearby for +3V.

    - You either insert the PropPlug
    - You insert a small board where you have soldered one of the many transistor or MAX232 solutions available. They pop up each week. When you have the time just wait; otherwise look for one of the three I remember from the last six weeks.
  • hippyhippy Posts: 1,981
    edited 2007-10-17 17:06
    @ grasshopper : I'm sure you could diode mix PropPlug / MAX232 / FTDI together so whichever is plugged in works or use some logic gating if diode mixing doesn't appeal.

    The advantage of that is you can plug all in and use any at any time, only having a problem if you tried to use two or more at the same time.

    For run-time comms rather than for programming the Propeller Chip, if you were prepared to assign three I/O lines for serial USB you could take the bit-banged USB driver BradC worked on and do without the FTDI chip. You could determine if USB were connected by monitoring the Vusb or other lines at the USB socket, or simply use software to determine where the first byte received came from.

    http://forums.parallax.com/forums/default.aspx?f=25&m=216569
  • grasshoppergrasshopper Posts: 438
    edited 2007-10-17 18:22
    hippy said...
    @ grasshopper : I'm sure you could diode mix PropPlug / MAX232 / FTDI together so whichever is plugged in works or use some logic gating if diode mixing doesn't appeal.


    I have heard of this before. Can you or anyone explain how it works. I think this is the best solution for me but i am not 100% on the concept. I know how a diode works but foggy a bit here.
  • AribaAriba Posts: 2,685
    edited 2007-10-17 18:41
    Here is a circuit with the Transistor - RS232 connection that Parallax suggests in the Datasheet.
    This i not tested, and I'm not shure if the TX line of a FT232 is always high, also when no USB cable is connected.

    Andy

    Edit: I have changed the Pulldown Resistor at RXD to Ground instead of DTR, as Peter Jakacki has suggested. (thank you Peter for that hint smile.gif )

    Post Edited (Ariba) : 10/18/2007 6:03:13 AM GMT
    689 x 450 - 8K
  • hippyhippy Posts: 1,981
    edited 2007-10-17 19:35
    @ grasshopper : Diode-mixing is really just creating logic gates using diodes. It relies on the fact that current only flows one way through a diode.

    If you have two diodes joined at their cathodes ( pointy ends ) putting a positive voltage in to either gives a positive voltage out at the joined end, an OR gate. There would normally be a pull-down R at the diode join to 0V so whatever read the signal saw 0V when no voltage was applied to the diodes or it would otherwise be a floating line.

    If you put the two diodes the other way round, and pull the joined end up to a +V via an R, you have an AND gate, high only when both inputs are at +V, low when either are at 0V.

    Because an active RS232 serial signal is positive going on the cable from the PC you could cut two cables and join them with the diode OR gate, pointy-ends to the receiver, pull-down R.

    As the USB2SER, PropPlug, MAX232 and FTDI chips invert that signal ( normally high, active low ), to join those you'd need the later AND gate, pointy-ends to senders, pull-up R. When one or the other carries data it will pulse low and this will get passed through, so we have what could be called an active-low OR gate.

    Diodes drop some voltage, don't always switch incredibly quickly but it usually works and is a cheap and simple method. Ariba's solution is quite elegant.

    For run-time comms you'll probably want to lose the reset line entirely to prevent the Propeller being reset when cables are plugged and unplugged etc.
  • grasshoppergrasshopper Posts: 438
    edited 2007-10-17 20:27
    Thanks so much both of you. I am learning so much and i cant wait to build more.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2007-10-18 00:09
    Ariba said...
    Here is a circuit with the Transistor - RS232 connection that Parallax suggests in the Datasheet.
    This i not tested, and I'm not shure if the TX line of a FT232 is always high, also when no USB cable is connected.

    Andy

    Again and again this transistor circuit (and variations of it) pops up as an "RS-232 circuit". While the circuit works perfectly well for programming the prop, it is not suited for general-purpose serial communications as it relies on the DTR to supply a negative voltage for the transmit circuit to work. Unfortunately the DTR signal goes positive when the port is opened normally by any other software other than the prop programming software.

    I have proved that by tying the resistor to ground instead of DTR that it works fine for both programming and for communication. Admittedly it didn't work on one long cable run I did with lots of crosstalk causing problems at 115Kbaud but that was easily fixed by using an npn transistor to pull the transmit to ground rather than rely on the resistor. The other way of fixing that would be to not use such a long cable next time.

    Anyway, until Parallax update their circuit it needs a rider on it that states that it does not work as a general-purpose RS-232 circuit and neither should we post that circuit (as is) as a solution other than for programming.

    BTW Ariba, I like the way you ran the USB TX into the 4K7 pullup, it's exactly what I have done in similar circuits too. This circuit should work fine if the USB chip is wired for a "self-powered" configuration so that the usb tx will idle high for the transistor circuit to work.

    *Peter*
Sign In or Register to comment.