Go Down

Topic: Loading sketch and fuse on a naked 328P PCB (Read 567 times) previous topic - next topic


I have a pcb with a new 328P chip installed with a ISP 6 pin connection.

I am using 1.0 RC2 IDE

I know that this has been asked before and I am bleary eyed from reading the forum posts, and not getting it (8 hours into it now).

I  use an external resonator @16 Mhz .

I am using (or would like to use) a USBtinyisp v.3.0

What exact steps should I follow?

At the moment I would be happy to get a simple blink sketch running. I have a heap of code that works on a Duimilanove clone...works great..and need to get running on this custom board with the layout of the connectors I need..... :smiley-roll-sweat:


I forgot to add that I am using the MEGA 328P-AU TQFP package  like the Nano v 3.0 .

Thanks in advance

David Garrison
Gaithersburg MD USA


Dec 03, 2012, 01:13 am Last Edit: Dec 03, 2012, 02:09 am by simplex Reason: 1
This is a tutorial for programming a target atmega328 with an Arduino Uno board.

Working with USBtinyisp v.3.0 should be similar.


(Sorry for the english, it would be more easy for me to explain in French.)

The more simple method with an USBtinyISP :
I just perform it last week for the first time  :smiley-mr-green:

If the fuse are not programed you must do it before loadind the hex file.
For more information about fuse have a look on the datasheet and on http://www.engbedded.com/fusecalc

For programming the fuse use avrdude in command line
For the avrdude manual : http://download.savannah.gnu.org/releases/avrdude/avrdude-doc-5.11.pdf

I use avrdude with the interactive mode option -t
To autorize the fuse modification use the "-u" option (unsafemode)
Code: [Select]

$ avrdude -c usbtiny -p 328p -u -t
avrdude> d lfuse                          //read the fuse before modify it
000 62                                       // Internal oscillator factory selected

avrdude> w lfuse 0 0.0x7f            // External oscillator selected with 64 ms stabilization
>>>>write lfuse 0x7f 

//on so on for all fuses, Mysetting :  hfuse = 0xD9(no change)  efuse : no change, see Nota1

// q to quit the script

1) With the IDE arduino make only the compilation step
2) Save the hex file, for example blink.hex.
With Linux it is in the Temporary folder, with Windows it is also a temporary folder but I don't know this name.

Load the hex file with avrdude in command line
Code: [Select]
$ avrdude -c usbtiny -p 328p -U flash:w:blink.hex:i

To use the usbtinyISP with Debian linux I had to create a UDEV rules, with Windows I don't know.
Code: [Select]
# Fichier créé pour essayer de faire fonctionner le tinyusb
# règle trouvée sur www.ladaya.net/make/usbtinyisp/avrdude.html
# autre source d'info : http://wiki.debian.org/fr/udev
# Ordres utiles :
#   - Relancer la lecture des scripts : #udevadm control --reload-rules  -> plus vraiment utile
#   -Relancer udev     #service udev restart

SUBSYSTEM=="usb", ATTR{product}=="USBtiny", ATTR{idProduct}=="0c9f", ATTRS{idVendor}=="1781", MODE="0666", GROUP="dialout"

Nota 1 :
Efuse :
It is impossible to write 0xFF.
"My" explanation: only  three bits (0,1,2) can be modified. The others are "blocked" to "1".
With three bits you have only values between 0 and 7.
"so" 0x07 = 0xFF  :smiley-eek-blue:
If I mistake please answer the good explanation.

Go Up