Coder Social home page Coder Social logo

mcudude / megacore Goto Github PK

View Code? Open in Web Editor NEW
374.0 374.0 115.0 29.13 MB

Arduino hardware package for ATmega64, ATmega128, ATmega165, ATmega169, ATmega325, ATmega329, ATmega640, ATmega645, ATmega649, ATmega1280, ATmega1281, ATmega2560, ATmega2561, ATmega3250, ATmega3290, ATmega6450, ATmega6490, AT90CAN32, AT90CAN64 and AT90CAN128

License: Other

Makefile 6.66% C 39.72% Shell 16.80% C++ 36.36% Batchfile 0.01% Assembly 0.46%
arduino at90can128 at90can32 at90can64 atmega128 atmega1280 atmega1281 atmega165 atmega169 atmega2560 atmega2561 atmega325 atmega329 atmega64 atmega640 atmega645 atmega649 avr boards-manager

megacore's People

Contributors

chepo92 avatar dewhisna avatar jackjan4 avatar mcudude avatar per1234 avatar spencekonde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

megacore's Issues

Can't allow INT for WD

Hello,

Cant allow int for WD timer.

WDTCR |= _BV(WDIE);

compilator says:'WDIE' was not declared in this scope.

On atmega328 its working: WDTCSR |= _BV(WDIE);

Help me please...

Error on compiling bootloader with -DBIGBOOT

make atmega128
avr-gcc (GCC) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

