Uploading C code on bootloaded Atmel328p

Hi,

Using Nick Gammon's excellent tutorial (http://www.gammon.com.au/forum/?id=11637), I was able to burn a bootloader on an atmel328p chip. As in the tutorial, I tried to upload a couple of arduino sketches (printing ASCII table over the serial port, blinking LED) and they seemed to work fine.

Now, I am trying to upload a simple C program to blink an LED following this tutorial : AVR Tutorial - Getting Started: Blinking an LED

I am having trouble with avrdude when it tries to upload it to the chip. Here is the error I am getting :

stk500v2_ReceiveMessage(): timeout

Here are the commands I've used:

avr-gcc -mmcu=atmega328p -Wall -Os -o blink_try.elf blink_try.c
avr-objcopy -j .text -j .data -O ihex blink_try.elf blink_try.hex
avrdude -v -p m328p -c stk500 -P /dev/ttyUSB1 -e -U flash:w:blink_try.hex

I am not sure what's going on.

-yogesh

avrdude -v -p m328p -c arduino -P /dev/ttyUSB1 -e -U flash:w:blink_try.hex

it worked, thanks! :slight_smile: I do have a question though. Is the arduino bootloader a generic one? ie, can we load a standard AVR C program onto a chip containing a bootloader loaded from the arduino IDE?

boeing_737:
it worked, thanks! :slight_smile:

Excellent. You are welcome.

Is the arduino bootloader a generic one?

It uses the STK500v1 protocol so, yes, it is a "generic" bootloader.

ie, can we load a standard AVR C program onto a chip containing a bootloader loaded from the arduino IDE?

Yes.

EEPROM data is not supported by Optiboot.