Go Down

Topic: BitBang Scripts. (Read 758 times) previous topic - next topic

spycatcher2k

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.
Drew.
http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design work undertaken
SMD & Thru-Hole assembly

Graynomad

#1
Mar 09, 2011, 12:53 am Last Edit: Mar 09, 2011, 01:14 am by Graynomad Reason: 1
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

Rob Gray aka the GRAYnomad www.robgray.com

spycatcher2k

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.
Drew.
http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design work undertaken
SMD & Thru-Hole assembly

Mr. Swarf

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!!
M.S.

Go Up