Shop OBEX P1 Docs P2 Docs Learn Events
Why do we need the transistor reset circuit for the USB devices??? (FT232RL, CP2102) — Parallax Forums

Why do we need the transistor reset circuit for the USB devices??? (FT232RL, CP2102)

Cluso99Cluso99 Posts: 18,069
edited 2011-08-03 21:17 in Propeller 1
In my effort in looking for a cheaper USB download solution, I purchased a USB-TTL adapter mounted in a box.
http://forums.parallax.com/showthread.php?133335-Cheap-PropPlug-replacement-USB-TTL-converter-US-4.60-and-a-modification

In my haste to check it worked, I omitted to add the transistor reset circuit, instead just connecting the -DTR pin (from pin 28 of the CP2102) to the prop reset pin. It worked. Then I realised what I had done.

On my TriBlade design I was more interested in the SRAM interfaces. I had enough room on the pcb to squeeze in a propplug equivalent circuit, so I just blindly copied it without thinking.

Now I wonder why the transistor reset circuit is required at all. This had me thinking....

Back to basics...

DTR at the TTL interface is active low (0V=DTR ON, 3V=DTR OFF).
Whenever DTR transitions from 0V to 3V a pulse is generated by the RC circuit on the base of the transistor, causing the transistor to turn on for a short time. This pulls the propeller reset pin low and causes the propeller to reset. No pulse is generated for 3V to 0V transitions.
Therefore, the propeller is reset when DTR goes active to inactive.

PropTool & PST behaviour...

The results are not what I expected!!!

Both PropTool and PST drive the DTR pin in reverse. That is, DTR is normally inactive (3V), and to reset the prop, DTR is set active and then inactive again. The active to inactive (0V to 3V) edge triggers the reset.

Why is it so...

Well, when a program terminates, the OS in the pc software ensures DTR is inactive (forced to 3V). So to permit the transfer from one program to another in the pc, PropTool and PST both drive the DTR pin in reverse. I presume bst does the same. This is why my tests without the transistor circuit worked.

Conclusion...

What might be the effects of not using the transistor reset circuit?

1. When a program automatically activates DTR the prop will be reset. Therefore, some terminal programs may not run correctly.
2. It will not be possible to unplug the USB port without resetting the prop. However, the TTL end should be able to be unplugged without causing reset. (Unless you are powering your prop from USB of course).

Does this make sense??? Anyone have any other opinions or ideas???

Comments

  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-07-28 02:00
    By a strange coincidence, I have been pondering the same thing. I was looking specifically at Pullmoll's reset circuit, which swapped a NPN transistor for a PNP one. There were some subtle timing changes that meant this was more reliable with all three of the spin compilers.

    Then I was looking at the FT232 specs and trying to work out whether DTR was 'inverted' or 'true' logic. I still don't quite have the definitive answer to that as I'm waiting for an actual chip, but I am guessing that because Tx and Rx translate RS232 'resting' from -12V to +5V, DTR will do something similar.

    Then I realised that with the high pass RC network on the reset circuit, it doesn't really matter. The reset occurs on transitions, and regardless of what the DTR line is sitting at (5V, 0V, -12V, +12V), if you change it then change it again, you will get at least one transition that causes a reset.

    I suppose the question is - if you want to reset on absolute levels, rather than transitions, do we need to actually go and test all the compilers and see what the 'resting' state of DTR is?
  • Mark_TMark_T Posts: 1,981
    edited 2011-07-28 02:11
    I use a 1N4148 between reset and DTR so a separate reset button can be used as a wired OR. Seems to work.
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-07-28 04:11
    Drac: I actually tested the FT232RL today. I thought I was imagining it at first, so I double checked. The FT chip does exactly as it is described - DTR (etc) are active low. So is the CP chip. BTW The reset only occurs on DTR transitions from 0V to 3V.

    Mark_T: Yes, the reset button would place a short on the output of the FT or CP chips DTR pin for a short time. Probably not catastrophic these days, but not really good practice. The diode would protect this, as would a resistor (~1K would be an excellent choice).

    All:

    My real reason is for everyone to be able to use a cheap USB-TTL board for ~$4-$5 on eBay. Cuts the entry cost for beginners, and they are usable on other micros too (may use RTS instead, but this is also available on some of these boards)
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-07-28 04:18
    Active low = "resting high"? if so, that would fit with the Tx and Rx pins which are also "resting high".

    Personally, I'd not be keen on shorting a chip's output, even though, like you say, it can probably handle it.

    So then the next question, can you do this with one component? Choices - a 1k resistor, or a 1N4148? It may not matter - both would work.
  • RaymanRayman Posts: 14,876
    edited 2011-07-28 07:56
    I think you can reprogram the FT232RL to be either active low or active high.
    Maybe you can do the same with your chip?
  • prof_brainoprof_braino Posts: 4,313
    edited 2011-07-28 09:05
    Thanks for you work on this. Following with interest....
  • RaymanRayman Posts: 14,876
    edited 2011-07-28 09:25
    Makes me wonder how mad Parallax would be at me, if I made my own version of a Prop Plug with 5V and 3.3V power and sold for less...
    I have a feeling they'd be very upset, which is why I haven't done it (well, that and not having any time to actually do that).
  • prof_brainoprof_braino Posts: 4,313
    edited 2011-07-28 09:42
    Rayman wrote: »
    Makes me wonder how mad Parallax would be at me, if I made my own version of a Prop Plug with 5V and 3.3V power and sold for less...
    I have a feeling they'd be very upset, which is why I haven't done it (well, that and not having any time to actually do that).

    I don't know about that, I imagine if it was good that Parallax would probably sell it. If it works I will buy it, regardless of who it comes from, I will likely be needing a bunch soon. My thought is the current design was determined to be the best possible solution, at the time, for techinical reasons. If the environment has changed, it may be time to reconsider desisions based on the old environment. Go for it! Of course, Cluso99 has already started and might beat you to it.
  • TubularTubular Posts: 4,717
    edited 2011-07-28 16:38
    Rayman wrote: »
    Makes me wonder how mad Parallax would be at me, if I made my own version of a Prop Plug with 5V and 3.3V power and sold for less...
    I have a feeling they'd be very upset, which is why I haven't done it (well, that and not having any time to actually do that).

    With these $3 (in lots of 50) to $4 USB<>TTL converters on ebay, which include 5v and 3v3, is there any point? Doesn't Bill already have something similar?

    There are three minor reasons I can see
    1) The onboard 3v3 regulator @ 100mA might not supply enough current for all applications, or might get hot
    2) The pinout is different (correct it using the jumper wires provided)
    3) The prop plug is a very elegant little device design wise. I haven't come across anything more elegant except maybe the ftdi moulded leads

    It might make more sense to design a compact prop board to suit the 6 pin header of those converters. Parallax have stated they are in the business of selling more Prop chips, and that would better help that goal.
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-07-28 17:34
    I don't really think Parallax would be upset. Currently it is a deterent to newbies to checkout the prop chip. Parallax have a few pcbs with the propplug (FTDI chip) onboard which overcomes the initial cost factor. Professionals won't care - they will make their own circuits to suit their own requirements.

    I don't propose we change our pcbs to suit as these could disappear from eBay.

    The FTDI chip driver can invert the DTR (and others) line. I haven't found anything to do the same in the CP device, but the driver could be modified to do this instead - bigger job though.

    Anything that simplifies the circuit to a single two wire component such as (nothing at all preferred), resistor, diode or capacitor (in that order) is preferable. Better to use something pre-existing. None of us can build these for the ~$4 price point. The chip alone costs that much!
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2011-07-29 00:35
    Back at the beginning, I stood back from getting a Prop as I didn't have a Prop Plug or any FDI chips. Then I saw a reprint of the three transistor interface from an Elektor artical, this enabled me to put together a version of a DemoBoard.

    I wonder if the reset transistor is a throw back to that sort of interface where it acts as an isolation between the +/- 12 Volt differentiated spikes off of the DTR?


    ADDIT:-It also gives that useful open (ish) collector to allow for other reset sources.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-07-29 09:46
    Cluso posted -
    My real reason is for everyone to be able to use a cheap USB-TTL board for ~$4-$5 on eBay. Cuts the entry cost for beginners,...
    Currently it is a deterent to newbies to checkout the prop chip.

    Cluso99,
    Would it be an heinous act of piracy to discuss this or do you just want to stay with the USB aspect/s?
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-07-29 16:20
    PJAllen: I would prefer to keep this thread confined to the use of cheaper USB-TTL board, cheaper propplugs, etc.

    If, as I think you refer to cheaper entry to the prop for newbies, this would be a great new thread. I have some ideas here. While I think the entry price of the Parallax ProtoBoard (USB) and the QuickStart are great, I do believe there are other possibilities.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-08-01 17:36
    I think the transistor reset is more of a throwback to the RS232 interface with full RS232 levels which are typically in excess of +/-6V. This voltage could damage the Prop so it is safely coupled through an NPN in much the same way RS-232 signals are converted to logic levels in many chips. The reason the DTR is inverted is also to supply a negative voltage to the basic 2/3 transistor circuit's transmitter to enable RS232 transmission although as I have pointed out in some old posts that this is unnecessary anyway. This is also why the 2/3 transistor circuit does not work with terminal emulators as they all assume that DTR needs to be active (positive voltage) and thus renders the transistor's transmission inoperative due to a lack of pull-down voltage (which would work with a simple ground).

    Most of my commercial designs have some kind of support chip in them such as a PIC or a C8051 etc and I program these to monitor the DTR line and generate a clean reset. An added benefit of a cheap support chip is that I also monitor the Prop's RXD as well so I can take control of the Prop's EEPROM and load in code directly into it even over wireless and RS485 networks. BTW, the support chip is connected to the Prop's I2C lines as a means of communication as the support chip may normally drive LEDs and provide A/D inputs etc (way cheaper than MCP3208s etc).

    Here's a shot of my bare Prop Plug pcb with a micro USB connection and a prop plug compatible 4 or 8 pin header (extra 4 for power and I2C).
    prop plug .png
    774 x 292 - 26K
  • Martin HodgeMartin Hodge Posts: 1,246
    edited 2011-08-01 19:00
    FWIW; I just removed all the reset circuit components from an ASC and tied the DTR line from the FT232 directly to the prop and it seems to work exactly the same. I'm very interested in the outcome of this thread too.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-08-01 19:34
    Peter said
    Most of my commercial designs have some kind of support chip in them such as a PIC or a C8051 etc and I program these to monitor the DTR line and generate a clean reset. An added benefit of a cheap support chip is that I also monitor the Prop's RXD as well so I can take control of the Prop's EEPROM and load in code directly into it even over wireless and RS485 networks. BTW, the support chip is connected to the Prop's I2C lines as a means of communication as the support chip may normally drive LEDs and provide A/D inputs etc (way cheaper than MCP3208s etc).

    My personal download circuit has been a USB to serial cable (ebay, $2), a max232 ($1), D9 (50c) and about 50c of support components. Ballpark similar cost to the solutions proposed above and a lot cheaper than a prop plug.

    But in a more recent design I've experimented with the FT232 so these discussions about leaving the reset transistor out are intriguing. I also have a design (untested as yet) which disconnects the eeprom and the download pins once a program is downloaded, with a view to freeing up these pins so there truly are 32 I/O pins available on the propeller. I'm using some discrete circuitry but I could see a definite advantage to combining that into Peter's support chip idea.

    Wireless downloads sound interesting. I'm also running into a problem with downloads taking too long with large 300k C programs, and so thinking about sending data directly to an SD card and bypassing the propeller. Again, a support chip could do that as well.

    Once you think about the idea of adding a support chip there are quite a few things it could do.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-08-01 20:04
    Dr_Acula wrote: »
    <snip>

    Once you think about the idea of adding a support chip there are quite a few things it could do.

    Well it seems quite natural for me to use another small micro rather than a hodge-podge of hardware. Take this schematic of a support chip I recently used, some of it's features are:

    1) Monitors 18 channels of 24V signals and and converts these to 12-bit ADC over I2C
    2) Monitors the XBEE receive data and captures special command sequences for programming etc
    3) It's in-circuit programmable from the Prop itself so no ICP headers and adaptors etc
    4) Temperature sensor on-chip
    5) Only needs one spare "programming" pin from the Prop besides the default I2C lines.
    Prop support chip.png

    (screen capture has an overlay bug at present)

    For $3 I get a self-scanning 18 channel 12-bit ADC with internal reference etc plus all the other features I mentioned. Also 8051 code and tools are easy and I have a little ICP driver I temporarily load into the Prop's RAM just for the chip programming.

    Could it be better or easier? But forgive me, I digress from the thread (a little)
    964 x 489 - 42K
  • TubularTubular Posts: 4,717
    edited 2011-08-01 23:56
    Peter's solution prompted me to get back in contact with Microchip and see if this concept can be made to work yet. I'll post any updates here and on the blog entry.

    Essentially its a similar idea - use a $3 micro to replace the (prop plug + adc + rtc) prop plug functionality plus some other benefits.

    There's still a difference between the $4 ebay usb<>ttl converters, which are 'finished modules', and just a raw micro. But still the other advantages might make it worthwhile

    cheers
    tubular
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-08-02 00:28
    Hi Tubular,

    I'd like to use a common USB micro as well in place of the not-as-cheap-as-it-could-be FT232 (also scarce at present). I looked at the PIC18F27J53 approach and the chip looks good with some extra Flash too. It doesn't look like you can use the internal oscillator for full speed USB though (low speed only) whereas the Silabs parts are all-in-one devices such as a similar product, the C8051F387. But whatever device is used we need to have reliable USB VCP code and drivers. I'm willing to explore this approach for substitute USB serial chips. Should we start a thread somewhere for this?
  • TubularTubular Posts: 4,717
    edited 2011-08-02 00:53
    Peter,
    Its your idea originally, so feel free to revive or start a fresh thread as you see fit, and I'll contribute what I can. I have some Silabs resources and some microchip, but not much experience with the usb side of things.

    Technically there are several similar solutions to this - PIC, Silabs, maybe TI or Atmel or maybe FTDI VNC2 (no analogs). There may be other solutions. It really comes down to what works reliably, as opposed to pricing and features, so I don't see any other way than to delve in and try and road test unfortunately. Starlino did some USB PIC boards available on GG and maybe it would be worth checking in with them about possible unresolved issues, experiences and capabilities.

    For mine I'll try the PIC18F47J53 PIM again with updated .hex file if its available. The PIC presents as a "100kB mass storage device", and the idea was to send a 32kB prop image to it, and it would then boot the prop with that image, and afterwards go into a peripheral mode using I2C or uart comms. I struck an issue when transferring 8kB or larger files, and I didn't see any point continuing development until that was resolved. Hopefully they have fixed that but it might be a limitation of internal sram buffers or something.

    cheers
    tubular
  • jmgjmg Posts: 15,185
    edited 2011-08-02 00:59
    Hi Tubular,
    I'd like to use a common USB micro as well in place of the not-as-cheap-as-it-could-be FT232 (also scarce at present). I looked at the PIC18F27J53 approach and the chip looks good with some extra Flash too. It doesn't look like you can use the internal oscillator for full speed USB though (low speed only) whereas the Silabs parts are all-in-one devices such as a similar product, the C8051F387. But whatever device is used we need to have reliable USB VCP code and drivers.

    This is a natural progression, and the Ardunio have moved to Mega8U (but already hit a code ceiling..., so learn from that )
    It really does need to be a small-micro, that can (optionally) run without a crystal.

    Besides component replacement, once you have a small micro, you can add a Serial/Terminal channel, and some instrumentation features like
    Frequency counters, and Pin Stimulus, as well as ADCs.

    The SiLabs 38x is a good choice & it can run on 5V.

    Another choice may be the new AtXmega (A3U/A4U), as I think the latest spin of that adds USB/RC-Osc, and that does have good timers - but being new, it has less eco-system out there. It is also so new, it is not quite real yet... ;)

    The A4U is larger than the SiLabs, and comes in tqfp44(0.8mm) and qfn44(0.5mm), and the latter would (just) allow a DIP form factor
    Another XMega minus, is the AVR Studio is an absolute monster, with baggage.
  • TubularTubular Posts: 4,717
    edited 2011-08-02 02:13
    K2, interesting, I hadn't seen that. Certainly cheap.

    Do you know if they ever got the USB<>Serial for debugging working ? It's listed as a "planned feature" on that fischl website.

    What kind of device does it enumerate as? Or is it a kind of proprietary device that needs the programming software to know about its protocol?
  • K2K2 Posts: 693
    edited 2011-08-02 23:56
    Those are good questions. Only very recently did I become aware of these devices (i.e. Arduino programmers that use AVRs to do USB). I expect to have a lot better idea of what they are about, shortly. A couple of the flight controllers I'm evaluating require their use.
  • TubularTubular Posts: 4,717
    edited 2011-08-03 16:32
    So I had a look again at the PIC18F47J53 PIM, specifically the MSD + CDC demo, which gives a small mass storage drive using the PIC's internal flash, plus serial port that doesn't require a driver (CDC class)

    This time things are working better, but they have shunk the USB drive emulation to 7.5kB ! I always found issues with transferring files > 8kB, so perhaps this is their temporary solution. The thing I like about the PIC is that it's also available in 28 pin DIP, so there are fewer barriers to using it.

    The 7.5kB aint much, but its still useful for an opening html file with links, or a program run/launch menu, or a PinDef kind of file,
    Here are some impressive demos that are 4kB and make use of DirectX 8 (windows)
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-08-03 21:17
    The moment the parts cost $3 we may as well use the FT232RL chip. I know a cheap ATTiny can run USB but I think only at LS and may not work at 115200 for downloading.

    Nut I was really thinking of using something already built and tested, with minimal modification. That is why those CP2102 USB/TTL boards look so attractive.
Sign In or Register to comment.