1

I have a serial ISP programmer of protocol type "stk500v1" which expects 115200 baud data rate. I have used it successfully with Atmel Studio by calling avrdude manually (custom tool) in the past. This just involves the avrdude option

-b 115200

But recently I wanted to do use the Arduino software instead of Atmel Studio for a quick mockup. But everytime I try to "Upload with Programmer", the avrdude commandline includes the option

-b 19200

and so the programming fails.

I can make it work by changing the hard wired serial rate in the programmer from 115200 to 19200, but then of course the programming is dead slow, which I don't want.

I have also looked for a baudrate entry for stk500v1 in "avrdude.conf", but didn't find any. How can I change the baud rate for "Upload with programmer" in the Arduino software?

oliver
  • 175
  • 7

1 Answers1

2

You have to edit the programmers.txt file. (The one in ~/.arduino15/packages/arduino/hardware/avr/1.6.21/, not the one in arduino-1.8.x/hardware/arduino/avr/)

avrisp.name=AVR ISP
avrisp.communication=serial
avrisp.protocol=stk500v1
avrisp.program.protocol=stk500v1
avrisp.program.speed=115200
avrisp.program.tool=avrdude
avrisp.program.extra_params=-P{serial.port} -b{program.speed}

Add a avrisp.program.speed option, and pass this option as one of the extra_params to the command line call of avrdude.
It is then used on line 112 of platform.txt:

tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} {program.verify} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"

You could of course also make a copy of that avrisp entry, and add your own programmer, just give it a different name.

tttapa
  • 1,320
  • 1
  • 8
  • 10
  • 1
    "programmers.txt" was the key! However I really had to change the one in "/hardware/arduino/avr/". Probably it's because I am using Windows 10, or probably because I am still on Arduino 1.6.7. Anyway, it works now. Thank you so much! – oliver Jun 02 '18 at 11:34
  • They changed the way the board manager works in 1.8.x, in the new versions, other boards (cores) you install are in the ~/.arduino15/packages folder, including the standard AVR core. However, the old (1.6.x) hardware folder that you're using right now was not deleted, that's why I specifically added it. It's not a problem in 1.6.x, only newer versions. – tttapa Jun 02 '18 at 11:38