Errors with Arduino IDE and Gemma

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
quarren42
 
Posts: 20
Joined: Fri Nov 01, 2013 7:25 pm

Errors with Arduino IDE and Gemma

Post by quarren42 »

I ordered the Gemma, and have had errors with uploading code onto it from a 64bit Win7 OS. I've followed Adafruit's tutorial on setting up the Arduino IDE for Gemma, and everything shows up & works fine (Gemma appears as "Trinket" in Device Manager, which I'm presuming is correct), apart from when I upload the code (Adafruit's Gemma Blink sketch, selecting the 8MHz Gemma and USBtinyISP programmer, entering bootloader mode), I receive the error pasted below, then the Gemma's red LED starts to blink around 2-3 times a second, instead of the slowly pulsing red LED when in bootloader mode. Doing this also erases the code uploaded onto the Gemma, which I uploaded onto it via the pre-configured IDE for Mac (using that method, it worked completely fine). A couple days later, I went and installed WinAVR onto my computer, restarted it, and voila! It worked! But after another restart, I received the same error as before. If I could get any help with fixing this, it'd be much appreciated.

Error Message:

Code: Select all

avrdude: error: usbtiny_transmit: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.



avrdude: error: usbtiny_send: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 64, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

(expected 4, got -5)
avrdude: verification error, first mismatch at byte 0x0000
0x20 != 0x00
avrdude: verification error; content mismatch

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Errors with Arduino IDE and Gemma

Post by adafruit_support_rick »

That error is a symptom of not having the correct avrdude and avrdude.conf file.
Open up a command window and type avrdude -v. You should see avrdude v5.11. The path for avrdude.conf will also be displayed. Make sure that you have put the updated avrdude.conf in this location.

You can download avrdude 5.11 for windows here:
http://download.savannah.gnu.org/releas ... -win32.zip

User avatar
quarren42
 
Posts: 20
Joined: Fri Nov 01, 2013 7:25 pm

Re: Errors with Arduino IDE and Gemma

Post by quarren42 »

My AVRdude version is 5.10, after downloading the patch and clicking avrdude.exe within the folder, and restarting my machine. I did move the avrdude.conf file over to the correct place, and replaced the old one, yet am now faced with the error "error at [avrdude.conf directory]:332 unrecognised character: "w" ". I'm presuming this is because I moved the 5.11 conf to the 5.10 folder, but how do I install 5.11? It's not updating for me.

User avatar
phild13
 
Posts: 247
Joined: Mon Sep 10, 2012 1:05 pm

Re: Errors with Arduino IDE and Gemma

Post by phild13 »

The Arduino uses or should use the AVRDude that is inside of WinAvr.
I just renamed the avrdude.conf and avrdude.exe contained in the file my Avrdude command line is using
(mine is located here: C:\WinAVR-20100110\bin\) to avrdude_old.conf and avrdude_old.exe and copieed the patch files avrdude.conf and avrdude.exe to the directory.

When I ran the command
avrdude -V it indicated Avrdude was updated. "avrdude.exe: Version 5.11-Patch#7610, compiled on Aug 31 2011 at 08:02:19"

No rebooting is necessary to install the patch, so I would go back to your old config and exe file, make sure avrdude works properly without errors (if you have an arduino (uno is good), then use the usbtinyisp to read the chip on the uno), then do as I did above and rename the two older files, then copy the two updated (newer) files to the directory.

Once this is done, make sure avrdude works properly (again if you have an arduino, then use the usbtinyisp to read the chip on the uno)
A command such as
avrdude -c usbtiny -p m328p -v
should work ok when the usbtinyisp is connected to the arduino and give some meaningful output.

Once your sure avrdude works ok, then make the modifications to the config file and test that avrdude works properly. If it does, then you can give it a try with the Gemma.

Make sure you have no mistakes in the config file you modify. Things like a missing semi colon or a forgotten comment # sign or something after the last semicolon.

User avatar
quarren42
 
Posts: 20
Joined: Fri Nov 01, 2013 7:25 pm

Re: Errors with Arduino IDE and Gemma

Post by quarren42 »

Patched the avrdude to 5.11, no more errors in the avrdude.conf (error message disappeared), and made sure the avrdude was working properly - I successfully read my Uno with the command "avrdude -c usbtiny -p m328p -v ". Still the same error when uploading code to the Gemma.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Errors with Arduino IDE and Gemma

Post by adafruit_support_rick »

OK, let's replace the Gemma. Please email [email protected] with a link to this thread and ask for a replacement Gemma

User avatar
quarren42
 
Posts: 20
Joined: Fri Nov 01, 2013 7:25 pm

Re: Errors with Arduino IDE and Gemma

Post by quarren42 »

Alright. But just incase you looked over what I said in my first message, it does work completely fine with a Mac.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Errors with Arduino IDE and Gemma

Post by adafruit_support_rick »

quarren42 wrote:But just incase you looked over what I said in my first message, it does work completely fine with a Mac.
Oh! Then you've still got a problem with your avrdude.conf file.

See this thread: you may be seeing the bug we're trying to track down.
http://forums.adafruit.com/viewtopic.php?f=52&t=45541

Be sure to give Step 4 a try

User avatar
dbweir19
 
Posts: 4
Joined: Wed Dec 18, 2013 10:54 am

Re: Errors with Arduino IDE and Gemma

Post by dbweir19 »

I'm experiencing the same problem (with the same setup).

Windows 7 64-bit
Arduino v1.0.5
Gemma

What's unclear to me in the documentation is whether WinAVR is a requirement or not. There is an avrdude.exe in C:\Program Files (x86)\Arduino\hardware\tools\avr\bin and an avrdude.conf in C:\Program Files (x86)\Arduino\hardware\tools\avr\etc. But when I replace these files with their versions from 5.11 I see no effect - almost like they are being ignored. Moreover, when I launch a terminal window and cd to C:\Program Files (x86)\Arduino\hardware\tools\avr\bin and invoke avrdude.exe it complains that it can't find the avrdude.conf file. It sounds like these avdude files are not the ones I'm supposed to be replacing...

Finally - I have 2 gemma's and 2 5v trinkets, and all four devices behave the same way. :(

UPDATE:

I appear to have resolved my problem. huzzah!
  • I have uninstalled WinAVR.
  • Ensured all patches to avrdude.exe and avrdude.conf were applied to the files under C:\Program Files (x86)\Arduino\hardware\tools\avr\bin and ...\etc.
  • I set the environment variable AVR32_HOME=C:\Program Files (x86)\Arduino\hardware\tools\avr\bin
  • Restarted the arduino IDE
Last edited by dbweir19 on Wed Dec 18, 2013 2:03 pm, edited 1 time in total.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Errors with Arduino IDE and Gemma

Post by adafruit_support_rick »

Go to a command window and enter the command
avrdude -v

That will tell you which avrdude is actually being used. It will also tell you the correct path to avrdude.conf

User avatar
dbweir19
 
Posts: 4
Joined: Wed Dec 18, 2013 10:54 am

Re: Errors with Arduino IDE and Gemma

Post by dbweir19 »

That's what tipped me off...

If I launch a CMD prompt and type avrdude -v I get:
C:\Users\dweir>avrdude -v
'avrdude' is not recognized as an internal or external command,
operable program or batch file.
So... the system (and likely Arduino's IDE) have no idea where avrdude is... setting my AVR32_HOME variable to seems to have at least informed the Arduino IDE where to find the proper copy of avrdude.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Errors with Arduino IDE and Gemma

Post by adafruit_support_rick »

Try going into the Arduino Preferences menu, and check off 'Verbose on Upload'. You should see the path that avrdude is being called from, and you should also see the avrdude version info and avrdude.conf path. For example, I get this on my Mac:

Code: Select all

Sketch uses 466 bytes (1%) of program storage space. Maximum is 32,256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes.
/Applications/Arduino_155.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino_155.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P/dev/tty.usbmodemfa1351 -b115200 -D -Uflash:w:/var/folders/rm/42sbjlxr8xj2q60059_spx7r0000gn/T/build760164600835312102.tmp/BareMinimum.cpp.hex:i 

avrdude: Version 5.11, compiled on Sep  2 2011 at 18:52:52
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/Applications/Arduino_155.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Volumes/Macintosh HD/ricklesniak/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/tty.usbmodemfa1351
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200

User avatar
dbweir19
 
Posts: 4
Joined: Wed Dec 18, 2013 10:54 am

Re: Errors with Arduino IDE and Gemma

Post by dbweir19 »

Here's what I get with verbose upload now:

Code: Select all

Binary sketch size: 832 bytes (of a 5,310 byte maximum)
C:\Program Files (x86)\Arduino\hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -pattiny85 -cusbtiny -Uflash:w:C:\Users\dweir\AppData\Local\Temp\build7450208663088624231.tmp\gemmablink.cpp.hex:i 

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : lpt1
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
         AVR Part                      : ATtiny85
         Chip Erase delay              : 400000 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    12     4    0 no        512    4      0  4000  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6    32    0 yes      8192   64    128 30000 30000 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          2    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 53 00]
