Avrdude

USB AVR Programmer and SPI interface. Adafruit's USBtinyISP.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
platypus
 
Posts: 45
Joined: Thu Jan 19, 2012 1:47 am

Avrdude

Post by platypus »

I installed the latest version of WinAvr 20100110. New at this, but when I run avrdude in the cmd line the avrdude ver is 5.1 and not 5.5

There is no support for usbtiny using this version of Avrdude.

What have I missed?

I have ordered a usbtiny kit but wanted to get the right version of avrdude running first (ie 5.5).

Has anyone had a similar problem getting avrdude v5.5 with usbtiny support?

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: Avrdude

Post by adafruit_support_bill »

Did you download it from the link on the USBTiny page? http://www.ladyada.net/make/usbtinyisp/download.html

User avatar
platypus
 
Posts: 45
Joined: Thu Jan 19, 2012 1:47 am

Re: Avrdude

Post by platypus »

Here is the link to WINAVR I used
http://sourceforge.net/projects/winavr/ ... e/download

If there is a download button from the WINAVR link on the usbtiny page please tell me where as it was not on the page.

But still had trouble downloading avrdude ver 5.5 - if you know where an actual download is please let me know.

I found this link for avrdude which was helpful, in part, but it must be an old version as the 328 is not in the list, but the usbtiny is in the list- strange!
http://tom-itx.dyndns.org:81/~webpage/u ... _index.php.

Then I also found on the Arduino site this: http://arduino.cc/en/Hacking/Programmer
This ultimately got my programmer working.
As you can see in this Arduino link - the preferences file is altered as such- 'upload using':bootloader changed to 'upload using':usbtinyisp
Then you can use the IDE to act as the programming vehicle - you don't need to use avrdude in a cmd line.

I managed to get a local Sparkfun pocket programmer which has been a combined project with Limor Fried, but Sparkfun have now discontinued this programmer.
I was just lucky to buy the last one - ready assembled. Today, I placed an order for two kits from Adafruit.

What I found very confusing was that the links I tried from the Adafruit usbtinyisp pages gave me information that did not get this working.

Avrdude 5.5 is still a mystery - if it exists I still can't find it - your help would be very much appreciated.

So to sum up
- the Arduino IDE uses avrdude ver 5.4 (by default it seems)- I use IDE ver 23 as the latest IDE 1.0 still has some bugs.
By the way by pressing Shift-upload to IO you get a verbose message with everything avrdude is doing - this might help others.
Edit the preferences file to give - upload using:usbtinyisp
The preferences file can be found in the folder as outlined in the Arduino site link (up above).

The usbtinyisp has four leds - during the flash update, all are on, 3 blue and one red. The verbose compiler messages are very helpful.
One thing I found with this Sparkfun programmer is that there is no keyway for the ICSP pins on the cable socket - plug it in the wrong way and nothing happens. Of course in their infinite wisdom the designers configured the socket so the cable runs across the pcb not direct to the edge - why would someone do that? - but once you know!

But something that should have been simple just isn't and that's due to the documentation which took me all day to sort out. Even finding the correct software was difficult, then I found this link which helped http://tom-itx.dyndns.org:81/~webpage/u ... _index.php.

If Adafruit could reorganize the documentation so that it has been checked and works it would really save everyone a lot of time - make it simple like following a recipe please.

Thanks, I hope some of this is useful. I also hope that the kits I receive will by some miracle, work!

If you have better links, that work, please let me know - it would save a lot of time.

User avatar
platypus
 
Posts: 45
Joined: Thu Jan 19, 2012 1:47 am

Re: Avrdude

Post by platypus »

I found this link to avrdude downloads - but, if you can explain which version is the better please.
If you have used any of these which do you prefer?

http://download.savannah.gnu.org/releases/avrdude/

There are also patches - how are these used and why are they necessary.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Avrdude

Post by adafruit »

the latest winavr should have avrdude 5 or later, its also supported in arduino v1.0 for sure - check the FAQ for instructions

User avatar
sdb
 
Posts: 31
Joined: Thu Jan 12, 2012 4:24 am

Re: Avrdude

Post by sdb »

One thing I found with this Sparkfun programmer is that there is no keyway for the ICSP pins on the cable socket - plug it in the wrong way and nothing happens. Of course in their infinite wisdom the designers configured the socket so the cable runs across the pcb not direct to the edge - why would someone do that? - but once you know!
Use the other end of the flat cable.

(Usually, but not always, the connectors are oriented on ribbon cable such that the two ends exit opposite each other.)

User avatar
platypus
 
Posts: 45
Joined: Thu Jan 19, 2012 1:47 am

Re: Avrdude

Post by platypus »

