MegaCore - Arduino support for ATmega64/128/1281/2561 and ATmega640/1280/2560

Hi everyone!
As some of you might already have discovered, the ATmega64 and ATmega128 can be bought for less than a dollar at eBay or Aliexpress. Too bad they’re not supported by Arduino IDE, right?

That’s why I’ve created MegaCore - an Arduino hardware package for a handful 64 and 100 pin AVR microcontrollers! It started out as an hardware package for ATmega64 and ATmega128, but have grown to become a package that includes several other microcontrollers.

Now that support for the ATmega640/1280/2560 is added, you can use MegaCore with your Arduino Mega or Arduino Mega 2560. All you have to do is replace the bootloader, and you’re ready to go! There’s also an alternative pinout for these microcontrollers - AVR pinout. This pinout matches the original “AVR pinout” much better, and let’s you use all 86 IO pins.

Supported microcontrollers:

  • ATmega64
  • ATmega128
  • ATmega640
  • ATmega1280
  • ATmega1281
  • ATmega2560
  • ATmega2561

Supported clock frequencies:

  • 20 MHz external oscillator
  • 18.432 MHz external oscillator
  • 16 MHz external oscillator
  • 12 MHz external oscillator
  • 8 MHz external oscillator
  • 8 MHz internal oscillator
  • 1 MHz internal oscillator

MegaCore features:

Download links, pinout diagrams, boards manager URL, installation instructions and more is available at Github:
GitHub - MCUdude/MegaCore: Arduino hardware package for ATmega64, ATmega128, ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561, AT90CAN32, AT90CAN64 and AT90CAN128

finally!

many probably dont know m128 was the original arduino (before it was even called arduino). long before the somewhat better known mega8 (ng). m128, although snubbed by official arduino company, is definitely best bang for the buck with no other family member coming close. this new core is definitely worth a try, thanks.

I've found some ATmega128 related fragments in the original Arduino core, but it was far from complete. It seems like core support was dropped many years ago, but no one removed the fragments.

I knew the first Wiring boards where based on the ATmega128, but did the Arduino folks used the same microcontroller in their early prototypes as well?

no. seems in order to distance themselves from the wiring initiative they also abandoned the original hardware platform in favor of m8/ng. probably a good thing because back then m128 was about 20x more expensive than now and few would have been inclined to get on board. actually m8 was about 10x more than today but at least affordable. added advantage of dip for those who fear smd.

unlike parallax it was open source, more powerful, and last but not least cheaper so diy crowd jumped. not just for rich hobbyists and academics anymore.

edit: just took it out for a spin and preliminary blink tests look good. pin numbers seem very consistent and easily reconstructed even w/o docs. one question though, why go nuts after pin 44?

john1993:
just took it out for a spin and preliminary blink tests look good. pin numbers seem very consistent and easily reconstructed even w/o docs. one question though, why go nuts after pin 44?

I’ve done the same on the MightyCore standard pinout as well (though I just used Mainiacbug’s standard pinout). The reason this is to match the internal ports as close as possible. I think it’s nice that ADC0 is actually Arduino pin A0. It makes coding along with the data sheet easier

This is most excellent news, I was talking about the 128 last year, but held off doing anything apart from buying loads at the silly cheap price !

Thank you for your work, I cant wait to get stuck in to my 24Bit Colour VGA driver !!

I think I got some of THESE at £0.79p each !

I actually bought mine even cheaper; 0.92$ each at AliExpress!

I'm planning to design my own development board for the ATmega64/128, but I'm not sure what's the most optimal board layout. I'm quite happy with my MightyCore development board, but the ATmega64/128 got way more pins.. The breakout board are atleast going to look like this:

hansibull:
it’s nice that ADC0 is actually Arduino pin A0.

oh yeah, i agree. now i see it was atmel engineers that decided to go backwards on portf.

btw thanks also for the excellent m32 package. another one of my favorites. by far best bang for the buck in dip-land. these were a long time coming and i wonder why people were stuck on m328/m1284/m2560 which dont come even close in terms of features vs cost.

ps: there are some rather nice pcb available on ebay: http://www.ebay.com/itm/181943619671

  1. besides m128 also works from m328 all the way up to m2560
  2. less than 30 cents ea
  3. silk numbers clearly visible outside headers unlike similar boards that cost more
  4. extra pins handy for things like regulators, leds, etc
  5. literally 3 minutes to install chip, cap, xtl, and minimum programming header

heres another breakout for up to qfp64 that is even cheaper & smaller:

s-l400.jpg

i have purchased hundreds of both types over the years for business and hobby. virtually impossible to make anything close myself considering features and cost.

You're talking Atmega32A vs Atmega1284P? "by far best bang for the buck in dip-land. these were a long time coming and i wonder why people were stuck on m328/m1284/m2560 which dont come even close in terms of features vs cost." 32A 1284P flash 32K 128K eeprom 1K 4K SRAM 2K 16K IO 32 32 both in 40 pin DIP USART 1 2 PWM 4 6 1-lot price at Digikey $6.28 $8.51 So yes, a little less money, but there are times when the bigger SRAM, 2nd hardware UART, more PWM are needed. If anything Atmega324P with all the benefits of 1284P but with smaller memory would be preferred, $6.15 each.

