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

Yep, it's a bit pricey for just a PCB. I was thinking about making something like this (4 minute mockup)

The chip can easily be replaced by other pin compatible ones (ATmega64/128/1281/2561 and all the other CAN variants). I think this board will make it easy prototyping an incorporating this AVR family into hobby projects :slight_smile:

I settled on getting one of these, as you suggested in the first post

http://www.ebay.com/itm/381547311629

Good choice! I've modified mine to be able to program it using a USB to serial adapter (FTDI pinout). Just make sure to remove C3! It's preventing auto reset from working..

The custom breakout boards have arrived! Looking great :smiley: (Boards ordered from dirtypcbs.com)


Are there any instrest for adding support for ATmega1281 and ATmega2561 as well? :slight_smile:

I have 2560 and 2561 system on a board designs working.
Top


Bottom

2561 top

Jumpers to connect signals for Bootloading


Bottom

More info on bootloading & compiling at this thread
http://forum.arduino.cc/index.php?topic=380757.0

If I order more 2560 boards, I'll re-do them more like the 2561s with the labels inside the headers to reduce the overall size.

I don't think using an unmodified core for the Mega2561 is a good idea.. There are many places that needs "#if defined(AVR_ATmega2561)" in order to work properly. Does there exist a modified Arduino core for the ATmega1281/2561?

To be honest, have been working on getting a stencil set up for applying paste & reflow soldering on the 2561. First pass didn't work too well, needed lot of hand cleanup to remove shorts. Then got flu & strep throat, so wasn't feeling well enough to do much. Just got in a new stencil, but other projects in the meantime and tax prep actions are taking up time to try the new stencil. Maybe next weekend.

Does the board house add a little tin to all the pads? Mine does, so I'm just using a lot of Flux before I reflow. Perfect results every time! I just need to clean up the flux residue afterwards

Great news! Support for ATmega1281 and ATmega2561 is now added to MegaCore Make sure to check it out :slight_smile:

Thanks hansibull! That's very good news.

Hello again everybody! I've expanded the list of supported microcontrollers to include the ATmega640, ATmega1280 and ATmega2560. By default they're using the default Arduino MEGA pinout, but I've also added an alternative pinout as an option; a pinout that's more "true" to the original pinout.

Right now support for these chips are located in an experimental branch of MegaCore, but I need volunteers to help me test it with existing libraries and projects. It's important that all the pins and peripherals are working as they should.

If you have an Arduino Mega (or similar), I'd really appreciate if you would like to test it. The core can be downloaded HERE.

Thanks in advice! :slight_smile:

@hansibull,
Will it support a 2560 with all pins broken out? See #23 here
http://forum.arduino.cc/index.php?topic=455570.15
I have this board working, bootloading under 1.0.6 as that's what I have a working pins_arduino.h set up for. A copy of that is in reply #49.
Have not tried serial downloads under later versions of IDE, with boards manager and all that stuff. Only basic blink of all pins so far.

Will it support a 2560 with all pins broken out?

Yes, if you use the alternative pinout, all pins are used.

Just curious, why are you still stuck with IDE 1.0.x? Since 1.6.5r5 the IDE have been rock stable, great new features and better support for 3rd party hardware. What's not to like?

What pin should i use for serial communication?, because atmega128 had 2 rxtx,

And i have an usbasp that support serial com, if i short ICSP MOSI to ICSP TX and ICSP MISO to ICSP RX it will be allright?, because i want to use my usbasp to serial com between atmega128 and pc.

I see atmega128 icsp programming using rx,tx,sck instead of mosi,miso,sck.

And also if i use serial programmer which rxtx should i use?, is it rxtx0 or rxtx1?

And last time i tried IRRemote library with atmega128 and it comes out with error about timer, i use irrecvdemo example code but it still dont work. Can you take a look onto it?

@hansibull. "Just curious, why are you still stuck with IDE 1.0.x?"
I just hadn't moved the all-pins arduino.h breakout to a later version of IDE yet.

What pin should i use for serial communication?, because atmega128 had 2 rxtx,

And i have an usbasp that support serial com, if i short ICSP MOSI to ICSP TX and ICSP MISO to ICSP RX it will be allright?, because i want to use my usbasp to serial com between atmega128 and pc.

I see atmega128 icsp programming using rx,tx,sck instead of mosi,miso,sck.

And also if i use serial programmer which rxtx should i use?, is it rxtx0 or rxtx1?

And last time i tried IRRemote library with atmega128 and it comes out with error about timer, i use irrecvdemo example code but it still dont work. Can you take a look onto it?

the default RX/TX pins are RXD0/TXD1. These pins are shared with PDI and PDO, which is the data in and data out for the AVRISP programmer.

I don't think you can use an usbasp as a USB to serial converter between the ATmega128 and your PC; you'll need a dedicated chip for that, such as and FTDI adapter or similar. The usbasp will only be good for programming using the ISP header, not UART.

hansibull:
the default RX/TX pins are RXD0/TXD1. These pins are shared with PDI and PDO, which is the data in and data out for the AVRISP programmer.

