6

I want to program an ATtiny through the Arduino IDE. I have a somehow strange programmer. But I can upload via avrdude by

avrdude -p attiny13 -P /dev/cu.usbmodemfa131 -c stk500v2 -F -B20 -U flash:w:programm.hex

It took a while to figure out that I had to slow the baud rate via the -B20 switch. If I try to upload via the arduino 1.0.5 IDE avrdude is executed as follows.

/Applications/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -pattiny13 -cstk500v1 -P/dev/tty.usbmodemfa131 -Uflash:w:/var/folders/9t/5jldfq752fs1x74_rhn2plz80000gn/T/build7680201613426497544.tmp/attinytest.cpp.hex:i

My question is, how can I change the preferences such that I have control over the avrdude parameters? Say I want to add a -B20 switch and change stk500v1 to stk500v2.

0

1 Answer 1

3

Short answer: I'm afraid you can't do it with Arduino IDE 1.0.5.

Long answer:

First of all, be aware that -B20 does not specify the baud rate but the bitclock period (in us); this is specific to stk500v2 programmer.

Normally, enabling your programmer should only be a matter of adding it to the list of programmers known by Arduino IDE; that list can be found in hardware/arduino/programmers.txt. You would then append the following lines at the end of this file:

strangeprogrammer.name=Somehow Strange Programmer
strangeprogrammer.communication=serial
strangeprogrammer.protocol=stk500v2
strangeprogrammer.force=true
strangeprogrammer.speed=?????

However, the problem here is that Arduino IDE does not seem to be able to use flag -B (bitclock period) but only flag -b (baud rate) which value is set to whatever you will put to strangeprogrammer.speed.

At least that's what I could find out by inspecting Arduino IDE source code: AvrdudeUploader.java never adds that flag to the avrdude command-line :-(

That means your options are:

  1. Rebuild the Arduino IDE 1.0 on your own after modifying AvrdudeUploader.java to support -B flag; code should be quite easy (about 2 more lines of Java code).

  2. Switch to Arduino IDE 1.5 and follow Federico's answer :-)

  3. Use another IDE, something that deserves the IDE name. I use Eclipse with this Arduino plugin and it works fine for me. As a bonus, avrdude support seems better as you can see on the screenshot below:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.