The Parallax Propeller microcontroller is one of my favorites albeit a little pricy these days. I love it for its ease of programming with 8 cores allowing for up to 8 completely independant operations. It's like having 8 regular microcontrollers in one chip that can all easily interface and share data with each other.
However, one problem that has plagued me often is that when you plug in the USB connection, it creates a transient on the reset line causing the Propeller to reset. If you are just going to reprogram the chip this isn't a problem. But what if you have a running program and want to use the USB to interface with the Propeller at any time for data transfer but need the Propeller to continue running where it is? This then, becomes a problem. A reset mid program is undesired for sure.
An easy solution is to use 2 different pins for a serial data interface and this works quite well but what if your application doesn't have 2 extra pins to dedicate to this?
Another option is to somehow track where the program is at and at reset, return to where it was and continue. This could work for non critical routines, but what if you were in the middle of a timed sensor read or worse yet, in the middle of saving data to non volatile memory? This would result is data corruption and render it useless.
A third option is to somehow block the initial transient when the USB is plugged in but allow valid reset pulses to pass.
In the schematic below, I've created a method of using a delay to block the transient when the USB is initially plugged in using R28, C16, D2, and U12. In this particular case, I've also added a method of controlling power to the USB to Serial using the USB_ON line to control the 6MHz clock out from CBUS3 for crystal less operation of the Propeller to 48MHz. If this isn't needed, you can remove the OR gate and connect the +5v from the USB connector to where the output of the OR gate is.
When the circuit powers up, one input of the OR gate is pulled low by R26, the other input (USB_ON) is initially set low by the Propeller. The output of the OR gate being low, turns the FT230XS off by pulling the VCC pin low. In addition, the RC circuit created by R28 and C16 are also pulled low making one input of the NAND gate low pulling the RST line high, disabling a reset.
The USB_ATT line is pulled low through R26 telling the Propeller that no USB is connected.
When a USB is connected, the +5v line pulls one input of the OR gate high and the USB_ATT line also goes high through current limiting resistor R29 telling the Propeller that a USB has been connected.
With the OR gate output now high, the FT230XS turns on and the RC circuit begins to charge. It's at this initial connection that the transient from RTS# happens. But since one input of the NAND gate is still low, it blocks that transient from passing to the RST line.
The nominal time for the NAND input to reach high is 24 seconds. This was to account for temperature variations since the time will decrease in cold weather plus under most conditions data will only be sent or received while the Propeller is running and only on specific circumstances will the reset need to be activated for firmware upgrades so waiting 30 seconds or so to do so is not a problem and ensures that the connection is stable. It also gives the Propeller a chance to send any important information before being reset. This time can be reduced by using a smaller value for R28 with the new time being approximately:
t = 1.2 * R28 * 10uF
Once the USB operations are complete and the connection removed, the output of the OR gate drops low turning off the FT230XS as well as pulling the RC circuit low. This causes C16 to discharge through D2 in a short amount of time readying it for the next USB connection.
If however, the USB_ON line has been pulled high by the Propeller, nothing changes until the Propeller pulls USB_ON low. In addition, the USB_ATT line is pulled low on a disconnect telling the chip that it is no longer connected.
The Parallax Propeller is a fantastic microcontroller and by creating a delay for the reset, it's possible to have a running program with on the fly USB connection using the same 2 pins for programming and data transfer without the fear of accidentally resetting the chip in pin limited applications.
I hope you've learned something from this short article and if you want more information on the charging of capacitors as used here, click on the image to check out this other post explaining capacitors in a DC circuit.