Shop OBEX P1 Docs P2 Docs Learn Events
Selectively programming 2 P1s with 1 Plug — Parallax Forums

Selectively programming 2 P1s with 1 Plug

I have two P8Xs but only one Prop Plug, so I would like to be able to manually switch between sending the 4-bit programmer signal to Prop A or Prop B with a physical switch which will switch an "enable" signal between outputting to A vs B.

I should(?) be able to accomplish my goal by using two 4-bit tri-state buffers to the output data bus, with the switch's output serving as the enable signal driver.

Two of these 74HC126s seem perfect.

Two of these, with the 4 output enable pins connected to one pole of a physical switch which pulls them high (with a pull down resistor to ground for the OFF position), in my mind does what I'm trying to accomplish.

Is this solution over-engineered? Is there a more obvious way to do this? Thanks!

Comments

  • jmgjmg Posts: 15,173
    I guess it depends on how you want to use it after the programming is done.
    If you want to talk to both P8X's over the link, then a dual-uart like CP2105 would allow that - no mux needed at all.

    Simplest shared connection HW would be to use a COM device with both RTS and DTR to drive one reset each, & custom programming SW, but that assumes only one P8X ever communicates during run.
    You could OR wire the outputs, if you know only one-at-a-time was managed.
  • Thanks for the info @jmg !

    I think the CP2105 is definitely overkill, and I'm definitely not writing custom software to accomplish a task that is tantamount to moving the Plug to a different header when I want to program a different uC haha.

    Here's my use case:

    I'll be writing and modifying code for both uCs at potentially the same time, and they will be running at the same time. So simply ORing the outputs wouldn't do the trick. So I need to be able to selectively program one or the other at will and leave the other running unaffected.

    This is why I'm leaning towards the tri-state buffer and switch technique. Thoughts?
  • jmgjmg Posts: 15,173
    edited 2018-02-28 03:05
    escher wrote: »
    Here's my use case:

    I'll be writing and modifying code for both uCs at potentially the same time, and they will be running at the same time. So simply ORing the outputs wouldn't do the trick. So I need to be able to selectively program one or the other at will and leave the other running unaffected.

    This is why I'm leaning towards the tri-state buffer and switch technique. Thoughts?
    If this is mainly for development, of '2 live systems', why not just use (any old) two COM ports ?
  • I only have 1 Plug
  • jmgjmg Posts: 15,173
    escher wrote: »
    I only have 1 Plug
    Digikey links USB-COM ports as low as $4.56 - surely that's cheaper than a mess of wires and time ? :)
  • Are you talking about a USB-Serial cable? Sorry I'm not following.
  • jmgjmg Posts: 15,173
    escher wrote: »
    Are you talking about a USB-Serial cable? Sorry I'm not following.

    Yes, that's all Prop Plug is - a USB to Serial cable.

  • Oh wow, for some reason I thought there was some proprietary nonsense going on with it. Thanks for the help!
  • escherescher Posts: 138
    edited 2018-02-28 05:12
    @jmg won't I still have to wire up the whole USB to UART circuit i.e. 103973.png
  • jmgjmg Posts: 15,173
    escher wrote: »
    Oh wow, for some reason I thought there was some proprietary nonsense going on with it. Thanks for the help!
    There is a reset transistor/cap, but that's easily added if you find you need it.
  • escherescher Posts: 138
    edited 2018-02-28 05:19
    jmg wrote: »
    escher wrote: »
    Oh wow, for some reason I thought there was some proprietary nonsense going on with it. Thanks for the help!
    There is a reset transistor/cap, but that's easily added if you find you need it.

    @jmg So do I still need the FT232RQ or equivalent? Or should that be built into the USB-RS232 adapter?
  • jmgjmg Posts: 15,173
    edited 2018-02-28 05:27
    escher wrote: »
    jmg wrote: »
    escher wrote: »
    Oh wow, for some reason I thought there was some proprietary nonsense going on with it. Thanks for the help!
    There is a reset transistor/cap, but that's easily added if you find you need it.

    So do I still need the FT232RQ or equivalent?

    That's the part that does USB-UART(TTL), so yes, you need an equivalent.
    Cheapest module at Digikey is CP2104-MINIEK @ $4.56, next is Adafruit CP2104 FRIEND @ $5.95, then UMFT234XF @ $6.22 etc & CP2102N-MINIEK @ $8.50
    eBay has CH340 and CP2102 version modules for rather less.
    escher wrote: »
    @jmg won't I still have to wire up the whole USB to UART circuit i.e.

    Ah, the items I've linked above are all PCB modules, so have USB connector and 0.1" connectors - not bare chips.
  • jmg wrote: »
    escher wrote: »
    jmg wrote: »
    escher wrote: »
    Oh wow, for some reason I thought there was some proprietary nonsense going on with it. Thanks for the help!
    There is a reset transistor/cap, but that's easily added if you find you need it.

    So do I still need the FT232RQ or equivalent?

    That's the part that does USB-UART(TTL), so yes, you need an equivalent.
    Cheapest module at Digikey is CP2104-MINIEK @ $4.56, next is Adafruit CP2104 FRIEND @ $5.95, then UMFT234XF @ $6.22 etc
    eBay has CH340 and CP2102 version modules for rather less.

    Jeeze at that point I might as well just drop the other $10 and get another Plug. Thanks again for all the help!
  • Cluso99Cluso99 Posts: 18,069
    edited 2018-02-28 11:39
    The specific section that you need to be able to use almost any USB-Serial TTL is the transistor reset circuit connected to the DTR pin. Not all USB-Serial modules have the DTR accessible. CP2102 modules can be had for $1.19 on eBay inc postage. Just add the transistor with the resistor and capacitor.

    Of course 2 propplugs are easier.

    BTW if you are using PropTool, you can run two copies connected to two separate PropPlugs on the one PC. Makes development easier for different code.
  • MIchael_MichalskiMIchael_Michalski Posts: 138
    edited 2018-03-08 17:54
    escher wrote: »
    I have two P8Xs but only one Prop Plug, so I would like to be able to manually switch between sending the 4-bit programmer signal to Prop A or Prop B with a physical switch which will switch an "enable" signal between outputting to A vs B.

    I should(?) be able to accomplish my goal by using two 4-bit tri-state buffers to the output data bus, with the switch's output serving as the enable signal driver.

    Two of these 74HC126s seem perfect.

    Two of these, with the 4 output enable pins connected to one pole of a physical switch which pulls them high (with a pull down resistor to ground for the OFF position), in my mind does what I'm trying to accomplish.

    Is this solution over-engineered? Is there a more obvious way to do this? Thanks!

    If you really want to control two from one usb adapter,why not disconnect one of the LEDs and use it to switch the output (there might even be an unused output you could use for that). Then you can do it under software control.But I agree,your better off buying another adapter. They are only a couple bucks on ebay. I keep a handful of them around.

Sign In or Register to comment.