Can't figure out how to use MiniCore to run ATMega328P on 8 MHz internal

long story short, my objective is the following: I'm making a project in which would be nice to work with 8 Mhz (preferably using the internal clock), as I plan it to be supplied by a 3V battery.
Since I generally lack on technical knowledge about these in-depth things, I preferred to do exactely as stated in the guides, but I didn't try to "correct the errors", since I don't know at all where should I go, and the other posts I searched into confused me more. So, I hoped that someone would have the patience to help me on my specific problem, but I'll try to be as detailed as possible. (Sorry if it's gonna be a kinda long question)
I leave some specs so it's more clear what I'm using:

  • chip: ATMega328P-PU
  • board: Arduino UNO rev. 3
  • IDE: Arduino IDE 1.8.13
  • for the work, I tried using Minicore v2.1.3
  • OS: Ubuntu 20.04 LTS (in case you need to redirect me to some folder, idk)
  • consider also that I don't have any external programmer or simila, and I hope I can achive my goal without having to buy any of those things

General overview
From the beginning: the ATMega328P I bought is already bootloaded for 16 MHz for my Arduino UNO (aka. I bought it, I inserted it in the board and it was ready to be used). As stated before, however, when working on my project I wanted to switch to 8 MHz, mainly because of the supply voltage (the whole system runs on 3V, so it kinda bothers me that I need to supply 5V just for the ATMega, which will run as a standalone chip; I already managed to make it work fine, at least on 16 MHz).
I found out two main ways to change my operating frequency:

I'll describe them both.

With the ArduinoToBreadboard guide
First doubt, probably very stupid: as I tried to install all the, I found out that only gets recognized by the IDE, which I found strange, since I imagined that the last version was more likely to work (as I didn't find a successive version, I thought that was the one still used).
Anyway, I tried the procedure, and just by selecting Tools > Board > ATmega328 on a breadboard (8 MHz internal clock) i get this

The current selected board needs the core 'arduino:arduino' that is not installed.

and I didn't find a single way on what to do next. Obviously, even by following the instructions anyway and trying to burn the bootloader, it doesn't work

Arduino: 1.8.13 (Linux), Board: "ATmega328 on a breadboard (8 MHz internal clock)"

at cc.arduino.packages.uploaders.SerialUploader.burnBootloader(
Error while burning bootloader.

I didn't went further, as I had doubt with this method from the start. But if you can enlighten me, then thank you.

With the MiniCore guide
Uploading the program on the IDE went nice and easy. But the first problem came quickly: as shown here GitHub - MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB I went with using the first wiring diagram (since my ATMega is a DIP28 package). The problem is that I didn't really know what the sections "UART" and "AVR ISP" were, but by searching I found out that they are the same (am I right here?) as the ones shown here
In other words, the pins seems connected in the same way as the ones on the ArduinoToBreadboard guide. Also, since I don't have a 8 MHz crystal right now, I assumed I could not use it, since my objective was not to have an external crystal (probably a terrible reasoning, but trust me if I say if I'm completely lost). So I went with that configuration instead, as otherwise I don't really know what those UART and AVR ISP pins are on the Arduino UNO board (if they really are there).
I decided anyway to give it a go with these configs on the IDE

Screenshot from 2021-08-01 11-04-20

leaving almost anything untouched. The only thing I changed was the BOD, as I've understood it's related to the chip shutdown once this supply voltage is reached (if I understood right). I left it with a low value in order not to interfere with the fact that the battery discharges.

Burning the bootloader didn't work, as I had this output:

/home/verdefluox/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino18/bin/avrdude -C/home/verdefluox/.arduino15/packages/MiniCore/hardware/avr/2.1.3/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/ttyACM0 -b19200 -e -Ulock:w:0x3f:m -Uefuse:w:0b11111110:m -Uhfuse:w:0b11010110:m -Ulfuse:w:0xe2:m

avrdude: Version 6.3-20201216
Copyright (c) 2000-2005 Brian Dean,
Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "/home/verdefluox/.arduino15/packages/MiniCore/hardware/avr/2.1.3/avrdude.conf"
     User configuration file is "/home/verdefluox/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : /dev/ttyACM0
     Using Programmer              : stk500v1
     Overriding Baud Rate          : 19200

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00

So I'm stuck here, and I have no idea on how to proceed.
About this method, however, I have one "preliminary" question that I can correct quickly (and it's not software related): what is the correct wiring diagram that I should follow? And do I really need the external crystal for uploading the new bootloader (if I'm planning to use the internal instead)?
Also: in the MiniCore GitHub page, at the very end of the page, I saw this written:

If you don't want to mess with breadboards, components and wiring; simply use your Arduino UNO!

Does this mean that I can do all the procedure with the ATMega328 inserted into the UNO board?

I know that an answer is gonna take some time, but I hope someone can help me, maybe step by step, if I'm not asking too much. Obviously I'll try everything you suggest me and I'll try to explain everything I do and I see.

P.S. I can also consider using an external 8 MHz crystal, since in the end my biggest goal is to make it run at 3V in some way (and 16 MHz is no good for that voltage).

I'll try to answer as well as I can.

If your ATmega328 came loaded with a 16 MHz bootloader, it will require an external clock signal applied to the XTAL1 pin (usually a crystal) for it to work. This means that the crystal has to be there for it to re-configure it to use the internal oscillator. If you have two Arduinos, you can insert the target chip into the 28-pin socket on a UNO board, connect a programmer to the 6-pin ISP connector (or RESET, 11, 12 and 13) and burn the bootloader. Now it's running from its internal 8 MHz clock, so it will work on a breadboard with nothing connected to the XTAL pins.

There is a lot of outdated and/or misleading guides out there that will only cause you trouble. Use MiniCore, It's the most feature-rich and well-maintained core.

In the minimal setup, UART and ISP are just headers that your USB to serial adapter or ISP programmer connects to.
UART is used to upload code using a USB to serial adapter, just like the Arduino UNO uses. ISP is the programming interface you use to burn the bootloader with. You don't have to use a bootloader, but then you'll have to use your ISP programmer to upload your programs. You need a bootloader to be able to upload using a USB to serial adapter.

When it comes to the ISP programmer, I really prefer to use a dedicated programmer, such as the USBtinyISP or the USBasp. I've seen lots of users having issues with the Arduino as ISP setup, but I can't say for sure if it's user-related or not. Have you remembered to load the Arduino as ISP sketch to your UNO before using it as a programmer? The Avrdude output reveals that Avrdude (the upload tool used by Arduino IDE can't communicate with your Arduino as ISP programmer.

A word about the internal oscillator. It's not the most accurate, and I've experienced that higher-speed UART communication may not work very well since the oscillator maybe a few percent off. Your mileage may vary, but that's my experience.

Hi Guys,

I just wrote a huge great long thread about how I was having issues uploading sketches to an ATmega328P chip on a breadboard, but I dleted it all as I solved it.

The issues: If I had the external 16MHz crystal and used the minicore 16MHz external bootloader, all was fine and dandy and I could upload sketches all day with my FTDI adapter.

However, if I uploaded the 8MHz internal bootloader (or 4Mhz, or 2MHz or 1MHz), which uploaded fine, I then didn't once have luck uploading a sketch with the FTDI.

I tried and tried last night until well gone midnight, but luck.

Anyway, I just seemed to have cracked it.

Using an Arduino UNO as ISP, and using "upload using programmer" solved all my headaches. The sketch uploaded fine and worked flawlessly. Just the Blink program buy hey!

I then installed my USBASP using the Zadig tool for the driver, set USBasp (minicore) as the programmer, and again, "upload using programmer", and BINGO!! Blinkety blink blink :slight_smile:

Haven't actually tried the FTDI adapter using this method as have too many other things to do and need to get on.

Now I'm sure many of you are saying: Yes of course that's how you do it......but I'm guessing that there are a few others like me that are having grief, so I thought that I'd share my findings. If it helps out one other person then my time typing has not been wasted.

Happy blinking!


If you select your 16mhz board in tools /board and upload the 8mhz bootloader , it will then only work at 8mhz .( I’m unsure but you may have to remove the external 16Mhz xtal even if using internal clock - never tried it ).
You then select the board as 8mhz and you can program via the usb as normal if you want .
Using the “ upload using programmer “ option you will overwrite the bootloader ( so usb won’t work ), but leave the fuse setting correct for 8mhz.

Well worth buying a programmer , makes life easy and hats off to the guys who wrote Minicore - brilliant

You do not have to remove the crystal, the chip will run at 8MHz just fine. Though if you are using the MiniCore core and remove the crystal and associated caps, you have 2 more GPIO pins (pin 20 and 21).

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.