Using external programmers (USBasp)

From Tuxamito
Revision as of 17:43, 13 April 2016 by Daniel (talk | contribs) (Usage)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Sometimes one will need to program an Arduino board that does not have a programming interface or will want to build a custom one using and Atmel AVR chip. If the chip contains no bootloader or we do not have a serial interface we can use an external ICSP programmer, such as the USBasp. In this page we will explain how to use such programmer.

USBasp description

USBasp is a USB in-circuit programmer for Atmel AVR controllers. The programmer uses a firmware-only USB driver, no special USB controller is needed.

Features:

  • Works under multiple platforms such as GNU/Linux, Mac OS X.
  • Allows you to read or write the microcontroller EEPROM, firmware, fuse bits and lock bits.
  • No special controllers or smd components are needed.
  • Programming speed is up to 5kBytes/sec.
  • SCK option to support targets with low clock speed (< 1,5MHz).
  • 10 pin ISP interface (conforms to standard ISP 10-pin pinout).

Usbasp01.jpg

More info: http://www.fischl.de/usbasp/


10 pin ISP interface

Male Interface:

ISP 10 way pinout.png

Female Interface:

Usbasp02.jpg

Usbasp03.jpg

  • Red: VCC
  • Black: GND
  • Blue: RST (to AVR reset pin)
  • Green: MOSI (to AVR SPI's master output pin)
  • Orange: MISO (to AVR SPI's master input pin)
  • Yellow: SCK (to AVR SPI's sync serial clock pin)

Usage

The next picture shows the cables connected to an ATmega328p on a breadboard connected to the USBasp programmer, ready to be used.

Usbasp atmega.jpg


Then select the USBasp programmer in the Arduino IDE:

Usbasp arduino1.png


And programming it using this option of the menu (or pressing CONTROL+SHIFT+U):

Usbasp arduino2.png


For the uploaded program to work, the atmega328p will need extra hardware (such as the 16MHz clock) or we can use the internal RC oscillator by configure the FUSE bits accordingly. If the clock is different that the one of the board selected probably it is a good idea to create our own board for the Arduino IDE so that the functions that depend on the timings work correctly. An example of this can be seen in the description of the Custom RBOT Board