Yesterday, a friend from Tokyo HackerSpace said that he bought an DIY Arduino kit. The problem is that the ATmega168P does not come with the required bootloader. Just the same day I bought two FreakDuino boards and tried to use them to flash the bootloader with no luck. FreakDuino boards had no problem as I tested the same approach using other Arduino type boards available at the hackerspace.
This morning an idea popped up in my mind to use the Bus Pirate with avrdude. I managed to program but something was off because I was not able to connect to the bootloader. I can use Bus Pirate with avrdude directly as it’s firmware can interact with avrdude. “How about embedding it into Arduino IDE?” was the question in my mind now.
While messing around the directory of Arduino IDE, I found some text files and answer to my question lies in one of them: programmers.txt
Just add these three lines to it and you are good to go (note: you might need root privileges for Linux)
buspirate.name=The Bus Pirate
buspirate.communication=serial
buspirate.protocol=buspirate
Enjoy!
[...] Via Tayken’s Blog [...]
I have a few questions. How do you connect the bus pirate to the arduino to program it? Are you using the stock bus pirate firmware? Or do you need to install an alternate firmware to make the Bus Pirate in to make STK500 v2 AVR programmer clone? And lastly are there any setting that need to be configured on the bus pirate before it can be used as an AVR programmer?
All this information is actually at Bus Pirate Documents, under AVR programming. You can access the page from here: http://dangerousprototypes.com/docs/Bus_Pirate_AVR_Programming
So, if I answer your questions:
- For connections, please check “Bus Pirate AVR programming connections” table on the link I gave above.
- I’m using stock BP firmware as avrdude has Bus Pirate support after version 5.8, there was a problem with BP firmware but all is fixed in firmware 5.10+
- avrdude uses the binary access mode, that is the computer program tells BP to change pin states etc by sending some messages to it, so no settings are needed, just plug the cables and select “w\ The Bus Pirate” option for the programmer as the programmer that you’ll use for flashing the Arduino bootloader.
I hope this clears any questions you have in mind. But if you still have some, don’t hesitate. You can even contact me by the contact form if you want to ask in private.
Got the buspirate to show up as programmer, so that’s good, yet it fails:
”
Detecting BusPirate …
**
BusPirate: using BINARY mode
avrdude: initialization failed. rc=-2
Double check connections and try again. or use -F to override
this check.
The stupid thing is, using avrdude -c buspirate -P /dev/ttyUSB0 -p t85 -v (in this particular case) works just fine from a console. Any pointers as to what could cause this?
I guess I somehow messed up something. I write my program’s hexfile manually using avrdude, and that worked and verified fine. But I guess something is wrong now. Maybe the fuses. I’ll see if I can figure out what
Hey there, sorry for the late reply. I am guessing that you are trying to program an Attiny85 w/Arduino IDEusing the Bus Pirate as a programmer. From what I’ve read you have to load a “bootlader” which is actually just setting the fuse bits. That error is usually displayed when the clock speed on the fuse bits and the crystal do not match.