Pages: [1]   Go Down
Author Topic: Loading sketch and fuse on a naked 328P PCB  (Read 528 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 42
Writing Arduino code is fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 42
Writing Arduino code is fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 109
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is a tutorial for programming a target atmega328 with an Arduino Uno board.
http://pdp11.byethost12.com/AVR/ArduinoAsProgrammer.htm

Working with USBtinyisp v.3.0 should be similar.
« Last Edit: December 02, 2012, 08:09:25 pm by simplex » Logged

France S-O
Offline Offline
Edison Member
*
Karma: 41
Posts: 2183
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

(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:
$ 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:
$ 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:
# 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.
Logged

Pages: [1]   Go Up
Jump to: