Shop OBEX P1 Docs P2 Docs Learn Events
Serial Port Programming, Timing Question — Parallax Forums

Serial Port Programming, Timing Question

DroneDrone Posts: 433
edited 2009-10-28 14:17 in Propeller 1
Can anyone point me to a specification and/or a timing diagram for propeller programming via the RS-232 port? I looked in the Propeller Data Sheet and Manual, but still can't seem to get a handle on this.

Thanks, David

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2009-10-27 11:04
    Have a look at http://obex.parallax.com/objects/61/

    That code loads a propeller from another propeller. The code should show you the timings.
  • BradCBradC Posts: 2,601
    edited 2009-10-27 14:17
    Drone said...
    Can anyone point me to a specification and/or a timing diagram for propeller programming via the RS-232 port? I looked in the Propeller Data Sheet and Manual, but still can't seem to get a handle on this.

    This is an excellent reference :

    propeller.wikispaces.com/Download+Protocol


    It's not incredibly hard to do but some of the timing surrounding the reset can be a bit critical. Baud rates are pretty flexible and things don't start getting ugly until you get up around 200K baud.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lt's not particularly silly, is it?
  • DroneDrone Posts: 433
    edited 2009-10-27 14:25
    @MagIO2, Thanks for the link. The object you recommend doesn't really answer the question I have. It just brings RESn low then sets the Tx/Rx pin levels then brings RESn high again (all in spin) then proceeds with communication after a 100ms wait. So the 100ms wait adds a little information.

    I'm trying to understand what's going on when the RS-232 port is used to program the Propeller using the serial port circuit shown in the Propeller Data Sheet (see attached diagram scraped from the data sheet as well as an older serial interface diagram I found somewhere on the Propeller Forum).

    From the serial port circuit on the data sheet it seems obvious DTR must be held low for the receive-in to the serial port to work. The series capacitor lets RESn return to high even though DTR is held low, assuming there is some sort of pull-up on RESn internal to the Propeller (it seems there is little or no specification or model for the RESn or I/O pins in-general available).

    I've simulated (in LTSpice) the data sheet (V1.2) serial port circuit (see attached). From the simulation, it's obvious I need the actual timing on the serial port to understand what's going on. Plus as I have no model for the I/O and RESn pins, I've just dropped some Si protection diodes and an (assumed) pull up on the RESn line (which doesn't seem to simulate well).

    I'm traveling for awhile so I don't have access to my lab to sniff this out physically. I thought I would work on this in simulation until I get home. I'm pretty sure someone else has gone through this exercise before.

    My objective is to find a circuit that physically connects exactly like the USB Propeller-Plug, but connects to the serial port on the PC not USB. Four-pins like the Prop-Plug, not the five pins (+3.3V needed from the Propeller) as shown in the data sheet circuit. A very low-cost Serial Prop-Plug if you will, four-pins, not five. I plan to derive the voltage for the circuit from the RTS pin, not the Propeller circuit as required by the serial circuit in the Propeller data sheet. Hence one pin reduction. Functional requirements are reasonable serial speed and RS-232 port compatibility +/-5V min to +/-12V or 15V.

    In addition to the RS-232 timing; if anyone has a reasonable specification and/or model for the actual physical characteristics of the RESn and/or I/O pins on the Propeller, it would help. Thanks for any replies.

    Regards, David
    767 x 422 - 24K
    1674 x 834 - 36K
    1024 x 741 - 111K
    1024 x 741 - 139K
  • DroneDrone Posts: 433
    edited 2009-10-27 14:41
    Hi BradC,

    Yes I did glance at the Wiki entry before. I'm not trying to mimic the Prop-Tool in protocol, I'm just trying to mimic the serial circuit from the Propeller Data Sheet with four pins instead of five; likely deriving the steady-state voltage from RTS (if it stays voltage high as it should I think, in Windows XP at-least). Physical layer only. Thanks for the reply though.

    Some may ask; why am I doing this...

    At $25 USD per seat, the Prop-Plug is a barrier to entry, especially for classroom settings outside the First-World. PC's with serial ports still are prolific. I want a Prop-Plug (4-pin) compatible serial dongle at very low cost so it will plug into any existing 4-pin Prog-Plug "assuming" board out there. Hope I'm not missing anything obvious here.
  • BradCBradC Posts: 2,601
    edited 2009-10-27 14:52
    Drone said...

    At $25 USD per seat, the Prop-Plug is a barrier to entry, especially for classroom settings outside the First-World. PC's with serial ports still are prolific. I want a Prop-Plug (4-pin) compatible serial dongle at very low cost so it will plug into any existing 4-pin Prog-Plug "assuming" board out there. Hope I'm not missing anything obvious here.

    So what you really want is this :

    http://forums.parallax.com/showthread.php?p=850099

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lt's not particularly silly, is it?
  • DroneDrone Posts: 433
    edited 2009-10-27 15:05
    Hi Again, BracC...

    No; I am following that thread. I want something serial only that is easily reproducible using generic discrete components (through-hole at-least) that are readily available anywhere in the World. If I can come up with something I will strive to provide the design as a completely open project. There's just one improvement over the Propeller Data Sheet's serial alternative, four pins instead of five, so it is compatible with prop-plug. Serial only, no hard to find parts. Sounds easy, maybe not. Wish I had access to my test eqpt. etc. but as I said, this is a project I'm working on while traveling - lots of down time to fill. Might as well try something productive.

    I've got to terminate my Forum log-in now. Losing my secure connection. I'm currently GMT+7 hours. But I'll read any replies tonight and reply tomorrow.

    Thanks All, David
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-27 15:05
    What's wrong with the serial port programming interface from the datasheet? You can use a small, low power automotive-type 3.3V regulator to produce the 3.3V required for the signal voltages from the RTS line. The current needed is 1-2mA, but the regulator has to be capable of withstanding 15V and reverse polarity.
  • BradCBradC Posts: 2,601
    edited 2009-10-27 15:16
    Mike Green said...
    What's wrong with the serial port programming interface from the datasheet? You can use a small, low power automotive-type 3.3V regulator to produce the 3.3V required for the signal voltages from the RTS line. The current needed is 1-2mA, but the regulator has to be capable of withstanding 15V and reverse polarity.
    \

    I would not even worry about a regulator to be honest. Just tweak the resistor values up a bit and use a couple of diodes and a cap to get power from the TX and RTS lines.
    The only voltage that is vaguely important there is the one to the emitter connected to the props rx pin. That is going to be clamped by the substrate diode anyway, so just use a relatively high value resistor (calculated for worst case voltages) and you should be apples. You could always use a zener on it if you were really worried.

    I suggested using a diode to pull power from the TX line also as the PC always transmits a byte prior to the prop sending anything back, so you'll always have a little extra oomph from the TX line when you need it. The propeller uses the end of the byte the PC sends to time it's own return transmission, so they overlap nicely.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lt's not particularly silly, is it?
  • DroneDrone Posts: 433
    edited 2009-10-28 11:08
    @Mike Green,

    Yes I'm looking into a tiny regulator as a possibility. But again, I want to use readily available parts most anywhere. Reverse polarity tolerance is a plus and I might be able to provide that with a protection diode, but that would make the regulator intolerant to RS232 with low swings (minimum is +/-3V, but if I design for +/-V minimum then I might be able to get away at 3.3V with an LDO regulator). Then there's the issue of caps on the regulator, unless ceramic caps are supported that gets difficult when it comes to easy to find parts, especially with SMD caps.

    @BradC,

    I've looked at a zener in simulation. Things get messy unless I draw more than 5mA from RTS. Zeners are notoriously difficult to model in Spice. I tried with a Zener model and five Si diodes in series for around 3.3V both models are not really working well unless I bias the "Zener" with more than 5mA, even with tweaking the resistor values.

    I'll try your suggestion to just diode protect and tweak resistors, but I suspect it might be difficult to cover the range +/-5V through +/-15V. Maybe I'll try a Darlington pair on the RS232 tx to propeller transistor.

    Nice suggestion to pull power from the TX line. I would be able to address this better if I had a timing diagram for the typical RS232 programming sequence, which brings me back to my original question.

    Thanks, David
  • BradCBradC Posts: 2,601
    edited 2009-10-28 14:17
    Drone said...

    Nice suggestion to pull power from the TX line. I would be able to address this better if I had a timing diagram for the typical RS232 programming sequence, which brings me back to my original question.

    Read booter.spin. It will give you a good insight into how the propeller loads from the PC.

    The best way to get a timing diagram I guess is to put a cro on the line. None of this has been documented by Parallax outside of the sample Delphi code posted and the attached bootsequence.spin

    There are a few people who have written propeller loaders who I'm sure would be happy to answer any specific questions you may have.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lt's not particularly silly, is it?
Sign In or Register to comment.