Atmel megaAVR
- Registry:
https://registry.platformio.org/platforms/platformio/atmelmegaavr
- Configuration:
platform =
platformio/atmelmegaavr
8-bit MCUs Built for Real-time Control with Core Independent Peripherals combining intelligent hardware peripherals along with the low-power capability of an AVR core, megaAVR microcontrollers (MCUs) broaden the effectiveness of your real-time control systems.
For more detailed information please visit vendor site.
Configuration
Upload using Programmer
In the case of external programmers, it’s easy to brick a board simply by specifying incorrect upload flags. It’s highly recommended to use the upload_command option that gives the full control over flags used for uploading. Please read Upload using Programmer for more information.
Upload using pymcuprog serialUPDI
pymcuprog
is a Python-based CLI tool for programming AVR devices with UPDI interface
using either a Microchip debugger (Atmel-ICE, Power Debugger, PICkit4, Snap, PKOB nano /
nEDBG / Curiosity Nano debugger) or via a standard serial port. It can be installed
directly in the PlatformIO virtual environment using the following command:
python -m pip install pymcuprog
Once pymcuprog
is installed it can be used as the uploader via a custom
upload_command option, for example:
[env:ATmega3209_pymcuprog_upload]
platform = atmelmegaavr
framework = arduino
board = ATmega3209
upload_speed = 115200
upload_flags =
--tool
uart
--device
atmega3209
--uart
$UPLOAD_PORT
--clk
$UPLOAD_SPEED
upload_command = pymcuprog write --erase $UPLOAD_FLAGS --filename $SOURCE
Note
When using a Microchip debugger it must be specified in the --tool argument, and the --uart argument omitted.
More information and a typical circuit diagram can be found in the official pymcuprog repository.
pymcuprog
is maintained by Microchip, and published on GitHub and pypi.org.
Upload using pyupdi
pyupdi
is a Python-based tool for programming tinyAVR and megaAVR devices with UPDI
interface via a standard serial port. It can be installed directly in the PlatformIO
virtual environment using the following command:
python -m pip install https://github.com/mraardvark/pyupdi/archive/master.zip
Once pyupdi
is installed it can be used as the uploader via a custom
upload_command option, for example:
[env:ATmega3209_pyupdi_upload]
platform = atmelmegaavr
framework = arduino
board = ATmega3209
upload_speed = 115200
upload_flags =
-d
mega3209
-c
$UPLOAD_PORT
-b
$UPLOAD_SPEED
upload_command = pyupdi $UPLOAD_FLAGS -f $SOURCE
Warning
Device names used in in pyupdi
differ from MCU names used in the atmelmegaavr
platform. Run pyupdi --help
to see the list of supported devices.
More information and a typical circuit diagram can be found in the official pyupdi repository repository.
Fuses programming
PlatformIO has a built-in target called fuses
for setting fuse bits. The default fuse
bits are predefined in the board manifest file in the fuses
section. For example,
fuses section for Arduino Nano Every board.
To set fuse bits you need to use target fuses
with pio run --target
command.
Custom fuses
Custom fuse values and upload flags (based on upload protocol) should be specified in
“platformio.ini” (Project Configuration File). An example of setting custom fuses for ATmega3209
board:
[env:custom_fuses]
platform = atmelmegaavr
framework = arduino
board = ATmega3209
upload_protocol = xplainedmini_updi
board_fuses.bootend = 0xAA
board_fuses.syscfg0 = 0xBB
board_fuses.osccfg = 0xCC
Overriding default fuses command
For more detailed information read Overriding default fuses command.
Bootloader programming
PlatformIO has a built-in target called bootloader
for flashing bootloaders. The
default bootloader image and corresponding fuse bits are predefined in the board manifest
file in the bootloader
section, for example, Arduino Uno WiFi Rev2.
To upload a bootloader image you need to use target bootloader
with
pio run --target
command.
Custom bootloader
Custom bootloader and accompanying fuses should be specified in “platformio.ini” (Project Configuration File).
An example of setting custom bootloader for ATmega4808
board:
[env:ATmega4808]
platform = atmelmegaavr
framework = arduino
board = ATmega4808
board_bootloader.file = /path/to/custom/bootloader.hex
board_bootloader.bootend = 0xFF
board_bootloader.syscfg0 = 0xDE
board_bootloader.osccfg = 0xFD
board_bootloader.lock_bits = 0x0F
Overriding default bootloader command
For more detailed information read Overriding default bootloader command.
Examples
Examples are listed from Atmel megaAVR development platform repository:
Stable and upstream versions
You can switch between stable releases of Atmel megaAVR development platform and the latest upstream version using platform option in “platformio.ini” (Project Configuration File) as described below.
Stable
; Latest stable version, NOT recommended
; Pin the version as shown below
[env:latest_stable]
platform = atmelmegaavr
board = ...
; Specific version
[env:custom_stable]
platform = atmelmegaavr@x.y.z
board = ...
Upstream
[env:upstream_develop]
platform = https://github.com/platformio/platform-atmelmegaavr.git
board = ...
Packages
Name |
Description |
---|---|
Arduino Wiring-based Framework for Microchip megaAVR microcontrollers |
|
Arduino Wiring-based Framework for Microchip megaAVR microcontrollers (DxCore) |
|
Arduino Wiring-based Framework for Microchip megaAVR microcontrollers (MegaCoreX) |
|
Arduino Wiring-based Framework for Microchip tinyAVR 0-series and 1-series chips (megaTinyCore) |
|
AVRDUDE is a utility to download/upload/manipulate the ROM and EEPROM contents of AVR microcontrollers |
|
AVRDUDE is a utility to download/upload/manipulate the ROM and EEPROM contents of megaAVR microcontrollers |
|
GCC Toolchain for Microchip AVR microcontrollers |
Warning
Linux Users:
Install “udev” rules 99-platformio-udev.rules
Raspberry Pi users, please read this article Enable serial port on Raspberry Pi.
Windows Users:
Please check that you have a correctly installed USB driver from board manufacturer
Frameworks
Name |
Description |
---|---|
Arduino Wiring-based Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences. |
Boards
Note
You can list pre-configured boards by pio boards command
For more detailed
board
information please scroll the tables below by horizontally.
Arduino
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ATMEGA4809 |
16MHz |
47.50KB |
6KB |
|
No |
ATMEGA4809 |
16MHz |
47.50KB |
6KB |
Microchip
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ATMEGA1608 |
16MHz |
16KB |
2KB |
|
No |
ATMEGA1609 |
16MHz |
16KB |
2KB |
|
No |
ATMEGA3208 |
16MHz |
32KB |
4KB |
|
No |
ATMEGA3209 |
16MHz |
32KB |
4KB |
|
No |
ATMEGA4808 |
16MHz |
48KB |
6KB |
|
No |
ATMEGA4809 |
16MHz |
48KB |
6KB |
|
No |
ATMEGA808 |
16MHz |
8KB |
1KB |
|
No |
ATMEGA809 |
16MHz |
8KB |
1KB |
|
No |
ATTINY1604 |
16MHz |
16KB |
1KB |
|
No |
ATTINY1606 |
16MHz |
16KB |
1KB |
|
No |
ATTINY1607 |
16MHz |
16KB |
1KB |
|
No |
ATTINY1614 |
16MHz |
16KB |
2KB |
|
No |
ATTINY1616 |
16MHz |
16KB |
2KB |
|
No |
ATTINY1617 |
16MHz |
16KB |
2KB |
|
No |
ATTINY1624 |
16MHz |
16KB |
2KB |
|
No |
ATTINY1626 |
16MHz |
16KB |
2KB |
|
No |
ATTINY1627 |
16MHz |
16KB |
2KB |
|
No |
ATTINY202 |
16MHz |
2KB |
128B |
|
No |
ATTINY204 |
16MHz |
2KB |
128B |
|
No |
ATTINY212 |
16MHz |
2KB |
128B |
|
No |
ATTINY214 |
16MHz |
2KB |
128B |
|
No |
ATTINY3216 |
16MHz |
32KB |
2KB |
|
No |
ATTINY3217 |
16MHz |
32KB |
2KB |
|
No |
ATTINY3224 |
16MHz |
32KB |
3KB |
|
No |
ATTINY3226 |
16MHz |
32KB |
3KB |
|
No |
ATTINY3227 |
16MHz |
32KB |
3KB |
|
No |
ATTINY402 |
16MHz |
4KB |
256B |
|
No |
ATTINY404 |
16MHz |
4KB |
256B |
|
No |
ATTINY406 |
16MHz |
4KB |
256B |
|
No |
ATTINY412 |
16MHz |
4KB |
256B |
|
No |
ATTINY414 |
16MHz |
4KB |
256B |
|
No |
ATTINY416 |
16MHz |
4KB |
256B |
|
No |
ATTINY417 |
16MHz |
4KB |
256B |
|
No |
ATTINY424 |
16MHz |
4KB |
512B |
|
No |
ATTINY426 |
16MHz |
4KB |
512B |
|
No |
ATTINY427 |
16MHz |
4KB |
512B |
|
No |
ATTINY804 |
16MHz |
8KB |
512B |
|
No |
ATTINY806 |
16MHz |
8KB |
512B |
|
No |
ATTINY807 |
16MHz |
8KB |
512B |
|
No |
ATTINY814 |
16MHz |
8KB |
512B |
|
No |
ATTINY816 |
16MHz |
8KB |
512B |
|
No |
ATTINY817 |
16MHz |
8KB |
512B |
|
No |
ATTINY824 |
16MHz |
8KB |
1KB |
|
No |
ATTINY826 |
16MHz |
8KB |
1KB |
|
No |
ATTINY827 |
16MHz |
8KB |
1KB |
|
No |
ATMEGA4808 |
16MHz |
48KB |
6KB |
|
No |
AVR128DA28 |
24MHz |
128KB |
16KB |
|
No |
AVR128DA32 |
24MHz |
128KB |
16KB |
|
No |
AVR128DA48 |
24MHz |
128KB |
16KB |
|
No |
AVR128DA64 |
24MHz |
128KB |
16KB |
|
No |
AVR128DB28 |
24MHz |
128KB |
16KB |
|
No |
AVR128DB32 |
24MHz |
128KB |
16KB |
|
No |
AVR128DB48 |
24MHz |
128KB |
16KB |
|
No |
AVR128DB64 |
24MHz |
128KB |
16KB |
|
No |
AVR32DA28 |
24MHz |
32KB |
4KB |
|
No |
AVR32DA32 |
24MHz |
32KB |
4KB |
|
No |
AVR32DA48 |
24MHz |
32KB |
4KB |
|
No |
AVR32DB28 |
24MHz |
32KB |
4KB |
|
No |
AVR32DB32 |
24MHz |
32KB |
4KB |
|
No |
AVR32DB48 |
24MHz |
32KB |
4KB |
|
No |
AVR64DA28 |
24MHz |
64KB |
8KB |
|
No |
AVR64DA32 |
24MHz |
64KB |
8KB |
|
No |
AVR64DA48 |
24MHz |
64KB |
8KB |
|
No |
AVR64DA64 |
24MHz |
64KB |
8KB |
|
No |
AVR64DB28 |
24MHz |
64KB |
8KB |
|
No |
AVR64DB32 |
24MHz |
64KB |
8KB |
|
No |
AVR64DB48 |
24MHz |
64KB |
8KB |
|
No |
AVR64DB64 |
24MHz |
64KB |
8KB |
|
No |
AVR64DD14 |
24MHz |
64KB |
8KB |
|
No |
AVR64DD20 |
24MHz |
64KB |
8KB |
|
No |
AVR64DD28 |
24MHz |
64KB |
8KB |
|
No |
AVR64DD32 |
24MHz |
64KB |
8KB |
|
No |
ATMEGA4809 |
16MHz |
48KB |
6KB |
|
No |
AVR128DA48 |
24MHz |
128KB |
16KB |
|
No |
AVR128DB48 |
24MHz |
128KB |
16KB |
|
No |
ATMEGA4809 |
16MHz |
48KB |
6KB |