Go Down

Topic: MegaCore - Arduino support for ATmega64/128/1281/2561 and ATmega640/1280/2560 (Read 5993 times) previous topic - next topic

hansibull

Great news! Support for ATmega1281 and ATmega2561 is now added to MegaCore Make sure to check it out :)
MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore


hansibull

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! :)
MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore

CrossRoads

@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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

hansibull

Quote
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?
MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore

figoarzaki

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?

CrossRoads

@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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

hansibull

Quote
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.
MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore

figoarzaki

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 :

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.

hansibull

I'll take a look at it this evening :) I've been using the IRRemote library on an ATmega128 before, so I know it's possible.
MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore

hansibull

In order to get the IRremote library to work, you'll have to manually download and install the library. You can get it from here. Click the green "clone or download" button.
MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore

figoarzaki

Thanks, it's work for my both microcontroller (Atmega32 and Atmega128)
and thanks for quick reply!!

but the size is so big on compile!, 10kb!

hansibull

Quote
but the size is so big on compile!, 10kb!
Yep that's true, but it's not my fault. It's the way the library is designed ;)
MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore

curtzan

Hi!How to configure TV-out library to use with MegaCore (ATmega128)? Is it possible?

hansibull

Hi!How to configure TV-out library to use with MegaCore (ATmega128)? Is it possible?
If you need library support, you'll have to create an issue over at the TV-out Github repo.
MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore

Go Up