I don't think you can use an usbasp as a USB to serial converter between the ATmega128 and your PC; you'll need a dedicated chip for that, such as and FTDI adapter or similar. The usbasp will only be good for programming using the ISP header, not UART.

Okay, i'm understand.

but you dont answer this :

figoarzaki:
last time i tried IRRemote library with atmega128 and it comes out with error about timer, i use irrecvdemo example code but it still dont work. Can you take a look onto it?

Error message :

Arduino: 1.8.2 (Windows 7), Board: "ATmega128, 2.7v, Disabled (default), 16 MHz external"

In file included from C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:20:0:

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::mark(int)':

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:227:31: error: 'TCCR2A' was not declared in this scope

#define TIMER_ENABLE_PWM (TCCR2A |= _BV(COM2B1))

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:227:3: note: in expansion of macro 'TIMER_ENABLE_PWM'

TIMER_ENABLE_PWM; // Enable pin 3 PWM output

^
C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:227:45: error: 'COM2B1' was not declared in this scope

#define TIMER_ENABLE_PWM (TCCR2A |= _BV(COM2B1))

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:227:3: note: in expansion of macro 'TIMER_ENABLE_PWM'

TIMER_ENABLE_PWM; // Enable pin 3 PWM output

^

In file included from C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:20:0:

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::space(int)':

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:228:31: error: 'TCCR2A' was not declared in this scope

#define TIMER_DISABLE_PWM (TCCR2A &= ~(_BV(COM2B1)))

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:235:3: note: in expansion of macro 'TIMER_DISABLE_PWM'

TIMER_DISABLE_PWM; // Disable pin 3 PWM output

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:228:47: error: 'COM2B1' was not declared in this scope

#define TIMER_DISABLE_PWM (TCCR2A &= ~(_BV(COM2B1)))

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:235:3: note: in expansion of macro 'TIMER_DISABLE_PWM'

TIMER_DISABLE_PWM; // Disable pin 3 PWM output

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::enableIROut(int)':

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:230:31: error: 'TIMSK2' was not declared in this scope

#define TIMER_DISABLE_INTR (TIMSK2 = 0)

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:253:3: note: in expansion of macro 'TIMER_DISABLE_INTR'

TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:234:3: error: 'TCCR2A' was not declared in this scope

TCCR2A = _BV(WGM20); \

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:263:3: note: in expansion of macro 'TIMER_CONFIG_KHZ'

TIMER_CONFIG_KHZ(khz);

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:235:3: error: 'TCCR2B' was not declared in this scope

TCCR2B = _BV(WGM22) | _BV(CS20); \

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:263:3: note: in expansion of macro 'TIMER_CONFIG_KHZ'

TIMER_CONFIG_KHZ(khz);

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:235:16: error: 'WGM22' was not declared in this scope

TCCR2B = _BV(WGM22) | _BV(CS20); \

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:263:3: note: in expansion of macro 'TIMER_CONFIG_KHZ'

TIMER_CONFIG_KHZ(khz);

^

In file included from C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:20:0:

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:236:3: error: 'OCR2A' was not declared in this scope

OCR2A = pwmval; \

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:263:3: note: in expansion of macro 'TIMER_CONFIG_KHZ'

TIMER_CONFIG_KHZ(khz);

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:237:3: error: 'OCR2B' was not declared in this scope

OCR2B = pwmval / 3; \

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:263:3: note: in expansion of macro 'TIMER_CONFIG_KHZ'

TIMER_CONFIG_KHZ(khz);

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp: In member function 'void IRrecv::enableIRIn()':

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:249:3: error: 'TCCR2A' was not declared in this scope

TCCR2A = _BV(WGM21); \

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:279:3: note: in expansion of macro 'TIMER_CONFIG_NORMAL'

TIMER_CONFIG_NORMAL();

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:250:3: error: 'TCCR2B' was not declared in this scope

TCCR2B = _BV(CS21); \

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:279:3: note: in expansion of macro 'TIMER_CONFIG_NORMAL'

TIMER_CONFIG_NORMAL();

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:251:3: error: 'OCR2A' was not declared in this scope

OCR2A = TIMER_COUNT_TOP / 8; \

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:279:3: note: in expansion of macro 'TIMER_CONFIG_NORMAL'

TIMER_CONFIG_NORMAL();

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:229:31: error: 'TIMSK2' was not declared in this scope

#define TIMER_ENABLE_INTR (TIMSK2 = _BV(OCIE2A))

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:282:3: note: in expansion of macro 'TIMER_ENABLE_INTR'

TIMER_ENABLE_INTR;

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:229:44: error: 'OCIE2A' was not declared in this scope

#define TIMER_ENABLE_INTR (TIMSK2 = _BV(OCIE2A))

^

C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:282:3: note: in expansion of macro 'TIMER_ENABLE_INTR'

TIMER_ENABLE_INTR;

^

exit status 1
Error compiling for board ATmega128.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I'll take a look at it this evening :slight_smile: I've been using the IRRemote library on an ATmega128 before, so I know it's possible.