burn bootload to atm238 using arduino uno

So using this guide http://arduino.cc/en/Tutorial/ArduinoToBreadboard
I wanted to bootload one of my atm238 to use its internal clock for standalone project.
I have set it up without an external clock but when I try to burn using ATmega328 on a breadboard (8 MHz internal clock) setting
I get this error msg::::
avrdude: stk500_program_enable(): protocol error, expect=0x14, resp=0x50
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

. And I've been trying to findout how to fix it and actually get the internal clock going.. I have been able to bootload it with this guide http://3g1l.com/blog-burn-bootloader-blank-atmega328atmega328p-arduino-uno
without an external clock, however it seems not to activate the internal clock because when I dont use it in the arduino uno card nothing happends. I guess opti doesnt use the internal clock.

anyone around here that could help a lost soul :slight_smile: its my first project where i want to use only the micro controller with a custom made card.

I would really love to get the internal clock going and not have to use an oscillator/regulator

thanks for your time and help

The ATmega needs a running system clock to be ISP programmed. If the chip is set to use a crystal you need to either provide the crystal or provide an external clock. Adafruit has a version of ArduinoISP that provides an 8MHz clock on Pin 9 that ca be used to provide the external clock.

Thanks for the replay about how to program it

However what I'm looking for is how to change the fuses on my atmega 238 to run on the internal clock while beeing able to run arduino code, to my understanding this is done with the bootloader, but I don't get where I can change the cksel bits to use the 8mhz internal clock instead of an external one.

Did you follow the directions under "Minimal Circuit (Eliminating the External Clock)"? That covers the downloading of Breadbord.zip and using Burn Bootloader to set the fuses.

Remember that even if the goal is to set the fuses for the internal clock, if the fuses are currently set for an external clock you won't be able to program any fuses without an external clock.

arro:
I wanted to bootload one of my atm238 to use its internal clock for standalone project.
I have set it up without an external clock but when I try to burn using ATmega328 on a breadboard (8 MHz internal clock) setting
I get this error msg::::
avrdude: stk500_program_enable(): protocol error, expect=0x14, resp=0x50
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

I had the very same problems when I tried to use my Arduino Uno R3 to bootload an Atmega328 with internal 8MHz clock and i came up with a solution. Firstly, you really need to provide a clock to pin 9 of the 328 regardless of whether you need it or not. Doing this ensures that whatever state your chip ends up in, it has a clock.

So, using the following additional board type:

##############################################################
atmega328bb.name=ATmega328 (8 MHz internal clock)
atmega328bb.upload.protocol=stk500
atmega328bb.upload.maximum_size=30720
atmega328bb.upload.speed=57600
atmega328bb.bootloader.low_fuses=0xE2
atmega328bb.bootloader.high_fuses=0xDA
atmega328bb.bootloader.extended_fuses=0x05
atmega328bb.bootloader.path=arduino:atmega
atmega328bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F
atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
atmega328bb.build.core=arduino:arduino
atmega328bb.build.variant=arduino:standard

, you can modify the ArduinoISP sketch to fool AVRDUDE into thinking that your Atymega328 is an Atmega328P very easily.

Replace the existing pin definitions with these:

#define CLK_8MHZ 9
#define LED_ERR 8
#define LED_PMODE 7
#define LED_HB 6

Add this code to setup():

// provide 8 MHz output on pin 9 using Timer 1
TCCR1A = _BV (COM1A0); // toggle OC1A on Compare Match
TCCR1B = _BV(WGM12) | _BV(CS10); // CTC, no prescaling
OCR1A = 0; // output every cycle

The Arduino pins are now assigned thus:

Arduino Pin 9 is now a 8MHz clock to Actual pin 9 of the target device
Arduino Pin 8 is the Error LED
Arduino Pin 7 is the Program Mode LED
Arduino Pin 6 is the Heartbeat LED

Add this line to the "universal" function of Randall Bohn's sketch.:

"if(ch == 0x14) ch = 0x0F;"

As shown here:

void universal() {
int w;
uint8_t ch;
fill(4);
ch = spi_transaction(buff[0], buff[1], buff[2], buff[3]);
// if this is an Atmega328 (0x1E9514), we lie and say it's an Atmega328P (0xiE950F)
if(ch == 0x14) ch = 0x0F;
breply(ch);
}

I have tested this on both external and internal clocked 328s and 328Ps and it works fine.

I hope this helps :slight_smile:

Maybe there might be something on Nick Gammon's link that may help you