Use the other end of the flat cable.
I recently found, on the Sparkfun site that they recommend that the key (which is on the socket, under the cable entry side) go toward the inner part of the board. Yes, it's not the best way to design a socket as we know as there should always be a key(as part of the header/socket), but there you are.

User avatar
platypus
 
Posts: 45
Joined: Thu Jan 19, 2012 1:47 am

Re: Avrdude

Post by platypus »

Just a short note that I managed to get the usbtiny working to upload a sketch - using the IDE (it runs avrdude in the background - to see the data transfer press shift/upload - this shows the hex data transfer and avrdude messages)

I used the method outlined on the Arduino website( see link at top of this thread) - changing the preferences file upload.using=bootloader to upload.using=usbtinyisp (or another external programmer type)
then open the IDE and use directly to verify/compile and upload through usbyiny as isp

The next problem is changing back to using bootloader. I feel that posting this here is the right place as it leads on from this thread.

To return to bootloader, you reverse the process in preferences.txt ie upload.using=bootloader (but the IDE must be closed else preferences.txt will not accept the change). To burn sketches via the IDE, the bootloader must be returned to the chip as using the external programmer removes it and gives 1KB more flash space - ie no bootloader.

Not a major problem if you want to continue using usbtiny (or other external programmer and ISP, but bootloader is now gone.

I haven't found any reason for the IDE to deny this reversal back to bootloader or why the usb connection is now not recognized. The driver is working and the porting is correct - I feel it is something to do with the board - maybe fuses. I used the two options listed here in this following url - avrdude (from cmd line) returned success but I think I have missed something as I still can't return the bootloader:
http://www.sparkfun.com/tutorials/247

Option 1: avrdude -P comport -b 19200 -c avrisp -p m328p -v -e -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m
Option 2: avrdude -b 19200 -c usbtiny -p m328p -v -e -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m

That's where I am up to - if you work it out please post as this would complete this process of going to external programmer and back to bootloader.

User avatar
sdb
 
Posts: 31
Joined: Thu Jan 12, 2012 4:24 am

Re: Avrdude

Post by sdb »

Can you not just program the bootloader using the IDE? That is supposed to set the fuses and everything correctly for future 'bootloader' loading.

User avatar
platypus
 
Posts: 45
Joined: Thu Jan 19, 2012 1:47 am

Re: Avrdude

Post by platypus »

Can you not just program the bootloader using the IDE?
I wish it was that simple. It should be, but the IDE-board(direct via usb) doesn't see the USB even though "com6" (in one case) is checked and also shows in the Device Manager:Ports for my Arduino.

I think the chip has somehow become corrupted. I have ordered some and will try another 328 chip to test this theory.

But this process is not as straightforward as Arduino makes out. The chip is a standard Atmega 328, but the instructions on the Arduino link(top of this thread) does not return the bootloader once an external programmer (usbtiny) has removed it.

Tried to reset fuses
To reset the fuses I used the second option (using usbtiny) from the last post and using avrdude in the cmd line. Seemed to set all fuses OK, then tried to burn bootloader via usbtiny after that using the IDE but it returned "out of sync". The first option using 'comport' direct gave an 'out of sync' message from avrdude and the process failed.

I also tried using the IDE with the board direct to a usb, but got the error - no USB found (even though it was checked and recognized in device mgr). Seems to be a problem in the chip!

Until the new chips arrive I can't do much about this issue - think I have tried just about everyhing I could find on the subject.

User avatar
sdb
 
Posts: 31
Joined: Thu Jan 12, 2012 4:24 am

Re: Avrdude

Post by sdb »

platypus wrote:
Can you not just program the bootloader using the IDE?
I wish it was that simple. It should be, but the IDE-board(direct via usb) doesn't see the USB even though "com6" (in one case) is checked and also shows in the Device Manager:Ports for my Arduino.
No, not like that. That is not supposed to work. You need to use your tiny with the IDE to burn the bootloader and the correct Tools->BurnBootloader option. Tutorial: http://arduino.cc/en/Hacking/Bootloader ... Bootloader
but the instructions on the Arduino link(top of this thread) does not return the bootloader once an external programmer (usbtiny) has removed it.
Right, those are the sketch programmer instructions so that is expected. You need to follow the burn bootloader instructions to get the bootloader back.

I've only done it a couple of times, and my setup is rather different from yours, but it worked as documented on the 'arduinoISP' (see below) and 'bootloader' (see above) links.

I don't have a usbtiny, I use: http://arduino.cc/en/Tutorial/ArduinoISP.

User avatar
platypus
 
Posts: 45
Joined: Thu Jan 19, 2012 1:47 am

Re: Avrdude

Post by platypus »

Seems the issue was Windows itself.

I used the laptop (running XP) with usbtiny connected to the Arduino and burned bootloader (using usbtinyisp as programmer) without any problems.

Then edited the Preferences.txt file to give upload.using=bootloader (it was upload.using=usbtinyisp)

The sketch uploaded without any problems.

Now to reinstall XP and clean up the system.

Here is the avrdude reply when the operation failed - indicating a WIN error.
Burning bootloader using usbtiny and IDE V1.0

(Arduino connected to usbtiny)

avrdude error: usbtiny_send: usb_control_msg: sending control
message failed, win error: The I/O operation has been aborted because of either a thread exit or an application request.
(expected 128, got -116)

040312
The acer laptop had no trouble burning bootloader with usbtiny and then uploading the sketch with upload.using=bootloader.

So when in doubt try another machine!

Appreciate all your help and doesn't it get confusing when the actual problem is in the operating system. Something that can happen over time.

Hope everyone got something from this.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Avrdude

Post by adafruit »

Hmm it sounds like you might be having problems with the avr programmer you purchased from sparkfun, please contact them for any more help and support - they did a lot of design changes that we weren't involved in.

User avatar
platypus
 
Posts: 45
Joined: Thu Jan 19, 2012 1:47 am

Re: Avrdude

Post by platypus »

Hmm it sounds like you might be having problems with the avr programmer you purchased from sparkfun, please contact them for any more help and support - they did a lot of design changes that we weren't involved in.
Yes I thought it was the programmer as well, until I used my laptop running the same operating system as my PC - XP with service pack 3.

Using the PC - I can burn any sketch to my Arduino Elevens (328 chip) as often as I like - no problems!
But when I try to burn the bootloader - using usbtinyisp - it hangs and gives a "usb write error".
The IDE direct to Arduino will not burn the bootloader using AVRISPmkii or other - error - "cannot find usb".
i even tried shutting down zonealarm and pulling the internet just to test any interference from that side - it made no difference.


Using the laptop, running the same operating system config as the PC - using usbtinyisp - I can alternate between burning the sketch to the 328 and immediately follow by burning the bootloader - as often as I like - seems a pointless exercise but it shows that the process can be done - as necessary.

The PC has even had a refresh of XP (repair via install, not a new install) and following with a complete refresh of updates up to service pack 3 - still gives that strange error when trying to burn bootloader.

The same Arduino was used across machines.

It's a strange one - and I will eventually get an answer. But it's academic as the usbtiny can upload any sketch and the bootloader is unnecessary when using an external programmer.

I also found one other interesting thing here - when using usbtinyisp, only the pocket programmer driver was necessary - WinAvr was not loaded and was unnecessary when using usbtinyisp - sketches loaded without any issue. In any case the IDE runs avrdude 5.4 by default, for the transfer.

So it seems that using the usbtiny as isp is quite simple once you 'get the hang of it' and try a few different ideas.
All you need to do, to use the external programmer, is to load the usb driver and edit the preferences file upload.using=usbtinyisp
You can do a search or, for Windows XP :
Open My Computer
Tools/Folder Options/View - Uncheck, Hidden Files and Folders
Now you can see the Applications data Folder which is normally hidden.
Vista etc has it in a different path - just do a search for the preferences.txt file
An average sketch takes around 35 seconds to load

The XP path is C(or your boot partition):\Documents and Settings\your user name here\Application Data\Arduino -preferences.txt
Twenty three lines down the file page you will see - upload.using=bootloader
Make sure the IDE is not running else the change will not take.
Change to upload.using=usbtinyisp (or the name of the programmer that you have)
Press SAVE and close the file.
Open the IDE and compile a sketch then press Shift/Upload (shift causes a verbose Avrdude display in the debug window - you can see the streaming hex code as it is uploaded to the chip and it ends with a flash verify then a great end note - Avrdude DONE - Thank you.
That means success - your sketch has been uploaded.

Aside from my obvious operating system issue with the PC(and bootloader) the external programmer works successfully on both my machines to upload sketches and it gives you a whole extra 2KB for the 328 chip - not much but not bad since there is only 32KB of flash memory, tops.

I hope that you too get excited ( at first at least) when you see - Avrdude DONE - Thank you!

axman
 
Posts: 1
Joined: Sun May 27, 2012 9:21 am

Re: Avrdude

Post by axman »

Hi all,

After updating my Arduino environment to V1.0 I did not use my USBtinyISP for some month. Today I needed it to burn a bootloader. I got only some fault messages. After installing the newest version of avrdude I tried to test the communication Arduino - USBtinyISP and got the information "unit not supported". After installing the newest Version Arduino V1.0.1 I got the same message after choosing the programming unit USBtinyISP and trying to burn a bootloader:

avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)

It seems Arduino now works with a new version of avrdude....

Any simple solutions ? I am working under pressure to prepare a course for kids in our town, so no system programming please !

Locked
Please be positive and constructive with your questions and comments.

Return to “USBtinyISP”