Couple of 1284P boards I offer. Will also take the 164, 324, and 644 variants. And the 32A. http://www.crossroadsfencing.com/BobuinoRev17/ |500x290 |500x490

Ever bought AVRs from Chinese sellers at EBay or Aliexpress?

Never. I only buy AVRs from Digikey or Mouser. I need repeatability in purchasing and traceability. Not potentially counterfeit or nonworking junk.

And 3-4 week delivery time for parts is not acceptable either.

I've bought a LOT of AVRs at Ebay and Aliexpress, and have never received a counterfeit, even if they where dirt cheap. Of course you don't have the traceability, but hey, it's 1/6th of the price.

It's just amazing (and ridiculous) that you can buy an Arduino duemilanove/UNO clone for less than 3$ including shipping. If you need it within a week; use DHL, EMS or UPS :) Same goes with bare AVRs to. I understand that reputable companies buy their components from [insert your favorite distributor here], but we're hobbyist! We want bang for the buck! And that's why we love prices that's so low the sellers must have hijacked a cargo ship or something :P

lol. i considered joking about bob having stock in digikey but figured the one about going out of business w/o arduino.cc forum was enough for this week. :)

taking into account the same features listed there is no competition between m32/m128 and any of the other arduino chips. of course i am talking about global (aka real world) pricing. oddly current price for one relatively feature poor m328 is higher than that for m32 or m128. just as strange m1284 is holding its own at around 10 bucks regardless of source. usually m32 is drop in replacement for m1284 and better deal at 80 cents (10:1 cost difference).

as mentioned countless times for me ease of purchase, availability, and bang for buck are paramount. i can understand where these might not be important and for some "traceabilty" more so. i must admit also having to do the digi/mouser (aka suckertown) thing occasionally for liability reasons. and sparkfun too. not very often thankfully.

i do recall couple years ago on this very forum and much earlier on avrfreaks just mentioning china would bring about tirades of "junk", "crooks", and "why dont you go live there with your pinko pals?". reminded me of the mcarthy era. now looks like at least 90% or so of the members caught on and openly admit to purchases from The Evil Empire. even those who used to hit the ceiling are now recommending ebay or alli links.

i guess patriotism is a virtuous trait (not really and definitely not for me).

ps. admittedly the lead time thing can be a plus for domestic. however i do recall waiting several months for a t45 shipment from digi and conversely have received packages from china in as little as 3 days. not the norm though. but in any case i have some patience and a knack for thinking ahead.

john1993:
oh yeah, i agree. now i see it was atmel engineers that decided to go backwards on portf.

btw thanks also for the excellent m32 package. another one of my favorites. by far best bang for the buck in dip-land. these were a long time coming and i wonder why people were stuck on m328/m1284/m2560 which dont come even close in terms of features vs cost.

ps: there are some rather nice pcb available on ebay: http://www.ebay.com/itm/181943619671

  1. besides m128 also works from m328 all the way up to m2560
  2. less than 30 cents ea
  3. silk numbers clearly visible outside headers unlike similar boards that cost more
  4. extra pins handy for things like regulators, leds, etc
  5. literally 3 minutes to install chip, cap, xtl, and minimum programming header

heres another breakout for up to qfp64 that is even cheaper & smaller:

s-l400.jpg

i have purchased hundreds of both types over the years for business and hobby. virtually impossible to make anything close myself considering features and cost.

I’ve found quite a few breakout boards at Ebay, but they are all so large! I’ve tried to make the footprint as small as possible without breaking the 0.1" pin spacing (and still make it square). I ordered just a few, but if there are any demand I might as well order 50 boards. Price per board tends to go down when you order a lot :slight_smile:

“but we’re hobbyist!”
Speak for yourself. I design cards for many people that go into production, and are used by colleges and businesses. I think I do more work that way than I do for hobbyists.

hansibull: I've found quite a few breakout boards at Ebay, but they are all so large! I've tried to make the footprint as small as possible without breaking the 0.1" pin spacing (and still make it square). I ordered just a few, but if there are any demand I might as well order 50 boards. Price per board tends to go down when you order a lot :)

you have to be careful because the more common design is not only bigger as you say but also the silk numbers get hidden under headers which is a deal breaker in my case. and they cost more. you do have to go a few pages in to find the little gem in my link and to get cost down.

did i mention these cost not much more than a quarter ea?

btw if you cant afford to spend $10-$15 on a lifetime supply of extremely versatile breakout boards then maybe in the wrong hobby? or maybe its fear of big numbers? :)

hansibull: I've bought a LOT of AVRs at Ebay and Aliexpress, and have never received a counterfeit,

unlikely anyone ever has. romantic concept but imo urban-myth/wives-tale. at this level of technology not likely these guys have a foundry in the basement. or even a basement. we are talking thatched huts. i will gladly pay 100x the going rate for an actual proven counterfeit for my ic museum.

btw bob, in addition to being a hobbyist i purchase hundreds of thousands of chips/year for business. im not a manufacturer like you but with clients who i have interest in helping survive. in this case the cost becomes even more important. we will have to agree on different priorities.

There is always THIS, but its a bit pricey