Programming an ATtiny with an USBtinyISP programmer

What is an ISP programmer about?

In one of my previous posts, I explained how to program an ATtiny by using an Arduino Uno as an ISP programmer.
Today, I will explain how to use an USBtinyISP programmer instead.

isp-programmer

An USBtinyISP is used to perform what is called In-System (ISP) Programming.
In other words, it is used to upload a new firmware (program) on a micro-controller.
In-System Programming means that the micro-controller that you want to program is already assembled in an integrated circuit board.
If you look at an Arduino Uno, you will see that there are two 6 pins headers (in yellow).
Capture d’écran 2015-12-10 à 19.34.39
That means the two Atmel chips could be programmed directly, using an ISP programmer, instead of using the USB connection and boot loader.

ISP Header Pinout

An ISP connector will have 6 or 10 pins.
I have only used and seen the 6 pins connectors up until now.
Isp_headers
Note: Picture taken from Wikipedia

If you are designing a PCB with a surface-mounted (SMD) micro-controller, make sure to include an ISP header and to route the proper wires between that header and your micro-controller. Otherwise, well, the moment the chip will be soldered to the PCB, you wont be able to (re)program it.

This schematic includes an ISP header (in yellow):
example-with-isp-header

As you can see, 5 of the 6 ISP header pins are connected to the micro-controller:

  ISP Header     ATtiny
      MOSI   <-->   MOSI
      MISO   <-->   MISO
       SCK   <-->   SCK
     RESET   <-->   RESET
       GND   <-->   GND

The VCC pin of the ISP header is not connected to the micro-controller.
That’s because, in that case, I decided to power the chip from the battery even when programming it.
It’s important to note that the ground is still connected between the ISP header and the micro-controller.

There’s a jumper that you have to configure on your USBtinyISP.
You can see it on the 1st picture of that post, it’s yellow.
It is used to tell the programmer if it should power the micro-controller that you are to program or not.
I never had issues powering the micro-controller with the ISP programmer so far.
But, you will find many people mentioning that this is not a good practice on the Internet.
So, when possible, I try not to power the micro-controller directly from the ISP Programmer.

Before you can use your programmer

If you are using Windows, you will have to install drivers before you can use your programmer.
For me, this used to work (on Windows 8.1) until I upgraded to Windows 10.
Since then, I am using my iMac because I never managed to install the driver properly on Windows 10.
You do not need to install any drivers on both Linux and OSX to use the USBtinyISP programmer.

Connecting your programmer

First connect your programmer to the ISP header on the Printed Circuit Board (PCB) containing the chip to be programmed.
Then, connect your programmer to your computer.
connected-isp-programmer

Selecting your programmer and the right micro-controller in the Arduino IDE

In the Tools menu, make sure to select the right programmer.
select-usbtinyisp

Also select the right micro-controller and its speed.
Note that, by default, most ATtiny micro-controllers are configured to run at 1MHz…

Uploading the firmware to the micro-controller

If you haven’t configured your Arduino IDE to support ATtiny micro-controllers, look at this post.

There’s nothing special about this step.
You simply do the same thing as if you were uploading a program via a USB cable to an Arduino board.
So, you compile and upload the code using the following menu option: Sketch | Upload

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments Protected by WP-SpamShield Spam Plugin