Besides the standard upload button that burns the code using FTDI, I want to then be able to provide custom AVRDude commands for burning fuses, when the external programmer is used.

Is this possible to do from the IDE? Maybe if I can edit some configuration files?

The idea is to have the IDE supply the upload command when the standard upload option is selected, but when external programmer is selected, i want to have custom behavior.

The custom behavior that I want is to preserve the EEPROM and set the lock bit.

These two actions can be performed with the following AVRDude commands:

avrdude -c usbtiny -p m328p -U hfuse:w:0xd2:m
avrdude -c usbtiny -p m328p -U lock:w:0x00:m

The external programmer i use is Sparkfun's "Pocket AVR Programmer" which is an SPI programmer.

So can I have custom behavior (supported by AVRDude) when I select program using external programmer?

EDIT: I opened file boards.txt and i found these specifications of interest:

pro.name=Arduino Pro or Pro Mini





## Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328P
## ---------------------------------------------------
pro.menu.cpu.8MHzatmega328=ATmega328P (3.3V, 8 MHz)




I am using Arduino Pro Mini. In the second specification, there is the option for setting the fuse bits I want. However, there is no option for the lock bits. The option for the lock bits are in the first specification - but there is no option for the fuses.

My new questions are these:

  1. Should I specify the lock bits in the first specs and the fuses in the second? Will this work? I have to ask before trying anything stupid. Will the second specs "inherit" from the first specs?
  2. Will the parameters I insert here only work for the Upload Using Programmer option? I want the regular upload (via bootloader) to work normally.
  3. What happens if I ditch the Arduino platform and use a standalone AVR? If I use the same AVR that the Pro Mini platform had. Will the same settings work?
  • Well, what i would like to be able to do is this: Preserve the EEPROM data, upload the program and then write the lock byte. There are three distinct AVRDude commands for performing these actions. I was wondering if i could modify the IDE, so that everytime you hit the upload button, it also preserves the EEPROM data and sets the lock byte. Commented Sep 9, 2022 at 9:40
  • I can't test it now, but you could add the fuse parameters to the tools.avrdude.program.pattern in platform.txt. Copy them from the tools.avrdude.erase.pattern. note: the fuse values are in boards.txt
    – Juraj
    Commented Sep 9, 2022 at 13:14
  • 1
    how is it not obvious? {cmd.path} is path to avrdude and those are parameters for avrdude, just the keys are not replaced with values. for pro mini it evaluates to avrdude -Cavrdude.conf -v -patmega328p -cusbtiny -Uflash:w:Blink.ino.hex:i
    – Juraj
    Commented Sep 14, 2022 at 13:19
  • 1
    as I already wrote, you can see the fuses parameters in tools.avrdude.erase.pattern. you can copy from there
    – Juraj
    Commented Sep 14, 2022 at 15:12

1 Answer 1


You can add the fuse parameters to the "Upload using programmer" command pattern tools.avrdude.program.pattern in platform.txt. Copy them from the tools.avrdude.erase.pattern. (The fuse values are from boards.txt)

the modified upload command pattern:

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" -Ulock:w:{bootloader.lock_bits}:m

  • Is there a way to get the IDE to reload this file? I edit it and it seems like I need to close and reopen the IDE to get my changes to apply...
    – ldoogy
    Commented Dec 8, 2023 at 22:19
  • @ldoogy, yes, it requires to restart the IDE
    – Juraj
    Commented Dec 9, 2023 at 7:17

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.