Hi. I followed the tutorial (https://learn.adafruit.com/introducing- ... rduino-ide) to set up Ubuntu 14.04 (I have a dual-boot, so I've tried Windows 7, too) to program the Gemmas I bought. Unfortunately, the config file on that tutorial doesn't seem to work. I get the error:
/usr/share/arduino/hardware/tools/avrdude.conf:332: programmer type must be written as "id_type"
I tried changing 'type' on that line to 'id_type', assuming that is what it wanted, but that only changed the error to a syntax error.
Any idea what's going on here? I desperately need these controllers working for a uni course. :/
AVRDUDE.conf and Gemma (programmer type must be written as "
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 1
- Joined: Mon May 05, 2014 7:05 pm
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: AVRDUDE.conf and Gemma (programmer type must be written
There are some quirks in the Linux codebase that cause problems when trying to communicate with the Trinket/Gemma bootloader. Some people have been able to get Linux systems to work, but the problems are widespread enough and far enough out of our control that we officially don't support Linux for the Trinket or Gemma.
-
- Posts: 4
- Joined: Mon Mar 17, 2014 8:26 pm
Re: AVRDUDE.conf and Gemma (programmer type must be written
So... it took me a little whilte. I had the same issue, but have it resolved and working!
Note: it is NOT a very clean fix, but it works for me at the moment, and I would like to share before it slips my mind.
I am using Xubuntu 14.04 (Same instructions with Ubuntu)
I followed almost all of the instructions for the initial install from:
https://learn.adafruit.com/introducing- ... rduino-ide
** Ubuntu users do NOT update the avrdude.conf from this page!
Then I followed all of the instructions to update avrdude.conf from:
https://learn.adafruit.com/introducing- ... th-avrdude
** Ubuntu users should update the avrdude.conf file in two locations!
"/etc/avrdude.conf" and "/usr/share/arduino/hardware/tools/avrdude.conf"
From following these instructions, I find that I get errors from running the default command line options:
"avrdude -c usbtiny -p attiny85 -U flash:w:trinketblink.hex"
I needed to run this command with "-D" switch!
"avrdude -c usbtiny -p attiny85 -D -U flash:w:trinketblink.hex"
I now tried the Arduino IDE and noticed that I am now getting the same error messages from the IDE that I got from avrdude in the last section... I need the Arduino IDE to run the avrdude command with the -D switch!
This is the very messy hack...
rename /usr/bin/avrdude to /usr/bin/avrdude_
create a new file named /usr/bin/avrdude
The files contents are:
---------------------------
#!/bin/sh
echo $@ | sed 's|-U|-D -U|g' > /tmp/debug_output_arg
newarg=$(echo $@ | sed 's|-U|-D -U|g')
cat - | /usr/bin/avrdude_ $newarg | tee /tmp/debug_output
---------------------------
The sed command in there inserts the -D switch in front of the -U switch!
So the command my IDE tried running was:
avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -q -q -pattiny85 -cusbtiny -Uflash:w:/tmp/build7796461449449468981.tmp/TrinketBlink.cpp.hex:i
It was corrected with the ugly bas script to:
-C/usr/share/arduino/hardware/tools/avrdude.conf -q -q -pattiny85 -cusbtiny -D -Uflash:w:/tmp/build7796461449449468981.tmp/TrinketBlink.cpp.hex:i
Notice the extra "-D"
Altering the Arduino IDE to allow the -D switch would help.. I dont know how to do that though...
I only needed this ugly bash script for the first flash or two, I have since removed it and all is well.
Enjoy!
*** now getting a new error from the IDE and from avrdude...
"avrdude_: verification error; content mismatch" -- use at your own risk
*** Copied the /etc/avrdude.conf file to /usr/share/arduino/hardware/tools/avrdude.conf seems to be working like a charm now.
Note: it is NOT a very clean fix, but it works for me at the moment, and I would like to share before it slips my mind.
I am using Xubuntu 14.04 (Same instructions with Ubuntu)
I followed almost all of the instructions for the initial install from:
https://learn.adafruit.com/introducing- ... rduino-ide
** Ubuntu users do NOT update the avrdude.conf from this page!
Then I followed all of the instructions to update avrdude.conf from:
https://learn.adafruit.com/introducing- ... th-avrdude
** Ubuntu users should update the avrdude.conf file in two locations!
"/etc/avrdude.conf" and "/usr/share/arduino/hardware/tools/avrdude.conf"
From following these instructions, I find that I get errors from running the default command line options:
"avrdude -c usbtiny -p attiny85 -U flash:w:trinketblink.hex"
I needed to run this command with "-D" switch!
"avrdude -c usbtiny -p attiny85 -D -U flash:w:trinketblink.hex"
I now tried the Arduino IDE and noticed that I am now getting the same error messages from the IDE that I got from avrdude in the last section... I need the Arduino IDE to run the avrdude command with the -D switch!
This is the very messy hack...
rename /usr/bin/avrdude to /usr/bin/avrdude_
create a new file named /usr/bin/avrdude
The files contents are:
---------------------------
#!/bin/sh
echo $@ | sed 's|-U|-D -U|g' > /tmp/debug_output_arg
newarg=$(echo $@ | sed 's|-U|-D -U|g')
cat - | /usr/bin/avrdude_ $newarg | tee /tmp/debug_output
---------------------------
The sed command in there inserts the -D switch in front of the -U switch!
So the command my IDE tried running was:
avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -q -q -pattiny85 -cusbtiny -Uflash:w:/tmp/build7796461449449468981.tmp/TrinketBlink.cpp.hex:i
It was corrected with the ugly bas script to:
-C/usr/share/arduino/hardware/tools/avrdude.conf -q -q -pattiny85 -cusbtiny -D -Uflash:w:/tmp/build7796461449449468981.tmp/TrinketBlink.cpp.hex:i
Notice the extra "-D"
Altering the Arduino IDE to allow the -D switch would help.. I dont know how to do that though...
I only needed this ugly bash script for the first flash or two, I have since removed it and all is well.
Enjoy!
*** now getting a new error from the IDE and from avrdude...
"avrdude_: verification error; content mismatch" -- use at your own risk
*** Copied the /etc/avrdude.conf file to /usr/share/arduino/hardware/tools/avrdude.conf seems to be working like a charm now.
- buzzardbait
- Posts: 8
- Joined: Sun Aug 31, 2014 12:02 am
Re: AVRDUDE.conf and Gemma (programmer type must be written
I know, I'm probably too late to the party. Just tonight I had the same error. It seems that the version available today, "avrdude: Version 6.1, compiled on Mar 24 2014 at 14:07:14", uses different syntax for programmer definitions. In using the tutorial's "The Short Way", the incompatible file overwrites the working one. Using "The Long Way" implies that one should clip the text from the tutorial---I couldn't get paste to get the indentation right and didn't bother looking into why. My even Longer way is to download adafruit's avrdude.conf, open both in a common editor (sudo) then cut and paste the ATtiny85 section over the old. This passes the "avrdude -c usbtiny -p attiny85" check with no error.
----- I got some time to dig deeper on this
Likely the safest method, be it Linux or Windows, is to paste the ATtiny85 portion from the downloded file into the working one intended for whatever version of Avrdude you are using. I found three issues with the conf file available in the tutorial at http://learn.adafruit.com/system/assets ... 1378151630 when used with the present release. Two of these issues are likely to affect both Windows and Linux.
On Tue 17 Sep 2013 10:28:47 PM UTC, Avrdude 5.11.1 was replaced by 6.0.1
With this update, device "type" keywords were replaced by strings. More to the point, the parser is now expecting device types to be wrapped in quotes.
The file downloaded from the tutorial site predates 6.0.1 by over two years and is missing these quotes.
Assuming one has awk on their system one could use awk to wrap those strings; and that's what I did.
I did this to see if there was anything else to keep the conf files from working. This ugly, fragile script looks for "type" entries and wraps them in quotes:
(It may be a little different on Windows, unless running Cygwin)
It almost works! It seems that this old conf file was created specifically for Windows, as the default ports are "lpt1" and "com1", so Avrdude on Linux fails but adding a "-P usb" on the command-line gets it working. That error can be properly addressed by pointing them to real ports:
That uncovers one last issue---the USB tiny can't be found at either that parallel or serial port. The reason it looks there is that Avrdude is never told it is USB and uses the defaults. This may affect Windows users too.
The full programmer definition should read:
----- I got some time to dig deeper on this
Likely the safest method, be it Linux or Windows, is to paste the ATtiny85 portion from the downloded file into the working one intended for whatever version of Avrdude you are using. I found three issues with the conf file available in the tutorial at http://learn.adafruit.com/system/assets ... 1378151630 when used with the present release. Two of these issues are likely to affect both Windows and Linux.
On Tue 17 Sep 2013 10:28:47 PM UTC, Avrdude 5.11.1 was replaced by 6.0.1
With this update, device "type" keywords were replaced by strings. More to the point, the parser is now expecting device types to be wrapped in quotes.
The file downloaded from the tutorial site predates 6.0.1 by over two years and is missing these quotes.
Assuming one has awk on their system one could use awk to wrap those strings; and that's what I did.
I did this to see if there was anything else to keep the conf files from working. This ugly, fragile script looks for "type" entries and wraps them in quotes:
Code: Select all
awk '$1 == "type"{sub(";","");sub($3,"\""$3"\";")};1' ~/Downloads/avrdude.conf > ~/avrdude.conf
It almost works! It seems that this old conf file was created specifically for Windows, as the default ports are "lpt1" and "com1", so Avrdude on Linux fails but adding a "-P usb" on the command-line gets it working. That error can be properly addressed by pointing them to real ports:
Code: Select all
default_parallel = "/dev/parport0";
default_serial = "/dev/ttyS0";
The full programmer definition should read:
Code: Select all
programmer
id = "usbtiny";
desc = "USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/";
type = "usbtiny";
connection_type = usb;
usbvid = 0x1781;
usbpid = 0x0c9f;
;
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: AVRDUDE.conf and Gemma (programmer type must be written
Hmm.. interesting.
Just to confirm, does that get the Trinket/Gemma working with a Linux system?
Just to confirm, does that get the Trinket/Gemma working with a Linux system?
- buzzardbait
- Posts: 8
- Joined: Sun Aug 31, 2014 12:02 am
Re: AVRDUDE.conf and Gemma (programmer type must be written
Yes, it works fine on my Linux HP Probook 6465b running Linux 3.13.11.5-1-MANJARO #1 SMP PREEMPT Sat Jul 19 09:07:17 UTC 2014 x86_64 GNU/Linux. Trinketblink loaded just fine with the line
--- Now for Windows (bootloader issue seems to have been transient and it's fine now...really curious):
Windows 7, SP1, latest patches on the same laptop. Avrdude 6.1 (same version as used on Linux).
Adding the three missing lines for connection_type, I get:
I'm pretty sure that on Linux, since connection_type is set anyway, there is no need to change the default_[parallel/serial] strings.
This means that a common avrdude.conf file could serve both Windows and Linux with versions of avrdude of 6.0.1 and greater.
Output was nearly the same as depicted but retries were mostly 3 with a couple 2's; different, but it seemed to work fine. Fooling around with it last night I was able to bonk the bootloader, and yet trinketblink still runs---seems odd. Exactly what I did wrong is unclear but I'll reload the bootloader at some point and maybe see if I can figure out how I did it. Alcohol may have been a factor.avrdude -c usbtiny -p attiny85 -U flash:w:trinketblink.hex
--- Now for Windows (bootloader issue seems to have been transient and it's fine now...really curious):
Windows 7, SP1, latest patches on the same laptop. Avrdude 6.1 (same version as used on Linux).
So that's the same error as on Linux (vexbeast's and mine). After running the awk command, I get:C:\Users\sme\avrdude>avrdude.exe -v
avrdude.exe: Version 6.1, compiled on Mar 13 2014 at 00:09:49
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\sme\avrdude\avrdude.conf"
avrdude.exe: error at C:\Users\sme\avrdude\avrdude.conf:332: programmer type must be written as "id_type"
Which makes sense, as I haven't yet added the "connection_type" entry and I don't have a parallel port on my laptop.avrdude: Error: Invalid -P value: 'lpt1'
Use -P usb:bus:device
Adding the three missing lines for connection_type, I get:
The command "avrdude -c usbtiny -p attiny85 -U flash:w:trinketblink.hex" yields:avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.12s
avrdude: Device signature = 0x1e930b
avrdude: safemode: Fuses OK (E:00, H:00, L:00)
avrdude done. Thank you.
All is good and blinky.{...}
avrdude: verifying ...
avrdude: 832 bytes of flash verified
I'm pretty sure that on Linux, since connection_type is set anyway, there is no need to change the default_[parallel/serial] strings.
This means that a common avrdude.conf file could serve both Windows and Linux with versions of avrdude of 6.0.1 and greater.
- buzzardbait
- Posts: 8
- Joined: Sun Aug 31, 2014 12:02 am
Re: AVRDUDE.conf and Gemma (programmer type must be written
For Linux and Windows, with versions of avrdude of 6.0.1 and greater, appending this to the stock avrdude.conf file seems to be the slickest solution:
With that addition, the invocation becomes:
Code: Select all
#------------------------------------------------------------
# Trinket
#------------------------------------------------------------
# Like ATtiny85 except with additional delays
part parent "t85"
id = "trinket";
desc = "AFTrinket";
chip_erase_delay = 900000;
chiperasetime = 900000;
memory "flash"
paged = yes;
size = 8192;
page_size = 64;
num_pages = 128;
min_write_delay = 30000;
max_write_delay = 30000;
readback_p1 = 0xff;
readback_p2 = 0xff;
read_lo = " 0 0 1 0 0 0 0 0",
" 0 0 0 0 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
read_hi = " 0 0 1 0 1 0 0 0",
" 0 0 0 0 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
loadpage_lo = " 0 1 0 0 0 0 0 0",
" 0 0 0 x x x x x",
" x x x a4 a3 a2 a1 a0",
" i i i i i i i i";
loadpage_hi = " 0 1 0 0 1 0 0 0",
" 0 0 0 x x x x x",
" x x x a4 a3 a2 a1 a0",
" i i i i i i i i";
writepage = " 0 1 0 0 1 1 0 0",
" 0 0 0 0 a11 a10 a9 a8",
" a7 a6 a5 x x x x x",
" x x x x x x x x";
mode = 0x41;
delay = 6;
blocksize = 32;
readsize = 256;
;
;
#------------------------------------------------------------
# Gemma
#------------------------------------------------------------
# Like AFTrinket
part parent "trinket"
id = "gemma";
desc = "AFGemma";
;
To be clear, this solution will not work with the older avrdude 5.11 that is presently packaged with WinAVR.avrdude -c usbtiny -p trinket -U flash:w:trinketblink.hex
or
avrdude -c usbtiny -p gemma -U flash:w:trinketblink.hex
- adafruit2
- Posts: 22144
- Joined: Fri Mar 11, 2005 7:36 pm
Re: AVRDUDE.conf and Gemma (programmer type must be written
Thx! We are going to look at this a little bit more, and try to formally add Trinket/Protrinket Linux support!
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: AVRDUDE.conf and Gemma (programmer type must be written
I was giving this a quick shot but it looks like the version of avrdude shipped with Arduino 1.0.5 is different from 6.1 that you see. When I run avrdude -v (from within the hardware/tools directory of the arduino-1.0.5 folder) I get version 5.11. Unfortunately this version doesn't seem to accept the 'connection_type = usb;' parameter in its avrdude.conf and fails with a syntax error. Just to check are you also using Arduino 1.0.5 or one of the newer 1.5.x beta versions?
- buzzardbait
- Posts: 8
- Joined: Sun Aug 31, 2014 12:02 am
Re: AVRDUDE.conf and Gemma (programmer type must be written
I'm not familiar with Arduino 1.0.5 and haven't tried any of the older Avrdude versions.
Background: This is my first ever work on any μC. I've worked in C since 1990, but the closest I've been to this skill has been on Cypress CLPDs using VHDL (a bit like ada with concurrency) with JTAG. It never dawned on me to use an Arduino product.
All the Linux repos seem to have 6.1 (Manjaro, Arch, Red Hat, Suse, Mint and Ubuntu). My Linux Avrdude is from the Manjaro repo.
My Windows version is direct from http://www.nongnu.org/avrdude/
Download and docs (poor as they are) are from that website.
Linux Avrdude installs easily (pamac for me) but it needs the manually entered udev rule:
"ATTRS" is used for kernels 2.6 and newer. Before that it was SYSFS---I think.
Windows install is not too bad.
Since the Trinket is on USB, this is needed to allow Avrdude to interact with USB devices: http://sourceforge.net/p/libusb-win32/wiki/Home/ (See the README for details.)
Windows needs the USBtiny driver too: http://www.adafruit.com/downloads/usbtiny_signed_8.zip
Of course, only the latest avrdude will do: http://download.savannah.gnu.org/releas ... 6.1.tar.gz
Extract this in a folder called "avrdude_6.1" in a location accessible to all, like the "Program Files" or "Program Files (x86)" folder.
Next, to allow use of the tool from your working directory, add the full path of that folder to the PATH environment variable string. See: http://msdn.microsoft.com/en-us/library ... 14%29.aspx
Background: This is my first ever work on any μC. I've worked in C since 1990, but the closest I've been to this skill has been on Cypress CLPDs using VHDL (a bit like ada with concurrency) with JTAG. It never dawned on me to use an Arduino product.
All the Linux repos seem to have 6.1 (Manjaro, Arch, Red Hat, Suse, Mint and Ubuntu). My Linux Avrdude is from the Manjaro repo.
My Windows version is direct from http://www.nongnu.org/avrdude/
Download and docs (poor as they are) are from that website.
Linux Avrdude installs easily (pamac for me) but it needs the manually entered udev rule:
Code: Select all
# USBtinyISP Programmer rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c9f", GROUP="users", MODE="0666".
Windows install is not too bad.
Since the Trinket is on USB, this is needed to allow Avrdude to interact with USB devices: http://sourceforge.net/p/libusb-win32/wiki/Home/ (See the README for details.)
Windows needs the USBtiny driver too: http://www.adafruit.com/downloads/usbtiny_signed_8.zip
Of course, only the latest avrdude will do: http://download.savannah.gnu.org/releas ... 6.1.tar.gz
Extract this in a folder called "avrdude_6.1" in a location accessible to all, like the "Program Files" or "Program Files (x86)" folder.
Next, to allow use of the tool from your working directory, add the full path of that folder to the PATH environment variable string. See: http://msdn.microsoft.com/en-us/library ... 14%29.aspx
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: AVRDUDE.conf and Gemma (programmer type must be written
Cool, thanks for confirming. I played around a bit with the older avrdude and it looks like it works if you explicitly select programmer as "USBtinyISP" and add a similar udev rule like you mention (although to add the user to group dialout for ubuntu). Thanks for showing how it works with later versions--that will be handy when Arduino upgrades their toolchain (the new 1.5.7 beta version has a fancy newer toolchain in particular).
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: AVRDUDE.conf and Gemma (programmer type must be written
@buzzardbait: Your work has really helped us, and we'd like to say thank you with a six-pack of Trinkets and a six-pack of Pro Trinkets.
Send a note to [email protected] with a link to this thread and ATTENTION PHIL in the subject line, and we'll get them on their way to you.
Send a note to [email protected] with a link to this thread and ATTENTION PHIL in the subject line, and we'll get them on their way to you.
- Andakar
- Posts: 9
- Joined: Tue Dec 17, 2013 2:41 am
Re: AVRDUDE.conf and Gemma (programmer type must be written
Buzzardbait: when I appended the code to avrdude.conf 6.1 it results in a compilation error.
avrdude: syntax error at /usr/share/arduino/hardware/tools/avrdude.conf:999
Would you mind posting a link to your linux avrdude.conf so I can copy it. I'm a rank amateur. Really just trying to make a wearable blinking led Christmas tie with a gemma. I didn't expect to be crawling around command line file repairs. It's been an adventure but I'd like to get on with my project. Thanks for solving these issues.
avrdude: syntax error at /usr/share/arduino/hardware/tools/avrdude.conf:999
Would you mind posting a link to your linux avrdude.conf so I can copy it. I'm a rank amateur. Really just trying to make a wearable blinking led Christmas tie with a gemma. I didn't expect to be crawling around command line file repairs. It's been an adventure but I'd like to get on with my project. Thanks for solving these issues.
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: AVRDUDE.conf and Gemma (programmer type must be written
Did you try the Arduino 1.0.5 IDE download that's setup to work with Gemma? Check out this page for the download links to the 32-bit and 64-bit Linux versions. They should work out of the box to program Gemma, Trinket, etc. Let me know if you run into issues though.
- Andakar
- Posts: 9
- Joined: Tue Dec 17, 2013 2:41 am
Re: AVRDUDE.conf and Gemma (programmer type must be written
Yes, I had already downloaded and unpacked it but there wasn't any auto install. I do have a previous Arduino IDE installed. Do I need to remove it first and then put these files in another folder? Is there a file I need to double click or use a monitor command to install? It's in my Home folder at the moment. Thanks for any help you can give.
Please be positive and constructive with your questions and comments.