I want to change the fuse bits of the ATMega328 to operate with external clock (function/signal generator) instead of the crystal. The clock speed will be 8MHz. I have been trying for months and all of my attempts failed as I locked the chips due to the wrong connections or misunderstanding the bits.
I understand the part where we need to set the CKSEL to 0000 (External clock)
I also understand how do we use the avrdude and connect the clock (function generator) input to the XTAL1
My command would be something like this:
avrdude -c avrispmk2 -p atmega328p -P COM6 -U lfuse:w:0xe0:m -U hfuse:w:0xde:m -U efuse:w:0xff:m
I have bought an avrispmk2 ISP and I think I have the appropriate connections on the breadboard at this point.
My question is, after burning the chips fuse, what kind of modifications do I need to make on boards.txt file?
Do I need to include the fuse bits or anything extra in boards.txt?
atmega328p.name=Mynewarduino
atmega328p.upload.protocol=avrispmkII
atmega328p.upload.maximum_size=32256
atmega328p.build.mcu= atmega328p
atmega328p.build.f_cpu=8000000L // clock speed is 8mhz now
atmega328p.build.core=arduino
atmega328p.build.variant=standard
What else should be in the custom boards.txt file?
I have been trying for months and I would greatly appreciate any answer or comments. Could you please explain me steps as I can follow without ruining another chip?
If I understand the procedure correctly, are these the steps?
-
Make appropriate connections with ATmega328 and chipless Arduino board, connect with the ISP (mkii)
-
Burn the fuses with the avrdude according to the fuse bits while the signal generator is connected to XTAL1 as 8MHz
-
In boards.txt, change the F_CPU to 8000000L (or need to create a new boards.txt entry?)
-
Then upload the blink sketch with Arduino IDE (do I need to upload using programmer?)
If I am missing any step, I would appreciate to hear.
Best Answer
Copy the existing entry, changing the prefix used; each entry must have a unique identifier, and the menu shows the various
<identifier>.name
values for each entry. Only change the variables that matter for the new chip, in this case thef_cpu
value.If not using a bootloader then change the
maximum_size
parameter to the full size of the flash on the chip, i.e. 32768, and don't forget to unprogram the BOOTRST fuse. Otherwise set the value to complement the BOOTSZ fuses and compiled bootloader size.