ATmega328p, converting to internal clock from 16MHz


I want to convert an ATmega 328p to use its internal clock instead of an external 16MHz. I currently have an ATmega 328p configured for 16 MHz, can I change it to use internal using only an Arduino Uno? If so how is it done?

Thanks in advance.

Yes, you can change it. It is fuse settings in ATmega but some ISP programmer is needed. Extra UNO can be used "Arduino as ISP" to do this job.

I use the MiniCore core to set up mega328 chips to run on the internal oscillator (usually 8MHz) along with an Uno loaded with Arduino as ISP to burn the bootloader.

As long as you mean that you have a '328p and a working Arduino Uno, yes. Use the Arduino Uno with ArduinoISP sketch and "Arduino as ISP" programmer (not "ArduinoISP" programmer, even though the sketch is named that). After uploading the sketch, put a ~10uF cap (really, anything over 1uF should be good) between reset and ground (if polarized cap, negative pin towards ground) on the Uno - remove that cap before attempting to upload to the Uno in the future.

Make sure that you have all Vcc (smd version of chip has multiple Vcc pins, through-hole one does not) and AVcc pins of target connected together, and all gnd pins connected together (failure to do this may damage the part). There should also be a 0.1uF cap between each Vcc pin and nearest ground, and between AVcc and Gnd, located as close to the part as practical - without these, programming and general operation may be unreliable, or may appear to work in some situations, but not all.

After this, connect the wires on the Uno to the target 328p - pin 10 of uno goes to target's reset pin, MISO/MOSI/SCK to the same pins on target, gnd to gnd, 5v to vcc.

Choose the minicore board def for '328p, and select the desired options (be sure to select 8MHz internal if that's what you want, as burning bootloader with crystal as clock source will render it unprogrammable until you provide a crystal or substitute clock source) - and choose "burn bootloader".

Then if you chose to install a bootloader from that submenu ("burn bootloader" is needed either way - even if not using a bootloader - as that's the only way to set the fuses), you can wire up an external USB-serial adapter and DTR-reset circuit (this is widely available, so I won't belabor that here) and program it normally - make sure that you have the same board def and bootloader option selected as you did when programming it.

Or, if you don't choose to install bootloader (that menu is set to no bootloader), leave the Arduino as ISP connected as before, and "upload" will upload the sketch via ISP.

Note that you can always choose "upload using programmer" to forcibly upload a sketch via ISP, even if you "burned bootloader" with bootloader selected, however, this is inadvisable, as it will erase the bootloader, but you will still not get the 512b of available flash.

Note that no matter which options you choose (barring selecting an external crystal without one connected, as noted above - there are a few other fuse settings that will render it unprogramable via ISP, but AFAIK, minicore doesn't expose them, so don't worry about this), you can always connect an ISP programmer and do "burn bootloader" to apply the newly selected settings.

Finally, while you can of course keep using an Uno with Arduino as ISP for this, if you're doing a lot of ISP programming, I suggest either getting a cheap nano clone to dedicate to this task (ie, solder the jumpers on and glue the wire down to the nano so they don't break during handling), or get a USBAsp (or USBTinyISP) - all of those options are under $5 on ebay, and not only is it super-convenient, you also have fewer opportunities to screw up the wiring - at most, there's only one end of each wire to get wrong, and if there's a 2x3 pin ISP header on your target board (which I recommend), there are only two ways to connect the programmer to it, one of which is correct.