Arduino serial programmer and bootloader

Hello guys !
I have build by myself an arduino board from here http://arduino.cc/en/Main%20/ArduinoBoardSerialSingleSided3 but instead of atmega8 I used an Atmega 168 - 20pu.

How can I write the bootloader to this Atmega ?
What bootloader should I use to make my arduino work ?

Thanks

PS: I used this programmer
http://yo9hnh.wordpress.com/2008/11/01/programator-icsp-pentru-avr/
and i have build something like this
http://yo9hnh.wordpress.com/2008/10/31/arduino/

you must connect the 6pin I(C)SP pin header of the board with the programmer.

then you can use avrdude to upload the bootloader to the chip. Your programmer is called siprog.

Or you can even use the Arduino IDE to upload the bootloader to the chip. For this, you have to edit the programmers.txt (find it in the hardware directory of your Arduino software directory) and add the following lines:

siprogserial.name=lancos SI-Prog serial ISP
siprogserial.communication=serial
siprogserial.protocol=siprog

then start the Arduino IDE and select the serial port your ISP programmer is connected to (e.g. COM1).

Then select the board you are using (e.g. Arduino NG or older w/ ATmega168)

Then upload the bootloader by selecting the correct ISP programmer in the Tools menu (in your case: lancos SI-Prog serial ISP). The correct bootloader is then uploaded to your chip.

Thank you for the information.
After the changes made like you said the Arduino IDE software return me this message :

Done burning bootloader.

If I disconnect the siprog device and try to burn the bootloader it say :

Burning bootloader to I/O Board ( this may take a minute )...
avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
Double check connection and try again , or use -F to override this check.

This operation I have made to be sure that the siprog is recognized and the serial port COM1 is not blocked by some firewalls or antivirus software.

The settings for burning bootloader is:

  • in Tools menu , Board submenu , it's selected the Arduino Diecimila or Duemilanove w/ ATmega168
  • serial port submenu it's selected COM1
  • next step is to select from submenu Bootloader the w/ lancos SI-Prog serial ISP

After I select this it take a few seconds ( 20 seconds ) and return me: Done burning bootloader.

Only If I have the SIprog conected and powered on.

So I think the bootloader is burned on ATmega 168.
The chip I use in the Arduino is ATMEGA168 - 20PU.

I pull out the chip from the programmer and plug in to the arduino board.
Power on the arduino board after I connected to the serial port with an normal 1 to 1 cable. This it means that i have made and db9 male to db9 female cable with pin to pin connection ( 1 to 1 , 2 to 2 , 3 to 3 and so on 9 to 9 ).After power on the power led it lights showing me it is powered on.

Going to Sketchbook -> Examples -> Digital -> Blink

Goood! I select Blink and after this select Upload to I/O Board.

The Uploading to I/O Board ... message apear , the LED0 RX blink for a 2 or 3 seconds and an error is shown:

Problem uploading to board. See http://www.arduino.cc/Guide/Troubleshooting#upload for sugesstions.

Binary scketch size : 976 bytes (of 14336 byte maximum)
avrdude: stk500_getsync(): not in sync: resp oxoo
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

And thats all.

What I do wrong ?

Thank you very much for your help.

Sounds like you uploaded the bootloader to the chip. But the chip does not work on your Arduino board.
My guesses:

  1. try Arduino NG or older w/ ATmega168 instead of Arduino Diecimila or Duemilanove w/ ATmega168
  2. check if your Arduino board has a 16 MHz crystal (otherwise the bootloader won't work)
  3. try another serial cable for uploading sketches, this one might be broken

I guess the 16MHz crystal is missing on your board. Because you got a sync error.

I will attach a few photos of my board so you can figure by yourself some stuff.

Imgur
Imgur

The siprog programmer here :

Imgur
Imgur
Imgur

So what you think.

is it possible that you forgot to solder one end of R1 or R2? At least it looks so on the picture. I guess this affects the serial communication of your board. Did you ever see RX or TX blinking?

Also recheck C1 and C2...

But of course there can be many other problems with a circuit like this one...

At least you have a 16 MHz crystal, so this is not the problem.

The programmer looks good, should work.

The r1 and r2 are ok!
I will try to change te 22pF capacitors .

The LED0 RX it is blink three times befor Arduino IDE show me the error message.

try to upload the simple Blink example using avrdude. I mean: create a .hex file of the Blink example and then upload it to the chip using your siprog programmer. Do you know how to do that?

Then: look at the led that is connected to pin 13... is it 1 sec on, 1 sec off? Or is it faster or slower? Then you have a problem with the crystal or the fuse bits of your chip. Otherwise you should check the serial port and all of its components again.

And one question: shouldn't the error message be: http://arduino.cc/en/Guide/Troubleshooting
you wrote:

Problem uploading to board. See http://www.arduino.cc/Guide/Troubleshooting#upload for sugesstions.

I mean: create a .hex file of the Blink example and then upload it to the chip using your siprog programmer. Do you know how to do that?

I do not know how to do that and yes the messege shown in the arduino 0015 is like I said. I'll do a screenshot and I will show you. OK ?

Thank you very much. If you are kind can you tell me please how to make an hex file and upload with avrdude and siprog programmer ?

  1. Hit the Upload to Board button
  2. have a look at the preferences.txt file (see http://www.arduino.cc/en/Hacking/Preferences)
    and find the key:
last.sketch.path
  1. open this path in your explorer and go to its subdirectory called applet
  2. you find a file called Blink.hex there
  3. use avrdude to upload the Blink.hex file:
    5a. open a shell (cmd.exe) in the applet directory from the last step
    5b. type:
avrdude -p m168 -c siprog -P COM1 -U flash:w:Blink.hex
  1. move the chip to your Arduino boaard.

Hello again!

I solved my problem :smiley:

The problem was the Quartz oscilator. The 22pF capacitors were another value. I have changed the capacitors and powered on the board.
The LED 13 started to blink a little bit faster.
I have loaded the blink scketch and uploaded to the board. The LED0 RX started to blink fast and the led conected to the pin 13 of the output started to blink in the same time with the LED13 L who stared to blink with 1Hz frecquency.

Now I have another issues.
How can I erase the older scketch and upload another one ?

I say this because I've tryed to upload another scketch while the actual scketch is running and show me this error:

Problem uploading to board. See http://www.arduino.cc/Guide/Troubleshooting#upload for sugesstions.

Binary scketch size : 1000bytes (of 14336 byte maximum)
avrdude: stk500_getsync(): not in sync: resp 0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

Now what should I do ?

Thank you very much!

maybe the auto reset does not work. Try to remove power from the device and then power it up again and then try again to upload the sketch... or maybe there is a reset button on your board?

Yes !
You are wright! The jumper for autoreset function was not on.
I vahe set ON the jumper for autoreset function and now it is work very nice.

Thank you for the help !

Now I have a new toy to play with!

Thanks again! :smiley:

Sorry, I just read it right now.

bohne is right. Looking your picture we can't see the autoreset jumper installed. You must use this jumper, or use manual reset to upload the sketch.

No problem!

I've allready put the autoreset jumper.
It works like a charm.

Thank you !

Perhaps you forgot to put the auto reset jumper because your board "loose" the "auto reset enable" information on cooper side of the board... :wink: