Loading...
Pages: [1]   Go Down
Author Topic: BitBang Scripts.  (Read 453 times)
0 Members and 1 Guest are viewing this topic.
Scotland
Offline Offline
God Member
*****
Karma: 3
Posts: 513
Have you had your Arduino fix today?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a high turnover of ATMega328 & 168 chips for arduino and different projects.
Needing a cheaper way to get these, I buy them in 100's from my suppliers and program the bootloaders
myself.

If anyone is interested - here are the scripts i use (Bitbanging is covered elsewhere in the forums).

avrdude -p m328p -c diecimila -B 4800 -P ft0 -e -U lock:w:0x3f:m -U lfuse:w:0xff:m -U hfuse:w:0xda:m -U efuse:w:0x05:m

avrdude -p m328p -c diecimila -P ft0 -D -U flash:w:328boot.hex:i

avrdude -p m328p -c diecimila -P ft0 -U lock:w:0x0f:m

put the above 3 lines in a bat file (mine is 328boot.bat) in the avrdude directory, it will program a virgin atmega328 to an arduino chip in about 20 seconds, you also have to copy the file ATmegaBOOT_168_atmega328.hex to the same directory and rename it 328boot.hex

for the atmega168 :

avrdude -p m168 -c diecimila -B 4800 -P ft0 -e -U lock:w:0x3f:m -U lfuse:w:0xff:m -U hfuse:w:0xdd:m -U efuse:w:0x00:m

avrdude -p m168 -c diecimila -P ft0 -D -U flash:w:168boot.hex:i

avrdude -p m168 -c diecimila -P ft0 -U lock:w:0x0f:m


put the above 3 lines in a bat file (mine is 168boot.bat) in the avrdude directory, it will program a virgin atmega168 to an arduino chip in about 20 seconds, you also have to copy the file ATmegaBOOT_168_diecimila.hex to the same directory and rename it 168boot.hex

If you want to program a final image to the chip, replace ***boot.hex with your own .hex filename.

Hope this helps


Drew.
Logged



Drew.
(MyPCB MANUFACTURING SERVICE)
Duemilanove - UNO - Leonardo - Mega 1280 - Mega 2560 - Pro
& Way too many custom boards.

nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 75
Posts: 6976
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks spycatcher.

One question, what is actually doing the programming here?

-c diecimila

Is this an Arduino ISP? I don't see diecimila as an option for avrdude.
 

______
Rob

« Last Edit: March 08, 2011, 07:14:47 pm by Graynomad » Logged

Rob Gray aka the GRAYnomad http://www.robgray.com

Scotland
Offline Offline
God Member
*****
Karma: 3
Posts: 513
Have you had your Arduino fix today?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The -c diecimila is supported under the older verion of AVRDUDE (mine is from 2007) -
See here for files : http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html*.
Remember to download the updated avrdude.conf file from the same site. The site also gives you step by step instructions on how to do the job manualy.

hope this helps

Drew

*this is not my site, I 'borrowed' the link from another post.
Logged



Drew.
(MyPCB MANUFACTURING SERVICE)
Duemilanove - UNO - Leonardo - Mega 1280 - Mega 2560 - Pro
& Way too many custom boards.

Norman, OK, USA!
Offline Offline
Full Member
***
Karma: 0
Posts: 127
Klingon Machinist
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The details in the original post should JustWork[tm] with 'diecimila' replaced with whatever programmer you use. In my case I use a USBasp programmer.

Nice. I'll sit down and write a shell script (Linux, Unix, MacOS) using the above.

Thanks!!
Logged

M.S.

Pages: [1]   Go Up
Print
 
Jump to: