USB µISP store on Tindie
This post is going to be the permanent home for user information for the USB µISP. The version history:
- 0.1: Initial prototype
- 0.2: Unreleased version - contained an error
- 0.3: Changed the Tiny2313 power source to 3.3 volts. Removed USB level shifting resistor/zener combination. Added diode+pullup level shifting to Tiny2313 inputs. This version should be able to program target-powered systems down to 1.8 volts (in theory).
- 0.4: Remove 10 µF tantalum cap. Replace input and output bypass caps on LDO with 10µF and 22µF respectively. Hopefully this will reduce the impact of voltage transients if/when the target is hot-plugged. Change USB- pull-up resistor to be constant rather than logic-gated.
- 0.5: Add a current limiting switch to the target power circuitry. Should make it safe to hot-plug the target once and for all.
- 0.5.1: Change the USB- pull-up resistor back to being logic-gated.
- 1.1: Change to QFN-20 controller and SSOP buffer chips.
- 1.1.1: Minor silkscreen improvements.
- 1.2: Change to TSSOP buffer chip.
- 1.3: Replace voltage selection header with a switch.
- 1.4: Add a recovery clock output.
- 1.5.1: Add termination resistors on USB data lines and logic outputs.
The USB µISP is a clone of both the AdaFruit USB Tiny programmer and the SparkFun Pocket AVR programmer. It adds a 3.3 volt regulator which allows target power to be switched between 3.3 volts, 5 volts, or no target power (meaning that the target is self-powered during programming). In all cases, a bus buffer level-shifts all programming signals relative to whatever the target's voltage is.
There is three position switch (or for older versions a three pin SIP header with a jumper) on the top edge of the USB µISP next to the target connector. It is used to select target power. If you place it in the left position (again, with the USB connector on the left), then the target will be supplied 3.3 volt power. If you place the switch in the right position, then it will be supplied 5 volts. If you place the switch in the center position, then no power will be supplied to the target, and it will need to be self-powered.
For versions 1.4 and beyond, there is a single pin in the bottom center which supplies a 500 kHz square wave during programming (it will be in a high impedance state at other times). This can be be used to supply a recovery clock to targets incorrectly fused for an external crystal. The clock's high voltage is the target's Vcc voltage, and low is ground. If your target is incorrectly fused, then connect a wire from this pin to one or the other XTAL pin on the target and try again, adding a -B 250 to the avrdude command line. This results in an SPI clock speed of around 4 kHz. The default value of the -B argument to avrdude doesn't always give the controller enough time to respond. Use avrdude to reset the fuses back to the factory default and then remove the recovery clock wire and try again. Depending on the state of the fuses, it's conceivable that the recovery clock still may not work. If your sketch changes the system clock prescaler, then one trick is to connect the RESET pin temporarily to ground before applying power (or connecting the programmer) to prevent the code from running. If you have disabled RESET, then there is no alternative to HV programming to recover.
When supplying target power, the target can draw up to 200 mA at 3.3 volts or 5 volts. If your target draws more than that during programming, it must be self-powered.
There are two LEDs near the USB connector. The bottom (green) one is labeled "CONN" and indicates that the programmer has been recognized by the host computer. It should always be on whenever the programmer is connected, however it is normal on some systems for the light to remain off until it's first used.
The top LED (red) is labeled "PROG" and indicates that the programmer is currently in use and programming the target. This light should be on whenever avrdude is working, and should shut off when the programming job is finished.
In general, to use the USB µISP, you should first insure that the voltage selection switch (or jumper) is set to the correct position for supplying power (or not) to your target. Next, connect a 2x3 DIP cable between the USB µISP and the target system, insuring that you connect pin 1 on the cable to pin 1 on the plug on both ends (pin 1 on the USB µISP is towards the edge of the board). Lastly, connect the USB cable between the host and the USB µISP. You should see the CONN led light up. Use avrdude as intended and you should see the PROG led light and avrdude should indicate it's working. Starting with version 0.5 of the board, you may connect and disconnect the target while the USB cable is plugged in if you wish.
For avrdude, you should supply the "usbtiny" argument to -c. For the Arduino IDE, choose "USBTiny" from the Programmer menu (under Tools).
If you don't see the CONN light when you connect the USB µISP, check your USB cable to make sure it's connected properly. If it still doesn't light, check for +5 volts on the right-most pin of the 3 pin voltage select header. If you don't see that, then check for +5 volts on both ends of the polyfuse (it is in the top left corner of the board near the USB connector). If you only see +5 volts on one side, then that fuse has blown. It will self-reset, but may take some time (potentially days). If you do see +5 volts all the way to the power select header, check the opposite side for 3.3 volts. If you don't see it, then the LDO has failed and must be replaced. If the power is good, then try plugging the USB µISP into another host.
If the CONN light lights up but avrdude complains that it can't find the target, check the target power switch to insure target power is as you expect it to be. Next, check the ISP cable to make sure you've plugged it in the correct orientation on both ends. Next, make sure you've identified the target to avrdude properly (the -p argument). If it still doesn't work, then it's likely your target has problems.
The most likely target problem is the SPI clock speed. In order to successfully program your device, it's system clock must be at least 4 times (and preferably 8 times) higher than the SPI clock speed. This is set with the -B argument to avrdude. The argument is the number of microseconds (floating point) added to the cycle period (in other words, 1000 divided by the value is the clock frequency in kHz). The default for the USBTiny is 10, which results in a ~100 kHz clock. If your target isn't running at at least 400 kHz, this may be too fast. As noted above, if you write code that alters the prescaler setting, that change will persist across RESET, which means that it will also impact programming. This can bite you if you change the fuse settings or replace your crystal (or both), but don't clear out the flash first. As a workaround, you can remove power, and jumper the RESET pin to ground. This will prevent the code from running, allowing the programming to occur at whatever system clock speed the fuses denote.
Of course, if all else fails, there is always HV programming, but that requires a different programmer.
Schematic
Acknowledgements
I'd like to acknowledge Dick Streefland's work on the original USB TinyISP and the two derivatives
of it - the
AdaFruit USBTiny and the
SparkFun Pocket AVR programmer - that directly led to the development of the µISP.
Please do not use the Adafruit USB VID/PID without written permission from Adafruit Industries, LLC and Limor "Ladyada" Fried (
support@adafruit.com). Permission is granted for 8pino.cc, Geppetto Electronics, littlewire, Ihsan Kehribar and Seeed Studio and Sparkfun by Adafruit Industries, LLC to use the Adafruit USB VID/PID for approved products. The USB µISP is one such approved product.