MCUdude - MiniCore - Arduino Hardware Package For ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
MCUdude - MiniCore - Arduino Hardware Package For ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
MiniCore Public
LICENSE Readme
View license
PlatformIO.md
Activity
README.md 945 stars
59 watching
Wiring_reference.md
236 forks
Report repository
README License
Releases 24
https://github.com/MCUdude/MiniCore 1/12
2024/5/14 19:14 MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
An Arduino core for the ATmega328, ATmega168, ATmega88, ATmega48 and ATmega8, all running the Urboot bootloader. This core requires at
Packages
least Arduino IDE v1.8, where v1.8.9 or newer is recommended. IDE 2.x should also work.
No packages published
From MiniCore version 3 and onwards, the Optiboot bootloader has been replaced by the superior Urboot bootloader. It's smaller, faster, and has
automatic baud rate detection, and can read and write to EEPROM. Other cool features the bootloader provides but are not utilized by MiniCore
Contributors 14
are user program metadata stored in flash (that can easily be viewed by Avrdude -xshowall) and chip-erase functionality. If you already have
Optiboot installed and don't want to replace it with Urboot, you can still upload programs without any compatibility issues. However, if you're
burning a bootloader to a new chip, Urboot is the way to go.
This core gives you two extra IO pins if you're using the internal oscillator! PB6 and PB7 are mapped to Arduino pin 20 and 21.
Supported microcontrollers
+ 28 deployments
Supported clock frequencies
Bootloader option
Languages
Baud rate option
BOD option C++ 35.5% C 34.6% Shell 23.3%
EEPROM retain option Makefile 6.0% Other 0.6%
https://github.com/MCUdude/MiniCore 2/12
2024/5/14 19:14 MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
Supported microcontrollers:
ATmega8
ATmega48
ATmega88
ATmega168
ATmega328
https://github.com/MCUdude/MiniCore 3/12
2024/5/14 19:14 MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
Make sure you connect an ISP programmer, and select the correct one in the "Programmers" menu. For time-critical operations, an external
crystal/oscillator is recommended. The Urboot bootloader has automatic baud rate detection, so UART uploads should work fine even though
the oscillator is a little too fast or too slow.
16 MHz External crystal/oscillator Default clock on most AVR-based Arduino boards and MiniCore
18.4320 MHz External crystal/oscillator Great clock for UART communication with no error
14.7456 MHz External crystal/oscillator Great clock for UART communication with no error
11.0592 MHz External crystal/oscillator Great clock for UART communication with no error
7.3728 MHz External crystal/oscillator Great clock for UART communication with no error
3.6864 MHz External crystal/oscillator Great clock for UART communication with no error
1.8432 MHz External crystal/oscillator Great clock for UART communication with no error
https://github.com/MCUdude/MiniCore 4/12
2024/5/14 19:14 MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
Bootloader option
MiniCore lets you select which serial port you want to use for uploading. UART0 is the default port for all targets, but ATmega328PB can also
use UART1. If your application doesn't need or require a bootloader for uploading you can also choose to disable it by selecting No bootloader.
This frees 384 bytes of flash memory on ATmega8/88/168/328 and 320 bytes on the ATmega48.
Note that you need to connect a programmer and hit Burn bootloader if you want to change any of the Bootloader settings.
https://github.com/MCUdude/MiniCore 5/12
2024/5/14 19:14 MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
BOD option
Brown-out detection, or BOD for short lets the microcontroller sense the input voltage and shut down if the voltage goes below the brown-out
setting. To change the BOD settings you'll have to connect an ISP programmer and hit "Burn bootloader". Below is a table that shows the
available BOD options:
EEPROM option
If you want the EEPROM to be erased every time you burn the bootloader or upload using a programmer, you can turn off this option. You'll
have to connect an ISP programmer and hit "Burn bootloader" to enable or disable EEPROM retain. Note that when uploading using a
bootloader, the EEPROM will always be retained.
Note that if you're using an ISP programmer or have the Urboot bootloader installed, data specified in the user program using the EEMEM
attribute will be uploaded to EEPROM when you upload your program in Arduino IDE. This feature is not available when using the older
Optiboot bootloader.
#include <avr/eeprom.h>
volatile const char ee_data EEMEM = {"Data that's loaded straight into EEPROM\n"};
void setup() {
}
https://github.com/MCUdude/MiniCore 6/12
2024/5/14 19:14 MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
void loop() {
}
Printf support
Unlike the official Arduino cores, MiniCore has printf support out of the box. If you're not familiar with printf you should probably read this first.
It's added to the Print class and will work with all libraries that inherit Print. Printf is a standard C function that lets you format text much easier
than using Arduino's built-in print and println. Note that this implementation of printf will NOT print floats or doubles. This is disabled by
default to save space but can be enabled using a build flag if using PlatformIO.
If you're using a serial port, simply use Serial.printf("Milliseconds since start: %ld\n", millis()); . You can also use the F() macro if you
need to store the string in flash. Other libraries that inherit the Print class (and thus supports printf) are the LiquidCrystal LCD library and the
U8G2 graphical LCD library.
Pin macros
Note that you don't have to use the digital pin numbers to refer to the pins. You can also use some predefined macros that maps "Arduino
pins" to the port and port number:
https://github.com/MCUdude/MiniCore 7/12
2024/5/14 19:14 MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
// Results in the exact same compiled code
digitalWrite(13, HIGH);
Programmers
Select your microcontroller in the boards menu, then select the clock frequency. You'll have to hit "Burn bootloader" in order to set the correct
fuses and upload the correct bootloader.
Make sure you connect an ISP programmer, and select the correct one in the "Programmers" menu. For time-critical operations, an external
oscillator is recommended.
How to install
https://github.com/MCUdude/MiniCore 8/12
2024/5/14 19:14 MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json
Open the Tools > Board > Boards Manager... menu item.
Scroll down until you see the MiniCore entry and click on it.
Click Install.
Manual Installation
Click on the "Download ZIP" button in the upper right corner. Extract the ZIP file, and move the extracted folder to the location
"~/Documents/Arduino/hardware". Create the "hardware" folder if it doesn't exist. Open Arduino IDE, and a new category in the boards menu
called "MiniCore" will show up.
PlatformIO
PlatformIO is an open-source ecosystem for IoT and embedded systems, and supports MiniCore.
https://github.com/MCUdude/MiniCore 9/12
2024/5/14 19:14 MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
Wiring reference
To extend this core's functionality a bit further, I've added a few missing Wiring functions. As many of you know Arduino is based on Wiring,
but that doesn't mean the Wiring development isn't active. These functions are used as "regular" Arduino functions, and there's no need to
include an external library.
I hope you find this useful because they really are!
Function list
portMode()
portRead()
portWrite()
https://github.com/MCUdude/MiniCore 10/12
2024/5/14 19:14 MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
sleepMode()
sleep()
noSleep()
enablePower()
disablePower()
Pinout
This core uses the standard Arduino UNO pinout and will not break the compatibility of any existing code or libraries. What's different about
this pinout compared to the original one is that this has three additional IO pins available. You can use digital pins 20 and 21 (PB6 and PB7) as
regular IO pins if you're using the internal oscillator. If you're willing to disable the reset pin (can be enabled using high voltage parallel
programming) it can be used as a regular IO pin and is assigned to digital pin 22 (PC6). Click to enlarge:
https://github.com/MCUdude/MiniCore 11/12
2024/5/14 19:14 MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
https://github.com/MCUdude/MiniCore 12/12