2
\$\begingroup\$

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?

  1. Make appropriate connections with ATmega328 and chipless Arduino board, connect with the ISP (mkii)

  2. Burn the fuses with the avrdude according to the fuse bits while the signal generator is connected to XTAL1 as 8MHz

  3. In boards.txt, change the F_CPU to 8000000L (or need to create a new boards.txt entry?)

  4. 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.

\$\endgroup\$
1
\$\begingroup\$

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 the f_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.

\$\endgroup\$
  • \$\begingroup\$ Hello Ignacio, sorry for my bad understanding but can you clarify the "each entry must have a unique identifier" and the "prefix" part ? After changing the fuse bits, can I still use the Arduino IDE for uploading the sketches ? (bootloader) \$\endgroup\$ – aso Jan 19 '15 at 5:28
  • \$\begingroup\$ If an entry already exists that uses "atmega328p" then you have to change your entry to use something else. \$\endgroup\$ – Ignacio Vazquez-Abrams Jan 19 '15 at 5:29
  • \$\begingroup\$ Sorry Ignacio, How can i change my entry to use something else as a 'valid' prefix ? I thought the atmega328p is the part's official name which is not possible to change. I would appreciate if you give me an example in this case \$\endgroup\$ – aso Jan 19 '15 at 5:39
  • \$\begingroup\$ The identifier has nothing to do with the part. It's simply a handle for the IDE. \$\endgroup\$ – Ignacio Vazquez-Abrams Jan 19 '15 at 5:44
  • \$\begingroup\$ The fuse bit parameters only matter when burning the bootloader to the chip (via ISP). They otherwise have no use or effect. \$\endgroup\$ – Ignacio Vazquez-Abrams Jan 19 '15 at 5:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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