Arduino Forum

Using Arduino => Microcontrollers => Topic started by: ProfePaco on Dec 21, 2011, 01:15 am

Title: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 21, 2011, 01:15 am
Hi:

I am following these instructions to program Attiny85:
http://hlt.media.mit.edu/?p=1229

First of all, I have realized that we cannot use arduino IDE 1.0. So I downloaded version 0022. There are no compiling errors in this version.

However, as I try to upload the simple blink example, moving the output to pin 2, I obtain these results:

Problem uploading to board:
Binary sketch size: 658 bytes (of a 8192 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

I am doing exactly the same steps and connections as that webpage states... what is wrong?

Thanks in advance
Title: Re: problem programming Attiny85 with UNO
Post by: Coding Badly on Dec 21, 2011, 01:51 am

Did you disable auto-reset using a 10 uF capacitor?
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 21, 2011, 01:55 am


Did you disable auto-reset using a 10 uF capacitor?



Yes, following exactly those instructions.
Title: Re: problem programming Attiny85 with UNO
Post by: Coding Badly on Dec 21, 2011, 04:24 am

The error indicates that either the Arduino ISP sketch is not installed or that auto-reset is still firing.  I suggest working through the steps a second time.
Title: Re: problem programming Attiny85 with UNO
Post by: guardian_of_light on Dec 21, 2011, 07:41 am
http://hlt.media.mit.edu/?p=1695 (http://hlt.media.mit.edu/?p=1695) Updated for UNO and 1.0 IDE. Works well, I have tested it. Of course, Coding_Badly's response still applies, but also make sure everything is wired and powered correctly. I spent an hour messing with the IDE files only to realize my reset resistor was connected to GND.  :smiley-red:
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 21, 2011, 07:49 am

http://hlt.media.mit.edu/?p=1695 (http://hlt.media.mit.edu/?p=1695) Updated for UNO and 1.0 IDE. Works well, I have tested it. Of course, Coding_Badly's response still applies, but also make sure everything is wired and powered correctly. I spent an hour messing with the IDE files only to realize my reset resistor was connected to GND.  :smiley-red:


Thanks a lot.

I am taking breakfast now, no time to check it.

This afternoon I will try it.
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 21, 2011, 08:55 pm
Please, help me.  =( =( =(

I cannot find anything wrong. Follows some pictures with all the info.

(http://img403.imageshack.us/img403/1688/img0502yo.jpg)

(http://img844.imageshack.us/img844/6994/img0503f.jpg)

(http://img513.imageshack.us/img513/3513/img0506sk.jpg)

(http://img849.imageshack.us/img849/1870/img0507p.jpg)

(http://img6.imageshack.us/img6/3939/img0508ho.jpg)

(http://img85.imageshack.us/img85/1423/img0509nk.jpg)

I have changed the capacitor as well, just to check whether it was defective.

any feedback? Thanks.
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 21, 2011, 09:10 pm
And I have tried to burn the bootloader to run at 8MHz, and I obtain the same error:

avrdude: stk500_getsync(): not in sync: resp=0x00
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 21, 2011, 09:38 pm
More trials...

I am not sure whether I have to use a capacitor or a resistor to disable the autoreset. So now I have used a 150 Ohm resistor (not have 120) between Reset and Ground. Is this another option? is this right?

Anyway, I obtain the same error as before. This is really frustrating....
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 21, 2011, 09:55 pm
Now I tried reset-resistor-+5V... same error...
Title: Re: problem programming Attiny85 with UNO
Post by: Coding Badly on Dec 21, 2011, 11:38 pm

The wiring looks fine.


Quote
I am not sure whether I have to use a capacitor or a resistor to disable the autoreset.


You may not have to use either.  The latest Optiboot does not require disabling auto-reset.  If you purchased the Uno recently, it may already have a "good" bootloader installed.  Try...

Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 21, 2011, 11:43 pm
I have a nano as well, can I use it?

removing capacitor or resistor does not help....
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 21, 2011, 11:55 pm
so this is what I have done:

I load file/examples/ArduinoISP
I set board = Arduino Uno
I upload it


No errors


Then I load Blink example.
board = Attiny internal 1MHz
Programmer = Arduino as ISP (and this was selected before, for the previous case as well)
I upload it
I get this error:
Binary sketch size: 768 bytes (of a 8192 byte maximum)
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): programmer is out of sync

in the last case, if the capacitor is used. the error is:
Binary sketch size: 768 bytes (of a 8192 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x00


Title: Re: problem programming Attiny85 with UNO
Post by: Coding Badly on Dec 21, 2011, 11:58 pm
I have a nano as well, can I use it?


It should work well.  I suggest using the 120 ohm resistor method to disable auto-reset.  You will have to find a combination of resistors to get the value in the correct range.  I don't know if using a capacitor is appropriate with the FTDI chip.

If you get the Nano working as an ISP, I also suggest updating the Uno bootloader.  Not having to fiddle with auto-reset is very nice!

Quote
removing capacitor or resistor does not help....


Unfortunately, you are not the first person to have trouble disable auto-reset on an Uno.  You may want to search through the forum for other suggestions.


And just to make certain you are not wasting your time with the Nano... Whenever you get the "expect=0x14, resp=0x51" error or the "not in sync: resp=0x00", you have to re-upload the Arduino ISP sketch.  There is a very good chance the sketch was erased when the bootloader ran.  If you have not been re-uploading the Arduino ISP sketch when that error occurred, this would be a good time to start from scratch using the capacitor to disable auto-reset.
Title: Re: problem programming Attiny85 with UNO
Post by: Coding Badly on Dec 22, 2011, 12:01 am

so this is what I have done:

I load file/examples/ArduinoISP
I set board = Arduino Uno
I upload it

No errors


Did you disable auto-reset at this point?


Quote
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85


These can be ignored.

Quote
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): programmer is out of sync


Huh.  That's different.
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 22, 2011, 12:21 am
I was able to burn the bootloader (for 8MHZ option) using the method of holding the reset button, as described here:
http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection

However, I cannot upload the Blink example after that. I have first upload again the ArduinoISP sketch...

error=
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): programmer is out of sync

If I am quick enough for setting 8Mhz... it is very strange it does not work for the Blink example...

I feel extremely tired....

More tomorrow..
Title: Re: problem programming Attiny85 with UNO
Post by: putyn on Dec 22, 2011, 09:44 am
why don't you add an 120R resistor between reset and +5V or a capacitor between reset and GND ?
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 22, 2011, 09:47 am

why don't you add an 120R resistor between reset and +5V or a capacitor between reset and GND ?


As I posted before, I have add a capacitor, remove it, with no success. I will try resistor.

As a curiosity, when i plug the capacitor, and the board is powered, the board resets itself...  :smiley-eek:
Title: Re: problem programming Attiny85 with UNO
Post by: guardian_of_light on Dec 22, 2011, 11:27 am
What I found to work, 10k resistor between attiny RST and +v AND 22nF cap between attiny RST and Arduino reset pin. No modification/parts added to arduino. Don't remember where I found these instructions. Let us know.
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 22, 2011, 06:43 pm

What I found to work, 10k resistor between attiny RST and +v AND 22nF cap between attiny RST and Arduino reset pin. No modification/parts added to arduino. Don't remember where I found these instructions. Let us know.


I have used your method. It does not work  :~

I have used a 120K resistor.... it does not work....   =(

What i can do is burning the bootloader to have 8MHz option. I can do this with the 120 resistor, or holding the reset button.

Why can I set the fuses up, with no errors, but I cannot upload the Blink example?

This is extremely frustrating...
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 23, 2011, 01:20 am
I think that with the resistor I have disconnected the auto reset. Led associated to pin 13 does not blink during upload, and now the error is different:

Binary sketch size: 768 bytes (of a 8192 byte maximum)
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): protocol error

any idea about the meaning of this error?
Title: Re: problem programming Attiny85 with UNO
Post by: Coding Badly on Dec 23, 2011, 06:48 am
I think that with the resistor I have disconnected the auto reset. Led associated to pin 13 does not blink during upload, and now the error is different:


Or, the Arudino ISP sketch has been erased.

Connect an LED to pin 9.  When the ArduinoISP sketch is idle, does the LED on pin 9 slowly get brighter then dimmer?

When you try to upload to the ATtiny, does the LED on pin 9 blink?
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 23, 2011, 11:18 am

I think that with the resistor I have disconnected the auto reset. Led associated to pin 13 does not blink during upload, and now the error is different:


Or, the Arudino ISP sketch has been erased.

Connect an LED to pin 9.  When the ArduinoISP sketch is idle, does the LED on pin 9 slowly get brighter then dimmer?

When you try to upload to the ATtiny, does the LED on pin 9 blink?



Thanks for your interest.

I connected the led.

When ArduinoISP is idles, yes,  LED on pin 9 slowly gets brighter then dimmer.

If I upload again ArduinoISP skecth I can see the led blinking. That's good.

However, when I try to upload the Blink example, Led does not blink, stays on. Then an error is written, and the led gets brighter and dimmer again, so the ArduinoISP sketch is not erased, but the Blink example is not uploaded.

So I think that the situation now is:  I have stopped the auto reset, but I cannot upload the blink example to the ATtiny85.

I have used another Attin85, with the same result. Yesterday i tried arduino nano with no success. At this pointy I think I will never do it....

:smiley-eek:

Title: Re: problem programming Attiny85 with UNO
Post by: guardian_of_light on Dec 23, 2011, 12:56 pm
Don't get discouraged. This took me a week (or two) to get working. What I posted wasn't my actual setup anyway, (http://insapio.files.wordpress.com/2011/12/breaduinoprogrammingattiny85.png is, however.)

I was getting the same error as you for at least a week. You might need to erase your Uno, disassemble your setup, and try out some other projects for a few days. Come back to it fresh. I dunno why, but that always helps me.
Title: Re: problem programming Attiny85 with UNO
Post by: guardian_of_light on Dec 23, 2011, 01:00 pm
I also got to the point where I completely deleted the IDE, reinstalled, added back the tiny cores (the new 1.0 cores of course) and gave it another go.  I'd done an inordinate amount of fiddlin' with my boards.txt and the avrdude.conf files, so ymmv.
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 23, 2011, 02:36 pm
Perhaps the only solution is buying one of these programmers:

http://www.ebay.es/itm/260766932832?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

http://www.ebay.es/itm/280761316552?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

I am spending too much time on this problemm, even I am taking too much time from you... sorry for that....

Title: Re: problem programming Attiny85 with UNO
Post by: guardian_of_light on Dec 23, 2011, 03:17 pm
Ha, no problem man, I've got infinite free time! But yeah, one of those should work out of the box. Although, so should the ArduinoISP  :~
Title: Re: problem programming Attiny85 with UNO
Post by: Coding Badly on Dec 24, 2011, 09:42 am

I have good news, annoying news, and good news.

First the good news.  I've reproduced the problem and I know what is wrong.

Now for the annoying news.  Arduino 1.0 and the ArduinoISP sketch are not compatible.  There are some problems with the ArduinoISP sketch and Arduino 1.0 surfaces at least one of those problems.

And, finally, the good news.  I have an update for the ArduinoISP sketch that works correctly with Arduino 1.0.  If you'd like a copy, send me a Personal Message (http://arduino.cc/forum/index.php?action=pm;sa=send;u=10859) with your email address.
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 24, 2011, 09:57 am


I have good news, annoying news, and good news.

First the good news.  I've reproduced the problem and I know what is wrong.

Now for the annoying news.  Arduino 1.0 and the ArduinoISP sketch are not compatible.  There are some problems with the ArduinoISP sketch and Arduino 1.0 surfaces at least one of those problems.

And, finally, the good news.  I have an update for the ArduinoISP sketch that works correctly with Arduino 1.0.  If you'd like a copy, send me a Personal Message (http://arduino.cc/forum/index.php?action=pm;sa=send;u=10859) with your email address.




:D :D :D

pm sent

Thanks a lot!!!
Title: Re: problem programming Attiny85 with UNO
Post by: Coding Badly on Dec 24, 2011, 10:12 am

Email sent.
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 24, 2011, 04:41 pm
So perfect work. Thanks a lot!!!

Now I can finally program the ATtiny85...

Here just a simple sound sensor that activates a relay... working!

(http://img94.imageshack.us/img94/7986/img0511wb.jpg)
Title: Re: problem programming Attiny85 with UNO
Post by: leo_groeneveld on Dec 26, 2011, 06:04 am
That's great!

Over here no succes yet.

Instead of that I get this:
After Burning Bootloader to ATtiny45
(http://img508.imageshack.us/img508/7140/errormessageburningboot.jpg)
This should be ok.
And then it happened:
After trying to upload the sketch to the ATtiny
(http://img803.imageshack.us/img803/8416/errormessageuploadingsk.jpg)

What went wrong?
Title: Re: problem programming Attiny85 with UNO
Post by: Coding Badly on Dec 26, 2011, 06:54 am

How did you disable auto-reset?

Is the LED on pin 9 fading when the TinyISP sketch is idle?
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 26, 2011, 09:07 am
I know that the question is not for me, but in my case, I used the 120 Oh resistor, adding two resistors to get that value.

Title: Re: problem programming Attiny85 with UNO
Post by: leo_groeneveld on Dec 26, 2011, 09:27 am
I have to check pin 9 with a led.

I used a 10 uF from an old VCR so it might be faulty or the legs are too short to use in the bread board. New ones are on their way.

I will put a led on pin 9 and try a resistor.

(I bought a clone Uno so I don't know what bootloader is on the Uno itself)

I'm going to try again, I'm new at this so my stock of resistors is limited but I will try.
Title: Re: problem programming Attiny85 with UNO
Post by: ProfePaco on Dec 26, 2011, 09:28 am

I have to check pin 9 with a led.

I used a 10 uF from an old VCR so it might be faulty or the legs are too short to use in the bread board. New ones are on their way.

I will put a led on pin 9 and try a resistor.

(I bought a clone Uno so I don't know what bootloader is on the Uno itself)

I'm going to try again, I'm new at this so my stock of resistors is limited but I will try.


I have a clone Arduino uno...
Title: Re: problem programming Attiny85 with UNO
Post by: leo_groeneveld on Dec 26, 2011, 10:16 am
I've made this configuration with a couple of resistors to get exactly 120 ohms.
(http://img803.imageshack.us/img803/980/breadboardwith120resist.jpg)

Now I get this error message after the Rx led on the Uno flashes three times:
(http://img195.imageshack.us/img195/8416/errormessageuploadingsk.jpg)

This is the orientation of the ATTiny in the bread board wrt it's connections.
(http://img825.imageshack.us/img825/8250/orientationofattinyinbr.jpg)

(I previously bent the legs of the cap for a better fit in the bread board but no results there)

(I'm going to clear everything today to put an extra lamp on the ceiling tomorrow)

EDIT:

It's working now!!!

I made the rookie mistake of not connecting the ground of the chip after I used the ground lead for the resistors and I left the cap and resistors out and now it works.
So the auto reset is not disabled. I also connected a led to pin 9 to see the heartbeat.

Thanks guys for the support.

Here a short vid of the result.
Brake lights for my Team Associated SC10 short course race truck.
(you cannot see it clear on the vid but the leds burn when the brake is engaged, with the potmeter I can tune the moment of engagement to follow trim of the ESC if necessary)

http://www.youtube.com/watch?v=WITOf1tZjXc

Title: Re: problem programming Attiny85 with UNO
Post by: blasyepi on Jan 21, 2012, 11:18 am


I have good news, annoying news, and good news.

First the good news.  I've reproduced the problem and I know what is wrong.

Now for the annoying news.  Arduino 1.0 and the ArduinoISP sketch are not compatible.  There are some problems with the ArduinoISP sketch and Arduino 1.0 surfaces at least one of those problems.

And, finally, the good news.  I have an update for the ArduinoISP sketch that works correctly with Arduino 1.0.  If you'd like a copy, send me a Personal Message (http://arduino.cc/forum/index.php?action=pm;sa=send;u=10859) with your email address.



Please Sent Me.

Thank you.