avrdude: AVR device initialized and ready to accept instructions

Reading | CMD: [30 00 00 00] [00 00 00 1e]
CMD: [30 00 01 00] [00 00 00 93]
################CMD: [30 00 02 00] [00 00 00 0b]
################################## | 100% 0.01s

avrdude: Device signature = 0x1e930b
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
CMD: [a0 01 fc 00] [00 00 01 00]
CMD: [a0 01 fd 00] [00 00 01 00]
CMD: [a0 01 fe 00] [00 00 01 00]
CMD: [a0 01 ff 00] [00 00 01 00]
avrdude: erasing chip

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

 (expected 4, got -5)
avrdude: Using SCK period of 10 usec
avrdude: 10 retries during SPI command
CMD: [ac 53 00 00] [00 00 53 00]
avrdude: reading input file "C:\Users\dweir\AppData\Local\Temp\build7450208663088624231.tmp\gemmablink.cpp.hex"
avrdude: writing flash (832 bytes):

Writing | CMD: [4c 00 00 00] [00 00 00 00]
###CMD: [4c 00 20 00] [00 00 00 00]
####CMD: [4c 00 40 00] [00 00 00 00]
####CMD: [4c 00 60 00] [00 00 00 00]
####CMD: [4c 00 80 00] [00 00 00 00]
####CMD: [4c 00 a0 00] [00 00 00 00]
####CMD: [4c 00 c0 00] [00 00 00 00]
###CMD: [4c 00 e0 00] [00 00 00 00]
####CMD: [4c 01 00 00] [00 00 01 00]
####CMD: [4c 01 20 00] [00 00 01 00]
####CMD: [4c 01 40 00] [00 00 01 00]
####CMD: [4c 01 60 00] [00 00 01 00]
####CMD: [4c 01 80 00] [00 00 01 00]
#### | 100% 0.62s

avrdude: 832 bytes of flash written
avrdude: verifying flash memory against C:\Users\dweir\AppData\Local\Temp\build7450208663088624231.tmp\gemmablink.cpp.hex:
avrdude: load data flash data from input file C:\Users\dweir\AppData\Local\Temp\build7450208663088624231.tmp\gemmablink.cpp.hex:
avrdude: input file C:\Users\dweir\AppData\Local\Temp\build7450208663088624231.tmp\gemmablink.cpp.hex contains 832 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.13s

avrdude: verifying ...
avrdude: 832 bytes of flash verified

avrdude done.  Thank you.
The code is flashed to the GEMMA., but... there is still one error in the log.

Code: Select all

avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

 (expected 4, got -5)
Getting closer :)

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Errors with Arduino IDE and Gemma

Post by adafruit_support_rick »

Check the third FAQ on this page - changing the delay in avrdude.conf
http://learn.adafruit.com/introducing-trinket/faq

If that doesn't help, see this sticky topic:
http://forums.adafruit.com/viewtopic.php?f=52&t=45541

User avatar
dbweir19
 
Posts: 4
Joined: Wed Dec 18, 2013 10:54 am

Re: Errors with Arduino IDE and Gemma

Post by dbweir19 »

Thanks for the advice!
  • I had dropped the chip_erase_delay to 40000 which is how I got rid of most of the errors I had once had.
  • Replacing the avrdude.exe with the one in avrdudetrinket11513.zip file from the sticky-post did the trick!
Thanks again for your assistance! :D

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

Return to “USBtinyISP”