0% found this document useful (0 votes)
70 views

How To Program An AVR Chip Using A USBASP (10-Pin Cable)

How to Program an AVR chip Using a USBASP (10-pin Cable)

Uploaded by

feridund
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

How To Program An AVR Chip Using A USBASP (10-Pin Cable)

How to Program an AVR chip Using a USBASP (10-pin Cable)

Uploaded by

feridund
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

21.12.

2018 How to Program an AVR ch p Us ng a USBASP (10-p n Cable)

Learn ng about Electron cs

Search

Home
Art cles
Projects
Forum posts
Calculators
Contact

How to Program an AVR ch p us ng a USBASP


http://www.learn ngaboutelectron cs.com/Art cles/Program-AVR-ch p-us ng-a-USBASP-w th-10-p n-cable.php 1/7
21.12.2018 How to Program an AVR ch p Us ng a USBASP (10-p n Cable)

In th s art cle, we w ll go over how to program an AVR ch p us ng a USBASP w th a 10-p n cable.

If you want to know how to program an AVR ch p w th a USBASP us ng a 6-p n cable, see How to Program
an AVR Ch p Us ng a USBASP w th a 6-p n Cable.

A USBASP s a cheap dev ce that allows for wr t ng programs to AVR ch ps, such as an ATmega128 or
ATmega328.

Therefore, we can wr te a program to bl nk an LED and have th s program wr tten nto the flash memory of
an AVR to be run, so that the LED bl nks.

USBASPs are one of the least expens ve opt ons to programm ng AVRs; therefore, t's one of the best
opt ons for do ng so. USBASPs can be obta ned for under $10 on many electron c reta ler s tes.

It s composed of an ATmega88 or ATmega8 and a few pass ve components that allow for wr t ng data to an
AVR ch p's flash memory.

Connect ng t up to allow for t to program an AVR sn't that d ff cult. We w ll now go over the w r ng
connect ons necessary for the USBASP to transfer data from a computer to an AVR ch p.

So we have the USBASP.

One end connects nto the computer. Th s allows for us to transfer the comp led program from the computer
to the USBASP. The other end of the USBASP normally gets connected e ther to a 6-p n or a 10-p n cable,
wh ch can then get hooked up eas ly to a breadboard through header p ns.

Both 6-p n and 10-p n cables are common, so know ng the p nout of these s essent al to connect ng them.

The 10-p n cable p nout s shown below.

http://www.learn ngaboutelectron cs.com/Art cles/Program-AVR-ch p-us ng-a-USBASP-w th-10-p n-cable.php 2/7


21.12.2018 How to Program an AVR ch p Us ng a USBASP (10-p n Cable)

Th s translates nto the real-world w r ng d agram shown below.

http://www.learn ngaboutelectron cs.com/Art cles/Program-AVR-ch p-us ng-a-USBASP-w th-10-p n-cable.php 3/7


21.12.2018 How to Program an AVR ch p Us ng a USBASP (10-p n Cable)

Regardless of whether the 6-p n cable or 10-p n cable s used, and t really doesn't matter, there are 6 p ns we
are really w r ng up and these are the MISO, SCK, RST, VTG, MOSI, and GND connect ons.

Bas cally, we're connect ng the USBASP to the AVR ch p's MISO, SCK, RST, VTG, MOSI, and GND
connect ons that we are programm ng. Th s allows d rect commun cat on between the USBASP and the
target AVR ch p.

The table below expla ns each of the p ns and the r funct on.

Pn
Descr pt on Comment
Name
Master Out Th s allows the master dev ce (the USBASP) to send data to the slave dev ce
MOSI
Slave In (target AVR be ng programmed).
Master In Th s allows the slave dev ce (target AVR be ng programmed) to send
MISO
Slave Out nformat on to the master dev ce (the USBASP programmer).
Th s s the mutual clock shared between the master and slave dev ce for
SCK Ser al Clock
synchron zed commun cat on.
Target AVR The reset p n for the AVR ch p be ng programmed must be put n act ve low n
Reset
MCU Reset order for programm ng to occur.
Vcc Power The master and slave dev ce both need power n order to operate.
Common The master and slave dev ce must share a common power ground. for
GND
Ground operat on.

http://www.learn ngaboutelectron cs.com/Art cles/Program-AVR-ch p-us ng-a-USBASP-w th-10-p n-cable.php 4/7


21.12.2018 How to Program an AVR ch p Us ng a USBASP (10-p n Cable)

W th th s setup, the USBASP s the master dev ce and the AVR ch p we are programm ng s the target, or
slave dev ce. The best way to th nk of t s the master dev ce s do ng the programm ng, wh le the slave
dev ce s the subord nate dev ce that s need of be ng programmed.

In order for a master dev ce to program a slave dev ce, they need have commun cat on amongst each other.
The master dev ce needs to be able to wr te data to the slave dev ce's flash memory and be able to rece ve
data from the slave data. Th s s done through the MOSI and MISO p ns. The MOSI p n stands for Master
Out Slave In. Th s s the p n by wh ch the master dev ce outputs, or wr tes, data to the target AVR wh ch s
be ng programmed. MISO stands for Master In Slave Out. Th s s the p n by wh ch the slave dev ce (AVR
be ng programmed) can send nformat on to the master dev ce. Both these commun cat on pathways are
essent al to program a dev ce. So the MOSI and MISO p ns establ sh communcat on amongs the master
dev ce and the slave dev ce t s to program.

The SCK p n s the clock. It s essent al because n order for the master and slave dev ce to commun cate,
they need to have a t me s gnal to commun cate data n synchrony. The common clock s gnal shared between
the master and slave dev ce allow for eff c ent commun cat on.

The RST p n s an essent al connect on because t must be put to an act ve low connect on n order for
programm ng to occur between the master and slave dev ce. It s normally held h gh, but for programm ng to
occur, t must be put low. It s an act ve low p n. When the RST p n s put low, the master slave can
commun cate on the SCK, MISO, and MOSI l nes.

The rema n ng 2 connect ons, VCC and GND, are the s mplest; they are for power. The AVR ch p be ng
programmed and the master dev ce do ng the programm ng both need to power n order to operate.

These are the only 6 essent al connect ons that need to be made from the USBASP Programmer to the target
AVR ch p.

Us ng the popular ATmega328 ch p as an example, we w ll show the w r ng necessary to connect a USBASP


to an Atmega328 ch p to program t.

The schemat c d agram for w r ng the USBASP to the Atmega328 ch p s shown below.

http://www.learn ngaboutelectron cs.com/Art cles/Program-AVR-ch p-us ng-a-USBASP-w th-10-p n-cable.php 5/7


21.12.2018 How to Program an AVR ch p Us ng a USBASP (10-p n Cable)

Bas cally, we just have to know wh ch p ns are the MOSI, MISO, SCK, RST, VCC, and GND p ns, and
connect them correspond ngly from the USBASP to the target AVR ch p.

And w th these 6 connect ons we can program AVR ch ps.

Related Resources

How to Use the LM741 Op Amp as a Comparator

How to Bu ld an LM339 Quad Voltage Comparator C rcu t

How to Bu ld a Dark-act vated Sw tch

How to Bu ld a Hall Effect Sensor C rcu t

How to Bu ld a Touch Sensor C rcu t

How to Bu ld an Accelerometer C rcu t

How to Bu ld a Mot on Detector C rcu t

How to Bu ld a Mot on Detector Alarm C rcu t

Comments

Name
Enter your comment here

Comment Add Image Not us ng Html Comment Box yet?

(Feb 4, 2018) Fel b sa d:


Your "real world d agram" s ups de down. 1 s the red w re. Can you please re-do the p cture?

(Dec 3, 2017) Andre Kravtsov sa d:


Thank you very much for the art cle! Everyth ng s clearly understandable and s mple.

(June 22, 2017) Sj sa d: 1


Thanks for th s art cle, very helpful. Plug number ng appears ncorrect however. Red w re s p n1, on a
correctly w red plug. Unfortunately there appear to be a lot of rubb sh cables on the market, where the
plug s reversed, and the one p ctured s one of those. Therefore, the actual p n out number ng should be:
1 MOSI
2 VCC
3 N/C
Etc.
just someth ng to be aware of when do ng th s :-)

(Jan 8, 2017) narco sa d: 1


http://www.learn ngaboutelectron cs.com/Art cles/Program-AVR-ch p-us ng-a-USBASP-w th-10-p n-cable.php 6/7
21.12.2018 How to Program an AVR ch p Us ng a USBASP (10-p n Cable)

Thank you, f rst gu de w th correct p nouts for me

(Oct 28, 2015) Aash sh sa d: 6


Do we need to short all ground p ns and use them or can we s mply use a s ngle ground ? Also n USBasp
there s add t onal TXD and RXD slots n the 10 p n IDC, should t also be used ?

ATMEGA8-16PU
Home | Art cles | Projects | Programm ng | Calculators |
Let each customer experience the Topspeed, the real
service! One-stop purchase
Contact

icstreet.com OPEN
© 2018 All R ghts Reserved

http://www.learn ngaboutelectron cs.com/Art cles/Program-AVR-ch p-us ng-a-USBASP-w th-10-p n-cable.php 7/7

You might also like