Bare metal embedded programming with Atmega328 uC
Goal: Add In-circuit
circuit programmer to the base circuit
Task - Setup the in-circuit programmer
rogrammer with the base circuit
Component List
Sl. No. Part Parameter Count Remarks
1 Base circuit Use the base circuit built
in the previous lesson
2 USBASP In-circuit
circuit programmer 1
Description
The Atmega328 microcontroller supports in-circuit
in programming. In-circuit
circuit programming, also know as in
in-
system programming, is a feature which allows the microcontroller to be programmed while being
installed in the production system. The advantage of the feature
feature is the microcontroller need not be
plugged out of the final product for firmware upgrades. However, a hardware component called InIn-circuit
programmer is required to program the microcontroller.
USBASP is one of the in-circuit
circuit programmers used to pprogram
rogram the AVR microcontrollers. It is used to flash
the microcontroller with bootloader, application program and fuse & lock bits.
The USBASP has a USB connector which plugs into the USB port of the development PC and the 10 pin
header is used to connect it to the development board. Out of the 10 pins, only 6 pins are used. While
programming the microcontroller,, the power is supplied by the programmer. The USBASP has a jumper
setting to choose between 3.3V and 5 V power supply as shown in the following figure.. We are using 5V
power supply for our board, so the jumper must be set accordingly.
Bare metal embedded programming with Atmega328 uC
Circuit Diagram
Now, wire the in-circuit programmer to the development board built in the previous lesson as shown in
above circuit diagram.
Sl. No. USBASP connector Pin (Male Header) Connected to
1 MOSI (Pin 1) Pin 17 of ATMega328/P
2 Vcc/5V (Pin 2) Vcc of the power rail of breadboard
3 Ground (Pin 3) Not connected
4 Ground (Pin 4) Gnd of the power rail of breadboard
5 Reset (Pin 5) Pin 1 (reset) of ATMega328/P
6 Ground (Pin 6) Not connected
7 SCK (Pin 7) Pin 19 of ATMega328/P
8 Ground (Pin 8) Not connected
9 MISO (Pin 7) Pin 18 of ATMega328/P
10 Ground (Pin 10) Not connected