AVRISPmk2 programming

I have just received a nice new Pololu Oranatan board with a 328p on board. After a little tweaking I have the libraries compiling, but I’m having trouble sending the code over a AVRISPmk2 from the Arduino software.

First up, a test with avrdude straight -

Mac-Pro:~ ice$ avrdude -p m328p -c avrisp2 -P usb

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Which is working fine, so hardware is ok.

Now, when I try uploading from the arduino software it spits out this -

Binary sketch size: 668 bytes (of a 32768 byte maximum)

java.lang.NullPointerException
      at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:67)
      at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:53)
      at processing.app.Sketch.upload(Sketch.java:1460)
      at processing.app.Sketch.exportApplet(Sketch.java:1427)
      at processing.app.Sketch.exportApplet(Sketch.java:1382)
      at processing.app.Editor$45.run(Editor.java:2165)
      at java.lang.Thread.run(Thread.java:637)

And here are the entries I added in the various files

/users/ice/Library/Arduino/preferences.txt -

upload.using=usbprog

/Applications/Arduino.app/Contents/Resources/Java/hardware/programmers.txt -

usbprog.name=AVRISP mk2 Clone
usbprog.communication=usb
usbprog.protocol=stk500v2

/Applications/Arduino.app/Contents/Resources/Java/hardware/boards.txt -

orangutan.name=Orangutan with Programmer
orangutan.upload.maximum_size=32768
orangutan.build.mcu=atmega328p
orangutan.build.f_cpu=20000000L
orangutan.build.core=arduino

If I plug the AVRISPmk2 into my Duemilanove, and select the entry in tools->board I get the following -

processing.app.SerialException: Serial port '/dev/tty.usbserial-A6008bL7' not found.  Did you select the right one from the Tools > Serial Port menu?
      at processing.app.Serial.<init>(Serial.java:153)
      at processing.app.Serial.<init>(Serial.java:76)
      at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:71)
      at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:78)
      at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:53)
      at processing.app.Sketch.upload(Sketch.java:1460)
      at processing.app.Sketch.exportApplet(Sketch.java:1427)
      at processing.app.Sketch.exportApplet(Sketch.java:1382)
      at processing.app.Editor$45.run(Editor.java:2165)
      at java.lang.Thread.run(Thread.java:637)
processing.app.debug.RunnerException: Serial port '/dev/tty.usbserial-A6008bL7' not found.  Did you select the right one from the Tools > Serial Port menu?
      at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:91)
      at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:78)
      at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:53)
      at processing.app.Sketch.upload(Sketch.java:1460)
      at processing.app.Sketch.exportApplet(Sketch.java:1427)
      at processing.app.Sketch.exportApplet(Sketch.java:1382)
      at processing.app.Editor$45.run(Editor.java:2165)
      at java.lang.Thread.run(Thread.java:637)
processing.app.debug.RunnerException: Serial port '/dev/tty.usbserial-A6008bL7' not found.  Did you select the right one from the Tools > Serial Port menu?
      at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:91)
      at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:78)
      at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:53)
      at processing.app.Sketch.upload(Sketch.java:1460)
      at processing.app.Sketch.exportApplet(Sketch.java:1427)
      at processing.app.Sketch.exportApplet(Sketch.java:1382)
      at processing.app.Editor$45.run(Editor.java:2165)
      at java.lang.Thread.run(Thread.java:637)

Which would seem to suggest it’s trying to use the serial port still?

Any tips? If needed I can upload the entire files

I am not sure that I understand how you are trying to use the ISP.

To use the Arduino tools you need to burn the bootloader (which you can do with the ISP) onto the ATmega. After you burn the bootloader you use the Arduino tools to download programs over the USB (or serial) port. On reset the uC will start the bootloader which will communicate with the serial port not the ISP.

(* jcl *)


www: http://www.wiblocks.com twitter: http://twitter.com/wiblocks blog: http://luciani.org

Have a look at this http://www.arduino.cc/en/Hacking/Programmer,

I now have it working, it seems that changing the entry in preferences.txt fails to do anything, at least on arduino 0017 on MacOS. However adding an entry to boards.txt works a treat as per -

If you would rather use an external programmer for only an individual board, you can edit the boards.txt file in the hardware/ sub-directory of the Arduino application directory. Set the board.upload.using parameter to the identifier of one of the programmers in programmers.txt.

Leaving me with an entry in boards.txt something like -

orangutan.name=Orangutan with Programmer
orangutan.upload.maximum_size=32768
orangutan.build.mcu=atmega328p
orangutan.build.f_cpu=20000000L
orangutan.build.core=arduino
orangutan.upload.using=usbprog

8-)

I wasn't aware that the Arduino tools had that option. Thanks for the info.

Programming your Arduino that way means you don't have the Arduino bootloader anymore unless you burn it again.

I usually program my boards from the command line using a Makefile. For me it is a lot quicker.

(* jcl *)


www: http://www.wiblocks.com twitter: http://twitter.com/wiblocks blog: http://luciani.org