Arduino using ATmega328p with internal 8MHz Crystal with Bus Pirate

I am working in a robotics project where keeping the cost low is crucial. So in order to reduce costs and make the robot easy to program and connect to various types of sensors easily, I choose to use an ATmega328p so I can use the Arduino enviroment but using the internal 8MHz clock.

Here are the steps I made to program the bootloader into the ATmega328p chip using the all-mighty Bus Pirate froam Dangerous Prototypes:

Connect the BP to the microcontroller according to this (add link) table.

in a terminal check the connection between the BP and the microcontroller using

avrdude -c buspirate -p m328p -v -P /dev/ttyUSB0

unlock bootloader section on the chip using

avrdude -c buspirate -p m328p -P /dev/ttyUSB0 -U lock:w:0x3f:m

go to the folder where you installed arduino with

$cd /whatever/arduino/hardware/arduino/bootloaders/atmega

and use this command to write the correct bootloader to the chip

avrdude -c buspirate -p m328p -P /dev/ttyUSB0 -U efuse:w:0x05:m -U hfuse:w:0xDA:m -U lfuse:w:0xE2:m -U flash:w:ATmegaBOOT_168_atmega328_pro_8MHz.hex

then lock again the bootloader section with

avrdude -c buspirate -p m328p -P /dev/ttyUSB0 -Ulock:w:0x0F:m

now test with a ftdi chip to program with the arduino IDE

About Gary

I build robots for fun! View all posts by Gary

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: