Skip to content

Experimental Arduino core for the new megaAVR-0 series

Notifications You must be signed in to change notification settings

ObviousInRetrospect/MegaCoreX

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 

Repository files navigation

MegaCoreX

An Arduino core for the new megaAVR series! ATmega3208, ATmega4808, ATmega3209 and ATmega4809.

TODO:

  • UART pin swap inegraion DONE! use Serial.swap()
  • Add printf to print class DONE! use Serial.printf()
  • Get rid of nasty compiler warning when compiling a blank sketch (or any sketch really..)
  • Steal 20 MHz accurate timing from MCUdude_corefiles
  • SPI pin swap integration in libraries
  • I2C pin swap integration in libraries
  • Example (library?) for using the 32.768kHz cystal that can be found on Uno Wifi Rev2 and Curiosity Nano 4809
  • Add ArduinoAPI as subtree for easy maintainance (just need to get some PRs such as printf functionality merged first)
  • Readme
    • Need some good intro text at the beginning
    • Minimal setup schematics
  • Proper testing with updated toolchain (I'm experiencing trouble with the 32kB chips)

Table of contents

Supported microcontrollers

ATmega4809 ATmega4808 ATmega3209 ATmega3208
Flash 48 kB 48 kB 32 kB 32 kB
RAM 6 kB 6 kB 4 kB 4 kB
EEPROM 256 B 256 B 256 B 256 B
Serial ports 4 3 4 3
IO pins 40/41* 26/27*
23†/24††
40/41* 26/27*
23†/24††
Available packages TQFP48
QFN48
TQFP32
QFN32
SSOP28
TQFP48
QFN48
TQFP32
QFN32
SSOP28

* Physical reset pin is disabled
SSOP28 package
†† SSOP28 package and reset disabled

Programming

Programming must be done with a UPDI compatible programmer, such as the JTAGICE 3 or any of the new EDBG chips that can be found on newer AVR explained and curoisity boards.

Unlike the Arduino UNO WiFi Rev2 boards package MegaCoreX does not auto detect the programmer you're using. You'll have to select the correct programmer in the Programmers. If you're using an Arduino Uno Wifi Rev2 board, a Curiosity Nano or an Xplained pro board you'll have to choose mEDBG, nEDBG or EDBG.

Supported clock frequencies

MegaCoreX lets you choose what clock frequency you want to run your microcontroller at.

Frequency Oscillator type Other
20 MHz Internal oscillator
16 MHz Internal oscillator Default option
8 MHz Internal oscillator Derived from 16 MHz osc.
4 MHz Internal oscillator Derived from 16 MHz osc.
2 MHz Internal oscillator Derived from 16 MHz osc.
1 MHz Internal oscillator Derived from 16 MHz osc.

Note that unlike other AVRs none of these chips are able to drive an external crystal or resonator. If you need an external oscillator it has to be one with a driven clock output.

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. Below is a table that shows the available BOD options:

4.2 V
4.0 V
3.7 V
3.3 V
2.9 V
2.6 V (default option)
2.1 V
1.8 V
Disabled

Reset pin

None of the megaAVR-0 microcontrollers needs the reset line in order to be reprogrammed over the UPDI interface. This means that the reset pin can be used as a GPIO pin instead! There's no need for a high voltage programmer in order to turn that pin into a reset pin again either. If you have a development board you can instead use the reset button as a general purpose button for your project.

Pinout

This core provides several different Arduino pin mappings based on your current hardware

  • Uno WiFi: This pinout is 100% compatible with the Arduino Uno WiFi Rev2 hardware. If you have code that's written for the Uno WiFi Rev2 it will work without any modifications if you choose this pinout. Note that this pinout does pin swapping on serial interfaces and PWM pins by default, and some peripherals are renamed to match the original 328P Uno hardware better. Note that this pinout is only available on ATmega3209/ATmega4809.
  • 48 pin standard: This pinout is much closer to the actual hardware than the Uno WiFi pinout. It will not be compatible with shields or anything like that, but it's much more clean and elegant from a hardware point of view. The only pin swap done by default is the PWM output pins. This is done to prevent them from "colliding" with other peripherals. Note that this pinout is only available on ATmega3209/ATmega4809.
  • 32 pin standard: This is the pinout for the 32 pin version of the ATmega3208/4808. Again, it will not be compatible with shields or anything like that, but it's clean and elegant from a hardware point of view. The only pin swap done by default is the PWM output pins. This is done to prevent them from "colliding" with other peripherals.
  • 28 pin standard: This is the pinout for the 28 pin version of the ATmega3208/4808. Will not be compatible with shields or anything like that, but it's still clean and elegant from a hardware point of view. Only pin swap done by default is the PWM output pins. This is done to prevent them from "colliding" with other peripherals.

Please have a look at the pins_arduino.h files for detailed info.

Click to enlarge:

MegaCoreX ATmega3209/4809 pinout MegaCoreX ATmega3208/4808 pinout









How to install

Boards Manager Installation

Not yet implemented

Manual Installation

Click on the "Download ZIP" button. 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 "MightyCoreX" will show up.

Getting your hardware working

Arduino Uno WiFi Rev2

The Arduino Uno WiFi Rev2 is the easiest board out of these to get started with, because it's officially supported by Arduino. It uses an ATmega4809, and recommended pinout is Uno WiFi. Printing to the serial monitor on your PC is done by initializing Serial.begin(baud). You'll also have to choose Atmel mEDBG (ATmega32u4) as your programmer in order to upload code. For more information about this board please see the product page and its schematic.

Click to enlarge:

Curiosity Nano

The Curiosity Nano uses an ATmega4809 but has a different pinout than the Uno Wifi Rev2. Recommended pinout for this board is 48 pin standard. Use the LED_BUILTIN macro to control the onboard LED. Note that UART3 is connected to the nEDBG chip (often refered to as the debug serial port). This means you'll have to use Serial3.begin(baud) in order to print to the serial monitor. You'll also have to choose Atmel nEDBG (ATSAMD21E18) as your programmer in order to upload code. For more information about this board please refer to the userguide and its schematic.

Click to enlarge:

AVR-IOT WG

The AVR-IOT WG uses the ATmega4808 in a 32 pin package. 32 pin standard is the correct pinout for this board. Use the LED_BUILTIN macro to control the onboard LED marked with WIFI. Note that UART2 is connected to the nEDBG chip (often refered to as the debug serial port). This means tou'll have to use Serial2.begin(baud) in order to print to the serial monitor. You'll also have to choose Atmel nEDBG (ATSAMD21E18) as your programmer in order to upload code. For more information about this board please refer to the userguide and its schematic.

Click to enlarge:

ATmega4809 Xplained Pro

The ATmega4809 Xplained Pro uses an ATmega4809. Recommended pinout for this board is 48 pin standard. Note that the UART1 is connected to the EDBG chip (often refered to as the debug serial port). This means you'll have to use Serial1.begin(baud) in order to print to the serial monitor. You'll also have to choose Atmel EDBG (AT32UC3A4256) as your programmer in order to upload code. For more information about this board please refer to the userguide and its schematic.

Click to enlarge:

About

Experimental Arduino core for the new megaAVR-0 series

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 62.8%
  • C 35.8%
  • Assembly 1.4%