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?
I opened file
boards.txt and i found these specifications of interest:
pro.name=Arduino Pro or Pro Mini pro.upload.tool=avrdude pro.upload.protocol=arduino pro.bootloader.tool=avrdude pro.bootloader.unlock_bits=0x3F pro.bootloader.lock_bits=0x0F pro.build.board=AVR_PRO pro.build.core=arduino pro.build.variant=eightanaloginputs
## Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328P ## --------------------------------------------------- pro.menu.cpu.8MHzatmega328=ATmega328P (3.3V, 8 MHz) pro.menu.cpu.8MHzatmega328.upload.maximum_size=30720 pro.menu.cpu.8MHzatmega328.upload.maximum_data_size=2048 pro.menu.cpu.8MHzatmega328.upload.speed=57600 pro.menu.cpu.8MHzatmega328.bootloader.low_fuses=0xFF pro.menu.cpu.8MHzatmega328.bootloader.high_fuses=0xDA pro.menu.cpu.8MHzatmega328.bootloader.extended_fuses=0xFD pro.menu.cpu.8MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex pro.menu.cpu.8MHzatmega328.build.mcu=atmega328p pro.menu.cpu.8MHzatmega328.build.f_cpu=8000000L
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:
- 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?
- Will the parameters I insert here only work for the
Upload Using Programmeroption? I want the regular upload (via bootloader) to work normally.
- 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?