BAUD RATE CHECK: Desired: 115200, Real: 117647, UBRRL = 16, Error=2.1%
avr-gcc -g -Wall -Os -fno-split-wide-types -mrelax -mmcu=atmega128 -DF_CPU=16000000L -DBAUD_RATE=115200 -DLED_START_FLASHES=3 -DBIGBOOT -c -o optiboot_flash.o optiboot_flash.c
optiboot_flash.c:311:2: warning: #warning BAUD_RATE error greater than 2% [-Wcpp]
#warning BAUD_RATE error greater than 2%
^
optiboot_flash.c: In function ‘main’:
optiboot_flash.c:502:93: warning: backslash and newline separated by space
#if defined(AVR_ATmega8515) || defined(AVR_ATmega8535) || defined(AVR_ATmega16) \
^
avr-gcc -g -Wall -Os -fno-split-wide-types -mrelax -mmcu=atmega128 -DF_CPU=16000000L -DBAUD_RATE=115200 -DLED_START_FLASHES=3 -DBIGBOOT -Wl,--section-start=.text=0x1fc00 -Wl,--section-start=.version=0x1fffe -Wl,--relax -nostartfiles -nostdlib -o atmega128/optiboot_flash_atmega128__.elf optiboot_flash.o -lc
optiboot_flash.o: In function appStart': /home/drw/Software/builder/MegaCore/avr/bootloaders/optiboot_flash/optiboot_flash.c:942: undefined reference to eeprom_write_byte'
/home/drw/Software/builder/MegaCore/avr/bootloaders/optiboot_flash/optiboot_flash.c:942: undefined reference to `eeprom_read_byte'
collect2: error: ld returned 1 exit status
Makefile:614: recipe for target 'atmega128/optiboot_flash_atmega128__.elf' failed
make: *** [atmega128/optiboot_flash_atmega128__.elf] Error 1

Bootloader boot time faster than expected

This is more a question than a problem.

I previously used MightyCore with Atmega324 and 16MHz external oscillator. After burning bootloader, LED flashed twice per second as per readme. Time taken by bootloader between reset and start of program execution was 1.5s (consistent with an Arduino).

Now I am using MegaCore with Atmega64A and 16MHz external oscillator. After burning the bootloader, I saw the LED flash much faster and (I think) it was not regular. Bootloader works OK, programs loaded via serial run OK and millis() based timing is correct.

However, I have measured how long the bootloader takes between reset and start of program. It is much shorter, under 240ms.

Is this an expected difference between MegaCore and MightCore?

Thanks

I2C pind don't match Datasheet

Hi I've only looked at your arduino pin map for the 64 pin avr. I've noticed that the pins for the I2C communication don't match the data sheet.

MegaCore/avr/variants/64-pin-avr/pins_arduino.h

lines 79 & 80

static const uint8_t SDA = 18;
static const uint8_t SCL = 19;

i think should read

static const uint8_t SDA = 19;
static const uint8_t SCL = 18;

verification error; content mismatch

Gives this error when uploading codes using arduino IDE with USBASP, and when PORTE is used in the code, the code will not upload at all. but It uploads fine using the hex file generated in arduino IDE directly via avrdude.

avrdude: verifying ... avrdude: verification error, first mismatch at byte 0x0100 0xff != 0x20 avrdude: verification error; content mismatch

bad.txt
good.txt

Compile problem

I just installed Arduino 1.6.4 IDE (on WinXP) and MegaCore. I selected Board: "ATmega128", Clock: "16MHz external", Port: "COM1" and am using Programmer: "USBasp" (I already successfully installed the bootloader.).

When trying to compile the "BareMinimum" example the respective compile fails:

'ld.exe has encountered a problem and needs to close. ...'

last console message is:

'N:\Program Files\ArduinoWindows\arduino-1.6.4\hardware\tools\avr/bin/avr-ar rcs n:\Temp\build8835498005943340668.tmp/core.a n:\Temp\build8835498005943340668.tmp\WString.cpp.o
N:\Program Files\ArduinoWindows\arduino-1.6.4\hardware\tools\avr/bin/avr-gcc -w -Os -Wl,--gc-sections -mmcu=atmega128 -o n:\Temp\build8835498005943340668.tmp/BareMinimum.cpp.elf n:\Temp\build8835498005943340668.tmp\BareMinimum.cpp.o n:\Temp\build8835498005943340668.tmp/core.a -Ln:\Temp\build8835498005943340668.tmp -lm
collect2.exe: error: ld returned 5 exit status
Error compiling.'

However other examples like "AnalogReadSerial" do successfully compile. I don't know if the compile problem only affects the empty "BareMinimum" example or if the underlying root cause might also surface in other cases.

Verification error after loading code by Serial

Hi! I'm building my project on Atmega128 chip using your bootloader. Bootloader was load properly by USBASP and I even can see it in FLASH through Avrdude terminal mode from address 0xFC00 (as I remember). Then I faced an issue during loading my program by Serial through USB-UART (CH340 chip). It seems that Arduino IDE connects to Atmega and I see Avrdude writing progress bars but then it fails on verification step:

avrdude: verification error, first mismatch at byte 0x0000
0xff != 0x0c
avrdude: verification error; content mismatch

It seems that my sketch code was not recorded to Atmega... If I loading the code through programmer by ICSP - it works well.
Here is the Avrdude log:

/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/dmitrij/Library/Arduino15/packages/MegaCore/hardware/avr/2.0.0/avrdude.conf -v -patmega128 -carduino -P/dev/cu.wchusbserial1420 -b115200 -D -Uflash:w:/var/folders/18/60_7xyc92138x6vhc69t25zc0000gn/T/arduino_build_113404/Blink.ino.hex:i

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:01:35
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "/Users/dmitrij/Library/Arduino15/packages/MegaCore/hardware/avr/2.0.0/avrdude.conf"
     User configuration file is "/Users/dmitrij/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : /dev/cu.wchusbserial1420
     Using Programmer              : arduino
     Overriding Baud Rate          : 115200
     AVR Part                      : ATmega128
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PA0
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom         4    12    64    0 no       4096    8      0  9000  9000 0xff 0xff
       flash         33     6   128    0 yes    131072  256    512  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : Arduino
     Description     : Arduino
     Hardware Version: 3
     Firmware Version: 6.2
     Vtarget         : 0.3 V
     Varef           : 0.3 V
     Oscillator      : 28.800 kHz
     SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9702 (probably m128)
avrdude: reading input file "/var/folders/18/60_7xyc92138x6vhc69t25zc0000gn/T/arduino_build_113404/Blink.ino.hex"
avrdude: writing flash (1240 bytes):

Writing | ################################################## | 100% 0.34s

avrdude: 1240 bytes of flash written
avrdude: verifying flash memory against /var/folders/18/60_7xyc92138x6vhc69t25zc0000gn/T/arduino_build_113404/Blink.ino.hex:
avrdude: load data flash data from input file /var/folders/18/60_7xyc92138x6vhc69t25zc0000gn/T/arduino_build_113404/Blink.ino.hex:
avrdude: input file /var/folders/18/60_7xyc92138x6vhc69t25zc0000gn/T/arduino_build_113404/Blink.ino.hex contains 1240 bytes
avrdude: reading on-chip flash data:

Reading | ########################################Произошла ошибка при загрузке скетча
########## | 100% 0.34s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0xff != 0x0c
avrdude: verification error; content mismatch

avrdude done. Thank you.

Do you have any thoughts on it?

How about full atmega640,1280,2560 support?

I know that two of these are 'supported' as the arduino mega board. However, this board ignores over a dozen i/o pins, and there is no support for the atmega640 part. It should be easy enough to add an i/o map that enables full use of all pins on these parts, and to add support for the '640 variant.

I'll look into this myself eventually, but thought I'd mention it incase someone else wants to pick up this gauntlet.

Problems with intrrupts on atmega128

Hi
Firstly Thank you for you hardwork supplying this repository to everyone.

Im having problems compiling GRBL for the ATmega128. and I am wondering if you can help.

I can compile GRBL on ATmega2561, ATmega128, ATmega2560, Atmega1280 and ATmega640 but when I try to compile it on the ATmega128 (and on the ATmega64) I keep getting the same error.

I'm using GRBL1.1f (https://github.com/gnea/grbl) but I have also tried using a few other versions. I'm using arduino 1.8.1 on windows 10 and arduino 1.8.3 on Linux mint and keep getting the same error.

I think the issue is relating to the intrrupt in the core rather than the GRBL software. I've spent several days now googling for and trying to get an answer but still to no luck.

Any help would be greatfully receaved. Thank you

The output from the arduino IDE is:

In file included from C:\Users\X\Documents\Arduino\libraries\grbl\grbl.h:47:0,
from C:\Users\X\Documents\Arduino\libraries\grbl\limits.c:22:
C:\Users\X\Documents\Arduino\libraries\grbl\limits.c: In function 'limits_init':
C:\Users\X\Documents\Arduino\libraries\grbl\cpu_map.h:73:28: error: 'PCMSK0' undeclared (first use in this function)
#define LIMIT_PCMSK PCMSK0 // Pin change interrupt register
^
C:\Users\X\Documents\Arduino\libraries\grbl\limits.c:44:5: note: in expansion of macro 'LIMIT_PCMSK'
LIMIT_PCMSK |= LIMIT_MASK; // Enable specific pins of the Pin Change Interrupt
^
C:\Users\X\Documents\Arduino\libraries\grbl\cpu_map.h:73:28: note: each undeclared identifier is reported only once for each function it appears in
#define LIMIT_PCMSK PCMSK0 // Pin change interrupt register
^
C:\Users\X\Documents\Arduino\libraries\grbl\limits.c:44:5: note: in expansion of macro 'LIMIT_PCMSK'
LIMIT_PCMSK |= LIMIT_MASK; // Enable specific pins of the Pin Change Interrupt
^
C:\Users\X\Documents\Arduino\libraries\grbl\limits.c:45:5: error: 'PCICR' undeclared (first use in this function)
PCICR |= (1 << LIMIT_INT); // Enable Pin Change Interrupt
^
In file included from C:\Users\X\Documents\Arduino\libraries\grbl\grbl.h:47:0,
from C:\Users\X\Documents\Arduino\libraries\grbl\limits.c:22:
C:\Users\X\Documents\Arduino\libraries\grbl\cpu_map.h:71:28: error: 'PCIE0' undeclared (first use in this function)
#define LIMIT_INT PCIE0 // Pin change interrupt enable pin
^
C:\Users\X\Documents\Arduino\libraries\grbl\limits.c:45:20: note: in expansion of macro 'LIMIT_INT'
PCICR |= (1 << LIMIT_INT); // Enable Pin Change Interrupt
^
C:\Users\X\Documents\Arduino\libraries\grbl\limits.c: In function 'limits_disable':
C:\Users\X\Documents\Arduino\libraries\grbl\cpu_map.h:73:28: error: 'PCMSK0' undeclared (first use in this function)
#define LIMIT_PCMSK PCMSK0 // Pin change interrupt register
^
C:\Users\X\Documents\Arduino\libraries\grbl\limits.c:61:3: note: in expansion of macro 'LIMIT_PCMSK'
LIMIT_PCMSK &= ~LIMIT_MASK; // Disable specific pins of the Pin Change Interrupt
^
C:\Users\X\Documents\Arduino\libraries\grbl\limits.c:62:3: error: 'PCICR' undeclared (first use in this function)
PCICR &= ~(1 << LIMIT_INT); // Disable Pin Change Interrupt
^
In file included from C:\Users\X\Documents\Arduino\libraries\grbl\grbl.h:47:0,
from C:\Users\X\Documents\Arduino\libraries\grbl\limits.c:22:
C:\Users\X\Documents\Arduino\libraries\grbl\cpu_map.h:71:28: error: 'PCIE0' undeclared (first use in this function)
#define LIMIT_INT PCIE0 // Pin change interrupt enable pin
^
C:\Users\X\Documents\Arduino\libraries\grbl\limits.c:62:19: note: in expansion of macro 'LIMIT_INT'
PCICR &= ~(1 << LIMIT_INT); // Disable Pin Change Interrupt
^
exit status 1
Error compiling for board ATmega128.

Unable to see any output in the Serial monitor

Hi,
I have been able to successfully burn the boot loader onto Atmega128 and then upload sketch to it as well.
Sketch works, as one would expect it to.
I am using USBTinyISP as the programmer.
But when I try to check the serial output, I am unable to.

(It's possible I am missing something here, Serial doesn't go really with ISP, no TX, RX pins there ).

Thanks.

analogReference(EXTERNAL)

analogReference(EXTERNAL);

However, the "EXTERNAL" is not what we understand the external reference voltage, but AVCC.
My circuit uses an external reference voltage, and it is so set, but I found that my reference voltage is wrong, but I can not find my circuit and components have any problems, this problem plagued me a long time, and finally found The result of this setting is to connect the AVCC to the VREF Pin, so there will be such a problem.

image

Also, the reference voltage on the Mega128 DataSheet is set such that the REFS register is set to "11" to be the internal reference, but it is "10" in your file, but it also seems to work properly.

I recommend:
     DEFAULT -> AVCC
     INTERNAL -> Internal 2.56V Voltage Reference
     EXTERNAL -> True external connection for reference voltage
Do you see if this is feasible?

Power-on Reset isn't working.?

As you know i am working on a project for elite sports for which i am using Atmega2560V and megaCore bootloaders..

while developing, I have observed that Power-on Reset isn't working, I have to manually pull reset pin to low to reset the Atmega2560V.

I am powering up chip with a single cell LIPO battery which is supplied then to 3.3V power booster and voltage regulator, I am using this boardhttps://www.sparkfun.com/products/retired/11231

Macro errors with IRLib2

Not sure if this is an error in IRLib2's ifdefs or in the MegaCore support but when trying to even include in the library for the ATmega64a I run into these errors. I've gone through the IRLibe2 code and checked around for ifdefs that optionally include code for specific avr chips but didn't see anything that didn't have an else block that would skip including these. The define macros listed here all seem to be part of the Arduino framework so I'm confused as to why they wouldn't be included.

In file included from /Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:14:0:
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp: In member function 'void IRsendBase::enableIROut(uint8_t)':
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibHardware.h:286:34: error: 'TIMSK2' was not declared in this scope
  #define IR_RECV_DISABLE_INTR   (TIMSK2 = 0)
                                  ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:77:2: note: in expansion of macro 'IR_RECV_DISABLE_INTR'
  IR_RECV_DISABLE_INTR; //Timer2 Overflow Interrupt    
  ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibHardware.h:193:3: error: 'TCCR2A' was not declared in this scope
   TCCR2A = _BV(WGM20);  TCCR2B = _BV(WGM22) | _BV(CS20); \
   ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:80:2: note: in expansion of macro 'IR_SEND_CONFIG_KHZ'
  IR_SEND_CONFIG_KHZ(khz);
  ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibHardware.h:193:25: error: 'TCCR2B' was not declared in this scope
   TCCR2A = _BV(WGM20);  TCCR2B = _BV(WGM22) | _BV(CS20); \
                         ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:80:2: note: in expansion of macro 'IR_SEND_CONFIG_KHZ'
  IR_SEND_CONFIG_KHZ(khz);
  ^
In file included from /Users/joe/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/avr/include/avr/io.h:99:0,
                 from /Users/joe/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/avr/include/avr/pgmspace.h:90,
                 from /Users/joe/Documents/Arduino/hardware/MegaCore/avr/cores/MegaCore/Arduino.h:28,
                 from /Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibProtocols.h:12,
                 from /Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.h:16,
                 from /Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:13:
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibHardware.h:193:38: error: 'WGM22' was not declared in this scope
   TCCR2A = _BV(WGM20);  TCCR2B = _BV(WGM22) | _BV(CS20); \
                                      ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:80:2: note: in expansion of macro 'IR_SEND_CONFIG_KHZ'
  IR_SEND_CONFIG_KHZ(khz);
  ^
In file included from /Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:14:0:
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibHardware.h:194:3: error: 'OCR2A' was not declared in this scope
   OCR2A = pwmval; OCR2B = pwmval / 3; })
   ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:80:2: note: in expansion of macro 'IR_SEND_CONFIG_KHZ'
  IR_SEND_CONFIG_KHZ(khz);
  ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibHardware.h:194:19: error: 'OCR2B' was not declared in this scope
   OCR2A = pwmval; OCR2B = pwmval / 3; })
                   ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:80:2: note: in expansion of macro 'IR_SEND_CONFIG_KHZ'
  IR_SEND_CONFIG_KHZ(khz);
  ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp: In member function 'void IRsendBase::mark(uint16_t)':
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibHardware.h:188:33: error: 'TCCR2A' was not declared in this scope
  #define IR_SEND_PWM_START     (TCCR2A |= _BV(COM2B1))
                                 ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:95:2: note: in expansion of macro 'IR_SEND_PWM_START'
  IR_SEND_PWM_START;
  ^
In file included from /Users/joe/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/avr/include/avr/io.h:99:0,
                 from /Users/joe/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/avr/include/avr/pgmspace.h:90,
                 from /Users/joe/Documents/Arduino/hardware/MegaCore/avr/cores/MegaCore/Arduino.h:28,
                 from /Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibProtocols.h:12,
                 from /Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.h:16,
                 from /Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:13:
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibHardware.h:188:47: error: 'COM2B1' was not declared in this scope
  #define IR_SEND_PWM_START     (TCCR2A |= _BV(COM2B1))
                                               ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:95:2: note: in expansion of macro 'IR_SEND_PWM_START'
  IR_SEND_PWM_START;
  ^
In file included from /Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:14:0:
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp: In member function 'void IRsendBase::space(uint16_t)':
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibHardware.h:190:31: error: 'TCCR2A' was not declared in this scope
  #define IR_SEND_PWM_STOP    (TCCR2A &= ~(_BV(COM2B1)))
                               ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:101:2: note: in expansion of macro 'IR_SEND_PWM_STOP'
  IR_SEND_PWM_STOP;
  ^
In file included from /Users/joe/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/avr/include/avr/io.h:99:0,
                 from /Users/joe/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/avr/include/avr/pgmspace.h:90,
                 from /Users/joe/Documents/Arduino/hardware/MegaCore/avr/cores/MegaCore/Arduino.h:28,
                 from /Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibProtocols.h:12,
                 from /Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.h:16,
                 from /Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:13:
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibHardware.h:190:47: error: 'COM2B1' was not declared in this scope
  #define IR_SEND_PWM_STOP    (TCCR2A &= ~(_BV(COM2B1)))
                                               ^
/Users/joe/Documents/Arduino/libraries/IRLibProtocols/IRLibSendBase.cpp:101:2: note: in expansion of macro 'IR_SEND_PWM_STOP'
  IR_SEND_PWM_STOP;
  ^
Using library LiquidCrystal at version 1.0.5 in folder: /Applications/Arduino.app/Contents/Java/libraries/LiquidCrystal 
Using library EEPROM at version 2.0 in folder: /Users/joe/Documents/Arduino/hardware/MegaCore/avr/libraries/EEPROM 
Using library IRLibRecvPCI in folder: /Users/joe/Documents/Arduino/libraries/IRLibRecvPCI (legacy)
Using library IRLib2 in folder: /Users/joe/Documents/Arduino/libraries/IRLib2 (legacy)
Using library IRLibProtocols in folder: /Users/joe/Documents/Arduino/libraries/IRLibProtocols (legacy)
exit status 1
Error compiling for board ATmega64.

Facing problems in uploading bootloader to Atmega128A

{{ I already opened a thread at https://forum.arduino.cc/index.php?topic=425844.0 but then realized this might be the better place... }}

Hi,
I followed the exact circuit as noted https://camo.githubusercontent.com/b6046ccf5b261d6accdf030c2158ddb119f898d8/687474703a2f2f692e696d6775722e636f6d2f5549696e6f38492e706e67

But I get errors (or simply time out) while uploading.
I tried uploading the bootloader using a genuine Arduino Uno as SPI programmer. And just to experiment, I tried uploading bootloader using a USB to TTL serial connection.

No luck so far.

Is there any specific programmer that is known to work? There are conflicting notes on USBTiny. Seems it is better than USBasp but only works for Atmega64... Or I am just reading too much and not putting things in correct order?

Any inputs will be greatly appreciated.

Thanks.

standard pin mapping

I want to use an ATmega128 as an upgrade for my existing ProMini328 based circuit and am trying to get the respective pin mapping right (so as to reuse my existing code with minimal changes): According to your pinout graph I am inclined to think that PF4 corresponds to Arduino analog A4 but the graph also suggests that the hardware SDA pin is PD1 - my existing Arduino ProMini code expects that A4 and SDA is actually the same pin. (similarilly there is a mismatch between the SS,SCK,MOSI,MISO pins and the standard Arduino digital pin assignment, e.g. MOSI=D11 not D10). Finally, what pins are the Arduino digital pins 2-7 mapped to: PE2-PE7?

Thanks for your help

Timers of Atmega128

I have a new problem.
I try to use TimerOne lib.
It's perfectly working with Atmega328 (as SnoozeLib). But I have a next Errors on MegaCore:
"was not declared in this scope" for regiters TIMSK1, GTCCR and for PSRSYNC.
If I change TIMSK1->TIMSK - it accepted by compiler. (but I understand that it is no right way).

My goal is to use your sleep() and noSlip() with timer interrupt and hardware interrupt for wakeUp of CPU.
Help me please what I have todo for it.

or may be You can to recommend some onother sleep/timer library what will compitable with MegaCore.

Thanks so much.

TIMER1_A_PIN and TIMSK1 not declared in this scope

I make DMD sketch with #include DMD.h, TimerOne.h, SPI.h, Wire.h, RTClib.h and DHT.h, but the error messages appears.
What should I do ?

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

In file included from C:\Users\myfolder\Documents\Arduino\Dot Matrix\test128\test128.ino:10:0:
C:\Users\myfolder\Documents\Arduino\libraries\TimerOne-master/TimerOne.h: In member function 'void TimerOne::setPwmDuty(char, unsigned int)':
C:\Users\myfolder\Documents\Arduino\libraries\TimerOne-master/TimerOne.h:236:13: error: 'TIMER1_A_PIN' was not declared in this scope
if (pin == TIMER1_A_PIN) OCR1A = dutyCycle;
^
C:\Users\myfolder\Documents\Arduino\libraries\TimerOne-master/TimerOne.h: In member function 'void TimerOne::pwm(char, unsigned int)':
C:\Users\myfolder\Documents\Arduino\libraries\TimerOne-master/TimerOne.h:245:13: error: 'TIMER1_A_PIN' was not declared in this scope
if (pin == TIMER1_A_PIN) { pinMode(TIMER1_A_PIN, OUTPUT); TCCR1A |= _BV(COM1A1); }
^
C:\Users\myfolder\Documents\Arduino\libraries\TimerOne-master/TimerOne.h: In member function 'void TimerOne::disablePwm(char)':
C:\Users\myfolder\Documents\Arduino\libraries\TimerOne-master/TimerOne.h:260:13: error: 'TIMER1_A_PIN' was not declared in this scope
if (pin == TIMER1_A_PIN) TCCR1A &= ~_BV(COM1A1);
^
C:\Users\myfolder\Documents\Arduino\libraries\TimerOne-master/TimerOne.h: In member function 'void TimerOne::attachInterrupt(void (*)())':
C:\Users\myfolder\Documents\Arduino\libraries\TimerOne-master/TimerOne.h:274:2: error: 'TIMSK1' was not declared in this scope
TIMSK1 = _BV(TOIE1); //atmega128 only TIMSK
^
C:\Users\myfolder\Documents\Arduino\libraries\TimerOne-master/TimerOne.h: In member function 'void TimerOne::detachInterrupt()':
C:\Users\myfolder\Documents\Arduino\libraries\TimerOne-master/TimerOne.h:281:2: error: 'TIMSK1' was not declared in this scope
TIMSK1 = 0; //atmega128 only TIMSK
^
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.

out of range address 0x200000

hi everyone i try to upload the bootloader on atmega64, i make the minimal board with 16Mhz cristal, an external 5v power supply, modify the fuses on board.txt to up to 4k space for bootloader and use an arduino uno as isp, but when try to upload i have this issue..

avrdude: ERROR: address 0x20000 out of range at line 40 of C:\Users.......10/bootloaders/optiboot/atmega64/optiboot_atmega64_16MHz.hex

someone can help to me please? thanks

verification error, first mismatch at byte 0x3fc00

Hello there,
I am trying to burn bootloaders to my Atmega2560V-8AU but came up with this error, what is this suppose to be.? how to solve this one .

Arduino: 1.6.13 (Mac OS X), Board: "ATmega2560, Arduino MEGA pinout, 2.7v, Disabled (default), 8 MHz internal"

/Users/mudassir/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino8/bin/avrdude -C/Users/mudassir/Documents/Arduino/hardware/MegaCore-avr-100-pin 2/avr/avrdude.conf -v -patmega2560 -cstk500v1 -P/dev/cu.usbmodem1421 -b19200 -e -Ulock:w:0x3f:m -Uefuse:w:0xfd:m -Uhfuse:w:0xd6:m -Ulfuse:w:0xe2:m

avrdude: Version 6.3, compiled on Dec 16 2016 at 13:32:25
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "/Users/mudassir/Documents/Arduino/hardware/MegaCore-avr-100-pin 2/avr/avrdude.conf"
     User configuration file is "/Users/mudassir/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : /dev/cu.usbmodem1421
     Using Programmer              : stk500v1
     Overriding Baud Rate          : 19200
     AVR Part                      : ATmega2560
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PA0
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
       flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
       lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : STK500
     Description     : Atmel STK500 Version 1.x firmware
     Hardware Version: 2
     Firmware Version: 1.18
     Topcard         : Unknown
     Vtarget         : 0.0 V
     Varef           : 0.0 V
     Oscillator      : Off
     SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: erasing chip
avrdude: reading input file "0x3f"
avrdude: writing lock (1 bytes):

/Users/mudassir/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino8/bin/avrdude -C/Users/mudassir/Documents/Arduino/hardware/MegaCore-avr-100-pin 2/avr/avrdude.conf -v -patmega2560 -cstk500v1 -P/dev/cu.usbmodem1421 -b19200 -Uflash:w:/Users/mudassir/Documents/Arduino/hardware/MegaCore-avr-100-pin 2/avr/bootloaders/optiboot_flash/atmega2560/optiboot_flash_atmega2560_38400_8000000L.hex:i -Ulock:w:0x0f:m

avrdude: Version 6.3, compiled on Dec 16 2016 at 13:32:25
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "/Users/mudassir/Documents/Arduino/hardware/MegaCore-avr-100-pin 2/avr/avrdude.conf"
     User configuration file is "/Users/mudassir/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : /dev/cu.usbmodem1421
     Using Programmer              : stk500v1
     Overriding Baud Rate          : 19200

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3f:
avrdude: load data lock data from input file 0x3f:
avrdude: input file 0x3f contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xfd"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xfd:
avrdude: load data efuse data from input file 0xfd:
avrdude: input file 0xfd contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xd6"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xd6:
avrdude: load data hfuse data from input file 0xd6:
avrdude: input file 0xd6 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xe2"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xe2:
avrdude: load data lfuse data from input file 0xe2:
avrdude: input file 0xe2 contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done. Thank you.

     AVR Part                      : ATmega2560
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PA0
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
       flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
       lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : STK500
     Description     : Atmel STK500 Version 1.x firmware
     Hardware Version: 2
     Firmware Version: 1.18
     Topcard         : Unknown
     Vtarget         : 0.0 V
     Varef           : 0.0 V
     Oscillator      : Off
     SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "/Users/mudassir/Documents/Arduino/hardware/MegaCore-avr-100-pin 2/avr/bootloaders/optiboot_flash/atmega2560/optiboot_flash_atmega2560_38400_8000000L.hex"
avrdude: writing flash (262144 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 262144 bytes of flash written
avrdude: verifying flash memory against /Users/mudassir/Documents/Arduino/hardware/MegaCore-avr-100-pin 2/avr/bootloaders/optiboot_flash/atmega2560/optiboot_flash_atmega2560_38400_8000000L.hex:
avrdude: load data flash data from input file /Users/mudassir/Documents/Arduino/hardware/MegaCore-avr-100-pin 2/avr/bootloaders/optiboot_flash/atmega2560/optiboot_flash_atmega2560_38400_8000000L.hex:
avrdude: input file /Users/mudassir/Documents/Arduino/hardware/MegaCore-avr-100-pin 2/avr/bootloaders/optiboot_flash/atmega2560/optiboot_flash_atmega2560_38400_8000000L.hex contains 262144 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x3fc00
0x00 != 0x01
avrdude: verification error; content mismatch

avrdude done. Thank you.

Error while burning bootloader.

1 Byte of Lock verified..

Hello sorry to disturb you again, I was trying to boot load my another Atmega2560V, supplied 1Mhz to the XTAL1 and used -F to override the signature check, Now I can upload bootloaders to the chip.

But the output shows 1Byte of Lock verified.

Here is the complete output.

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -F -CC:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-master\avr/avrdude.conf -v -patmega2560 -cstk500v1 -PCOM4 -b19200 -e -Ulock:w:0x3f:m -Uefuse:w:0xfd:m -Uhfuse:w:0xd6:m -Ulfuse:w:0xe2:m

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "C:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-master\avr/avrdude.conf"

     Using Port                    : COM4
     Using Programmer              : stk500v1
     Overriding Baud Rate          : 19200
     AVR Part                      : ATmega2560
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PA0
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
       flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
       lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : STK500
     Description     : Atmel STK500 Version 1.x firmware
     Hardware Version: 2
     Firmware Version: 1.18
     Topcard         : Unknown
     Vtarget         : 0.0 V
     Varef           : 0.0 V
     Oscillator      : Off
     SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9803
avrdude: Expected signature for ATmega2560 is 1E 98 01
avrdude: erasing chip
avrdude: reading input file "0x3f"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3f:
avrdude: load data lock data from input file 0x3f:
avrdude: input file 0x3f contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xfd"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xfd:
avrdude: load data efuse data from input file 0xfd:
avrdude: input file 0xfd contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xd6"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xd6:
avrdude: load data hfuse data from input file 0xd6:
avrdude: input file 0xd6 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xe2"
avrdude: writing lfuse (1 bytes):

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -F -CC:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-master\avr/avrdude.conf -v -patmega2560 -cstk500v1 -PCOM4 -b19200 -Uflash:w:C:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-master\avr/bootloaders/optiboot_flash/atmega2560/optiboot_flash_atmega2560_38400_8000000L.hex:i -Ulock:w:0x0f:m
Writing | ################################################## | 100% 0.03s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xe2:
avrdude: load data lfuse data from input file 0xe2:
avrdude: input file 0xe2 contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done. Thank you.

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "C:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-master\avr/avrdude.conf"

     Using Port                    : COM4
     Using Programmer              : stk500v1
     Overriding Baud Rate          : 19200
     AVR Part                      : ATmega2560
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PA0
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
       flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
       lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : STK500
     Description     : Atmel STK500 Version 1.x firmware
     Hardware Version: 2
     Firmware Version: 1.18
     Topcard         : Unknown
     Vtarget         : 0.0 V
     Varef           : 0.0 V
     Oscillator      : Off
     SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9803
avrdude: Expected signature for ATmega2560 is 1E 98 01
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-master\avr/bootloaders/optiboot_flash/atmega2560/optiboot_flash_atmega2560_38400_8000000L.hex"
avrdude: writing flash (262144 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 262144 bytes of flash written
avrdude: verifying flash memory against C:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-master\avr/bootloaders/optiboot_flash/atmega2560/optiboot_flash_atmega2560_38400_8000000L.hex:
avrdude: load data flash data from input file C:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-master\avr/bootloaders/optiboot_flash/atmega2560/optiboot_flash_atmega2560_38400_8000000L.hex:
avrdude: input file C:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-master\avr/bootloaders/optiboot_flash/atmega2560/optiboot_flash_atmega2560_38400_8000000L.hex contains 262144 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% -0.00s

avrdude: verifying ...
avrdude: 262144 bytes of flash verified
avrdude: reading input file "0x0f"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x0f:
avrdude: load data lock data from input file 0x0f:
avrdude: input file 0x0f contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified

avrdude done. Thank you.

I am really sorry to disturb you again.

I hope you reply.

Thank you

Is ATMegaS128 supported?

Will I be able to use the MegaCORE in Arduino IDE for the ATMegaS128? Noob here, worried about ATMegaS128 running off 3.3V instead of ATMega128's 5.0V. I intend to attach a 8MHz with your MegaCORE minimal setup wiring. Thanks for the help! Pls delete this thread if i posted in the wrong place.

Atmega2560V, trying to burn bootloaders

Hello,
I am trying to burn MegaCore bootloaders to it, I have setup my custom PCB with Atmega2560V-8AU and 8Mhz Crystal + Load Caps all assembled on using PCBA process.
I am trying to burn MegaCore bootloaders to it, I am using Arduino UNO as ISP Programmer. My connections are all correct, It shows different Device Signatures (see below) whenever I hit Burn Bootloaders....

0x0000ff
0x00003f
0x0000ff
0x00ff00
0x001000
0xff0000
0xfc0000
0x00fe00

This is complete output with different Device Signatures

Arduino: 1.8.3 (Windows 10), Board: "ATmega2560, Arduino MEGA pinout, 2.7v, Disabled (default), 8 MHz external"

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-avr-100-pin\avr/avrdude.conf -v -patmega2560 -cstk500v1 -PCOM4 -b19200 -e -Ulock:w:0x3f:m -Uefuse:w:0xfd:m -Uhfuse:w:0xd6:m -Ulfuse:w:0xf7:m

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "C:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-avr-100-pin\avr/avrdude.conf"

     Using Port                    : COM4
     Using Programmer              : stk500v1
     Overriding Baud Rate          : 19200
     AVR Part                      : ATmega2560
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PA0
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
       flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
       lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : STK500
     Description     : Atmel STK500 Version 1.x firmware
     Hardware Version: 2
     Firmware Version: 1.18
     Topcard         : Unknown
     Vtarget         : 0.0 V
     Varef           : 0.0 V
     Oscillator      : Off
     SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Error while burning bootloader.
Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x00fe00
avrdude: Expected signature for ATmega2560 is 1E 98 01
Double check chip, or use -F to override this check.

avrdude done. Thank you.

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

What should be the problem.??? How to solve this.?

Eclipse

I just tried to use the MegaCore in http://eclipse.baeyens.it/ but it seems that either the respective Eclipse plugin just sucks or there is some incompatibility/problem with the MegaCore.

At first it seems as if the Eclipse/Arduino plugin correctly detects the MegaCore config. It presents the right processor selection and generates a respective "ATmega128" project. Unfortunately the generated "Includes" list is incomplete and it only contains the "core" and "variant" folders but none of the standard includes that SHOULD also be in that list.

Any ideas if this might rather be caused by the MegaCore config or by the Eclipse plugin?

Incorrect prescaler values in Tone.cpp

Hi, first of of all, thank you for providing this software and instruction, after quite a bit of searching and frustration it has helped me to get my ATmega128 board to run with Arduino.

I realize tone() is not on your list of supported functions, but just in case anyone tries, here's what I've found. In file Tone.cpp, lines 267 ff. the timer prescaler value is determined. Now, on ATmega128, only timer 0 has prescalers 32 and 128, while the other three timers have only 1/8/64/256/1024 (see datasheet).
So the code needs to be rewritten, in particular:

  • Remove distinction between 8- and 16-bit timers (line 268), following code should work for both.
  • Lines 277 and 288 should be changed to if (_timer == 0... to account for the additional values.
  • The values in the conditional expressions in lines 286, 297 and 302 are switched around.

I've tried this with timer 2 (which is assigned by default) and the toneMelody example works as expected (it didn't before). Making the above changes may break the code for other processors (I've no idea how many different prescalers exist), so a general solution would require a bit of research in the datasheets.

Thanks and best regards
Wolfgang

Interrupts

Use the rfm69. Also a problem with interrupts. I have used pin4. Put the number of interrupts 4, but transfer no. What could be the problem?

#define RFM69_CS 8
#define RFM69_IRQ 4 //pin
#define RFM69_IRQN 4// ?

RFM69 radio = RFM69(RFM69_CS, RFM69_IRQ, true, RFM69_IRQN);

Checked! Only works 6 interrupt! Why? What am I doing wrong? How to use pin 4?

digitalPinToInterrupt() issue

see pins_arduino.h:
#define digitalPinToInterrupt(p) (((p) >= 4 && (p) <= 7) ? (p) : ((p) >= 18 && (p) <= 21) ? (p) - 18 : NOT_AN_INTERRUPT)

shouldn't it rather be:

#define digitalPinToInterrupt(p) (((p) >= 3 && (p) <= 6) ? (p+1) : ((p) >= 18 && (p) <= 21) ? (p) - 18 : NOT_AN_INTERRUPT)

error in "MegaCore minimal setup" graph

From what I see VCC pins are 52+21 and GND pins are 53+22. The two 100nF capacitor related comments therefore refer to the wrong pins, e.g. "Place as close to pin 20 and 21 as possible" should read "Place as close to pin 21 and 22 as possible", etc,_

Consider merging avr-100-pin branch into master

I've been working with the ATmega648/1280/2560 implementation for a while now, and other improvements like subtrees for the bootloader and core files have also been added. I'm sure the avr-100-pinbrach still contains some bugs, but I'll have to merge it into the master branch in order to get it properly tested. I think it's a good idea to wait with a boards manager release until the dust have settled and (potentially) ugly bugs have been squashed.

@per1234 if you want to create a PR to avr-100-pin and add Travis to MegaCore, I'd happily merge that. Now that this core is getting more and more complex in terms of dependencies, incorporating Travis seems to be a good idea. Any thoughts?

rfm69

Connected rfm69 using the library https://github.com/LowPowerLab/RFM69
The problem with the definition of Interrupt. pin 4 is what is the interrupt number?

#define RFM69_CS 8
#define RFM69_IRQ 4 //pin
#define RFM69_IRQN 4// ?

RFM69 radio = RFM69(RFM69_CS, RFM69_IRQ, true, RFM69_IRQN);

Default Cristal 16Mhz

If you choose, 16Mhz to ATMEGA64 Arduino IDE, looks that is wrong, because on PROTEUS a delay of 1000 is too short! delay(1000);

Installation of MegaCore

I wanted to do the manual install of the avr-100-pin branch but I don't have a ~/Documents/Arduino directory.

I do have:

~/.arduino
~/.arduino15/packages/arduino/hardware/
~/.arduino-create/

Any suggestions?

Thanks,
Bob

Wrong high-fuses

I think that the high-fuses have an incorrect value (0xc6) for ATmega128 in file boards.txt. Correct value is 0xc4, because the bootloader is downloaded to address 0xfc00.

SPI question

what is the reason for the "strange" interrupt mask mapping?
#elif defined(EICRA) && defined(EICRB) && defined(EIMSK)
#define SPI_INT0_MASK (1<<INT4)
#define SPI_INT1_MASK (1<<INT5)
#define SPI_INT2_MASK (1<<INT0)
#define SPI_INT3_MASK (1<<INT1)
#define SPI_INT4_MASK (1<<INT2)
#define SPI_INT5_MASK (1<<INT3)
#define SPI_INT6_MASK (1<<INT6)
#define SPI_INT7_MASK (1<<INT7)

Old ATmega128 board blinky doesn't work on arduino compile

Hi,

I have this weird problem, when i compile a simple blinky program using Arduino and Megacore Atmega128. I can't get the LED to blink at all, however, a simple C program compiled in avr-gcc will make it blink. Here is my Arduino code.

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(PORTB0, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(PORTB0, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(PORTB0, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

and here is my c code.

/*

  • $Id: hw.c,v 1.1 2010/10/19 05:18:47 bsd Exp $

*/

/*

  • HW - Hello World
  • This is a very simple project designed only to familiarize oneself
  • with the use of a Makefile, the compiler, linker, and FLASH
  • download tool (such as AVRDUDE) when working with the MAVRIC /
  • MAVRIC-II board.
  • This program simply blinks the on-board LED on and off, once per
  • second. It demonstrates setting up a periodic timer interrupt as a
  • time keeping source, the use of declaring and using an interrupt
  • handler with AVR-GCC, and toggling a PORT output line.
  • See: http://www.bdmicro.com/
  • Configuration:
  • MAVRIC - ensure that DIPSW 9 is "on".
  • MAVRIC-II - ensure that jumper LEDEN is installed
  • */

#include <avr/io.h>
#include <avr/interrupt.h>

#include <inttypes.h>

volatile uint16_t ms_count;

/*

  • ms_sleep() - delay for specified number of milliseconds
    */
    void ms_sleep(uint16_t ms)
    {
    TCNT0 = 0;
    ms_count = 0;
    while (ms_count != ms)
    ;
    }

/*

  • millisecond counter interrupt vector
    */
    SIGNAL(TIMER0_COMP_vect)
    {
    ms_count++;
    }

/*

  • initialize timer 0 to generate an interrupt every millisecond.
    /
    void init_timer(void)
    {
    /
    • Initialize timer0 to generate an output compare interrupt, and
    • set the output compare register so that we get that interrupt
    • every millisecond.
      /
      TIFR |= _BV(OCIE0);
      TCCR0 = _BV(WGM01)|_BV(CS02)|_BV(CS00); /
      CTC, prescale = 128 /
      TCNT0 = 0;
      TIMSK |= _BV(OCIE0); /
      enable output compare interrupt /
      OCR0 = 125; /
      match in 1 ms */
      }

int main(void)
{
init_timer();

/* enable interrupts */
sei();

DDRB = 0x01; /* enable PORTB 1 as an output */

while (1) {
ms_sleep(512); /* wait 0.5 seconds /
PORTB ^= 0x01; /
toggle LED */
}

}

What do I need to change in the MegaCore for this old board that will compile the code and execute the code correctly?

I am using avrdude + usbasp to upload the code in both instances.

Sketch destroing Bootloader.

Dear Sirs,

Thanks for great Job.
But I have one problem.
I using UNO as ISP for burning Bootloader. All works great.
But After first uploading of any sketch by USB-adapter(FTDI) - I have no more bootloader on Atmega128.
I use ARDUINO_USB_LIGHT - adapter. I have cap. 0.1 beetween RESETS (adapter-atmega). For my projects on Atmega328 - a have't this problems.
How I can resolve this situation?

Hope on Your help.
Thanks.

delay() function

When I call delay(100000UL) function it waits only 1 second.
_delay_ms() function does not have problem.
This issue is not tested in real hardware enviroment, it occurs in Proteus simulation.

Verification Error on Burning Bootloader

Hi.
I'm getting following Error on burning bootloader using arduino ide:
avrdude: verifying ... avrdude: verification error, first mismatch at byte 0xfd00 0xff != 0x09 avrdude: verification error; content mismatch

I get this error on both Atmega64a and Atmega128a using any clock config and any programmer.

building bootstraps fail for branch 100-pin

I tried executing ./makeall on optiboot_flash_256kb directory and got the following output:
errors.txt

I tried building a single bootstrap with just "make atmega2561" selecting the defaults. Which seems to woirk:
avr-gcc (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

BAUD RATE CHECK: Desired: 115200, Real: 117647, UBRRL = 16, Error=2.1%
avr-gcc -g -Wall -Os -fno-split-wide-types -mrelax -mmcu=atmega2561 -DF_CPU=16000000L -DBAUD_RATE=115200 -DLED_START_FLASHES=3 -DBIGBOOT -c -o optiboot_flash.o optiboot_flash.c
optiboot_flash.c:288:6: warning: #warning BAUD_RATE error greater than 2% [-Wcpp]
#warning BAUD_RATE error greater than 2%
^
avr-gcc -g -Wall -Os -fno-split-wide-types -mrelax -mmcu=atmega2561 -DF_CPU=16000000L -DBAUD_RATE=115200 -DLED_START_FLASHES=3 -DBIGBOOT -Wl,--section-start=.text=0x3fc00 -Wl,--section-start=.version=0x3fffe -Wl,--relax -nostartfiles -nostdlib -o atmega2561/optiboot_flash_atmega2561__.elf optiboot_flash.o -lc
avr-size atmega2561/optiboot_flash_atmega2561__.elf
text data bss dec hex filename
666 0 0 666 29a atmega2561/optiboot_flash_atmega2561__.elf
avr-objcopy -j .text -j .data -j .version --set-section-flags .version=alloc,load -O ihex atmega2561/optiboot_flash_atmega2561__.elf atmega2561/optiboot_flash_atmega2561__.hex
avr-objdump -h -S atmega2561/optiboot_flash_atmega2561__.elf > atmega2561

But produces truncated files:

optiboot_flash_atmega2561__.hex.txt
optiboot_flash_atmega2561__.lst.txt

I had arduino version 1.6.9 installed, but building inside of the hardware directory where magacore was installed issuing a which avr-gcc gives /usr/bin/avr-gcc, whch may be a ubuntu package.

Blink_using_Timer example not updated?

Hi, I just ran into the incorrect bit value assignment in this example, which you fixed sometime in November. However, I only installed Arduino a few days ago, and the problem is still there. Is it possible that the fix somehow didn't make it from github to the automatic installation?

Regards, Wolfgang

Interrupt not working

Have some code that I prototyped on an Arduino Uno and Mega2560. It works fine on those platforms but when I move the code over it doesn't work. The issue is that an interrupt attached to pin 4 never fires.

The hardware is setup to pull the pin high and pressing a button will bring it low. I've verified this is actually happening by attaching an oscilloscope and checking the waveform. I'm also able to switch the code to do a digitalRead instead and that works correctly, it's only the interrupt that doesn't fire. The relevant code is:

#define TRIGGER_PIN 4

pinMode(TRIGGER_PIN, INPUT);
attachInterrupt(digitalPinToInterrupt(TRIGGER_PIN), triggerPress, LOW);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.