I am an UBUNTU biggot... there, I said it!
For the current Brushbot project, I had made a small standalone ATtiny84 board with a builtin AVR ISP connector for programming without having to remove it from the robot.
- I plugged it in to my laptop USB port,
- plugged the AVR ISP plug into the robot board
- From the Arduino IDE, selected "Tools/Board/ATtiny84 (internal 8 mhz clock)"
- Also from the IDE Selected Tools/Programmer AVR ISP
- Selected the correct USB serial port (/dev/ttyACM0)
- attempted to upload the compiled "Blink" sketch.
and it failed...
AVRDUDE (the application that actually communicates with the Atmel processors) could not sync, told me to check my serial ports, etc...
3. AVR ISP V2 - Pololu USB AVR Programmer (http://www.pololu.com/catalog/product/1300).
This is quite a cheap programmer that works well on Linux Ubuntu, it
can only programmed at 5v (needs 4V on MOSI pin to initialize) and requires
the board to be externally powered. The following lines need to be
added to programmers.txt in the Arduino Hardware folder:
avrispv2.name=AVR ISP v2
avrispv2.communication=serial
avrispv2.protocol=avrispv2
Using sudo, I opened /usr/share/arduino/hardware/arduino/programmers.txt, and added the following 3 lines:
avrispv2.name=AVR ISP v2
avrispv2.communication=serial
avrispv2.protocol=avrispv2
I closed and reopened the Arduino IDE, and the new programmer showed up. I selected it from the Tools/Programmer menu, and again attempted to upload.
and it failed...
Remember that RTFM issue?
Looking at what I posted here from the Openenergy blog a paragraph up...
This is quite a cheap programmer that works well on Linux Ubuntu, it can only programmed at 5v (needs 4V on MOSI pin to initialize) and requires the board to be externally powered.
This lead me to read the Pololu manual for the ARV ISP programmer (gasp!)
And this comment on the pololu forum:
Re: Pololu USB AVR Programmer
by JeremyT » Fri Sep 13, 2013 3:34 pmYou can configure the Pololu USB AVR Programmer through Linux using PgmCmd from the Pololu USB Software Development Kit. PgmCmd is a command-line status and configuration utility. More information, such as how to compile the code, can be found in the README.txt in the SDK. By the way, I still recommend configuring it via Windows, as it would probably be easier.
I have programmed an Atmega8U2 running at 3.3V with the Pololu USB AVR Programmer in Windows, and I do not expect there be a difference in programming with Linux, as long as the programmer is configured correctly.
Using a level shifter, like the one you linked, would probably work. A resistor voltage divider would also suffice. However, I did not have any voltage divider when I programmed the Atmega8U2.
- Jeremy
(Note: as the AVR chips can run at up to 5.5v they do not need a level shifter)
I then downloaded the Pololu USB Software Development Kit for Linux. and read the Readme.txt file (I know, eh?)
To compile their C# applications, you need mono installed:
sudo apt-get install libusb-1.0-0-dev mono-gmcs mono-devel libmono-winforms2.0-cil
In the top level directory of the downloaded SDK, type "make".
From there, I was able to cd to the pololu-usb-sdk/UsbAvrProgrammer/PgmCmd folder, and execute the AVR ISP programmer's command line utility
./pgmcmd --list
PgmCmd: Configuration and status utility for the Pololu USB AVR Programmer.
Version: 1.0.1.0
Options:
-l, --list list available devices
-d, --device SERIALNUM (optional) select device with given serial number
-s, --status display complete device status
--freq NUM sets the ISP frequency (in units of kHz)
--linea ID
or --lineb ID set serial control signal associated with line A or B.
Valid IDs are: none, cd, dsr, ri, dtr, rts.
Warning: dtr and rts are outputs: -f option is required
--swminor HEXNUM AVR ISP software version minor (in hex, e.g. A)
--swmajor HEXNUM AVR ISP software version major (in hex)
--hw HEXNUM AVR ISP software hardware version (in hex)
--vddmin NUM set minimum allowed target vdd (units of mV)
--vddmaxrange NUM set maximum allowed target vdd range (units of mV)
--restoredefaults restore factory settings
--bootloader put device in to bootloader (firmware upgrade) mode
then ./pgmcmd --status revealed...
Serial number: 00060244
Firmware version: 1.07
Settings:
ISP Frequency: 200 kHz
Line A Identity: None
Line B Identity: None
AVR ISP hardware version: F
AVR ISP software version: 2.A
Target VDD allowed minimum: 4384 mV
Target VDD allowed max range: 512 mV
Last programming:
Error: None
Measured Target VDD Minimum: N/A
Measured Target VDD Range: N/A
SLO-scope:
State: Off
Line A output: Off
Line B output: Off
So... I ran
./pgmcmd --vddmin 3200
to set a minimum VDD value of 3.2v.. resulting in...
Serial number: 00060244
Firmware version: 1.07
Settings:
ISP Frequency: 200 kHz
Line A Identity: None
Line B Identity: None
AVR ISP hardware version: F
AVR ISP software version: 2.A
Target VDD allowed minimum: 3200 mV
Target VDD allowed max range: 512 mV
Last programming:
Error: None
Measured Target VDD Minimum: N/A
Measured Target VDD Range: N/A
SLO-scope:
State: Off
Line A output: Off
Line B output: Off
I plugged the robots battery in (remember that
requires the board to be externally powered comment?), plugged in the AVR ISP cable, opened the blink sketch in the Arduino IDE, and clicked the upload icon......
(drum roll please!)
The leds under the Sharp IR distance sensor came to life!!!
Stay tuned for Funky Robotic Vibratory Dancing!
References:
Pololu USB AVR Programmer User's Guide
AVR ISP Programmers
Stackexchange: How to use a Pololu 5v AVR ISP Programmer to program an AVR at 3.3v
forum.pololu.com: Pololu USB AVR Programmer - Ubuntu
Pololu: Pololu USB Software Development Kit
http://forum.arduino.cc/index.php?topic=73027.0;wap2
http://runawaybrainz.blogspot.ca/2013/05/arduino-pololu-usb-avr-programmer.html
http://provideyourown.com/2011/arduino-program-attiny/
http://www.open-electronics.org/arduino-isp-in-system-programming-and-stand-alone-circuits/
http://www.instructables.com/id/How-to-program-attiny-using-arduino-uno/
http://www.instructables.com/id/Using-the-Arduino-Uno-to-program-ATTINY84-20PU/
http://42bots.com/tutorials/programming-attiny84-attiny44-with-arduino-uno/
http://www.batsocks.co.uk/readme/isp_headers.htm
http://highlowtech.org/?p=1695