Hello,
It’s my first topic in this forum , i hope you will help me to find a solution at my problem.
My problem :
I’ve made a project based on a ATmega328 , but today i need more memory and i’ve decided to use a ATmega2561.
I’ve made all the cores and the pin configuration file. I can compiling without error and i can upload to the atmega2561. The program run well but i’ve a problems with two pin : PE5 and PE6.
PE6 influence without reason the PE5 pin. When the PE6 became Low , the PE5 became high but the problem don’t come from my program. I think it’s the config file.
Can you help me too solve this problem ?
Thx a lot.
mega2561.name=Arduino Mega 2561
mega2561.upload.protocol=wiring
mega2561.upload.maximum_size=258048
mega2561.upload.speed=115200
mega2561.bootloader.low_fuses=0xCF
mega2561.bootloader.high_fuses=0x99
mega2561.bootloader.extended_fuses=0xFF
mega2561.bootloader.path=stk500v2
mega2561.bootloader.file=stk500boot_v2_mega2561.hex
mega2561.bootloader.unlock_bits=0x3F
mega2561.bootloader.lock_bits=0x0F
mega2561.build.mcu=atmega2561
mega2561.build.f_cpu=16000000L
mega2561.build.core=arduino
mega2561.build.variant=mega2561
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
#include <avr/pgmspace.h>
#define NUM_DIGITAL_PINS 54
#define NUM_ANALOG_INPUTS 8
#define analogInputToDigitalPin(p) ((p < 8) ? (p) + 46 : -1)
#define digitalPinHasPWM(p) ( ((p) >= 3 && (p) <= 5) || ((p) >= 12 && (p)<= 15) || ((p) == 45 ) )
static const uint8_t SS = 8;
static const uint8_t SCK = 9;
static const uint8_t MOSI = 10;
static const uint8_t MISO = 11;
static const uint8_t SCL = 16;
static const uint8_t SDA = 17;
static const uint8_t LED_BUILTIN = 13;
static const uint8_t A0 = 46;
static const uint8_t A1 = 47;
static const uint8_t A2 = 48;
static const uint8_t A3 = 49;
static const uint8_t A4 = 50;
static const uint8_t A5 = 51;
static const uint8_t A6 = 52;
static const uint8_t A7 = 53;
/* PCINT PIN DEFINE */
// 8,9,10,11,12,13,14,15 //
#define digitalPinToPCICR(p) ( (((p) >= 8) && ((p) <= 15)) ? (&PCICR) : ((uint8_t *)0) )
#define digitalPinToPCICRbit(p) ( (((p) >= 8) && ((p) <= 15)) ? 0 : 0 )
#define digitalPinToPCMSK(p) ( (((p) >= 8) && ((p) <= 15)) ? (&PCMSK0) : ((uint8_t *)0) )
#define digitalPinToPCMSKbit(p) ( (((p) >= 8) && ((p) <= 15)) ? ((p) - 8) : 0 )
#ifdef ARDUINO_MAIN
const uint16_t PROGMEM port_to_mode_PGM[] = {
NOT_A_PORT,
(uint16_t) &DDRA,
(uint16_t) &DDRB,
(uint16_t) &DDRC,
(uint16_t) &DDRD,
(uint16_t) &DDRE,
(uint16_t) &DDRF,
(uint16_t) &DDRG,
};
const uint16_t PROGMEM port_to_output_PGM[] = {
NOT_A_PORT,
(uint16_t) &PORTA,
(uint16_t) &PORTB,
(uint16_t) &PORTC,
(uint16_t) &PORTD,
(uint16_t) &PORTE,
(uint16_t) &PORTF,
(uint16_t) &PORTG,
};
const uint16_t PROGMEM port_to_input_PGM[] = {
NOT_A_PIN,
(uint16_t) &PINA,
(uint16_t) &PINB,
(uint16_t) &PINC,
(uint16_t) &PIND,
(uint16_t) &PINE,
(uint16_t) &PINF,
(uint16_t) &PING,
};
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
// PORTLIST
// -------------------------------------------
PE , // PE 0 ** 0 ** USART0_RX
PE , // PE 1 ** 1 ** USART0_TX
PE , // PE 2 ** 2 ** D2
PE , // PE 3 ** 3 ** PWM1
PE , // PE 4 ** 4 ** PWM2
PE , // PE 5 ** 5 ** PWM3
PE , // PE 6 ** 6 ** D6
PE , // PE 7 ** 7 ** D7
PB , // PB 0 ** 8 ** SPI_SS
PB , // PB 1 ** 9 ** SPI_SCK
PB , // PB 2 ** 10 ** SPI_MOSI
PB , // PB 3 ** 11 ** SPI_MISO
PB , // PB 4 ** 12 ** PWM4
PB , // PB 5 ** 13 ** PWM5
PB , // PB 6 ** 14 ** PWM6
PB , // PB 7 ** 15 ** PWM7
PD , // PD 0 ** 16 ** I2C_SCL
PD , // PD 1 ** 17 ** I2C_SDA
PD , // PD 2 ** 18 ** USART1_RX
PD , // PD 3 ** 19 ** USART1_TX
PD , // PD 4 ** 20 ** D20
PD , // PD 5 ** 21 ** D21
PD , // PD 6 ** 22 ** D22
PD , // PD 7 ** 23 ** D23
PC , // PC 0 ** 24 ** D24
PC , // PC 1 ** 25 ** D25
PC , // PC 2 ** 26 ** D26
PC , // PC 3 ** 27 ** D27
PC , // PC 4 ** 28 ** D28
PC , // PC 5 ** 29 ** D29
PC , // PC 6 ** 30 ** D30
PC , // PC 7 ** 31 ** D31
PA , // PA 7 ** 32 ** D32
PA , // PA 6 ** 33 ** D33
PA , // PA 5 ** 34 ** D34
PA , // PA 4 ** 35 ** D35
PA , // PA 3 ** 36 ** D36
PA , // PA 2 ** 37 ** D37
PA , // PA 1 ** 38 ** D38
PA , // PA 0 ** 39 ** D39
PG , // PG 0 ** 40 ** D40
PG , // PG 1 ** 41 ** D41
PG , // PG 2 ** 42 ** D42
PG , // PG 3 ** 43 ** D43
PG , // PG 4 ** 44 ** D44
PG , // PG 5 ** 45 ** PWM8
PF , // PF 0 ** 46 ** A0
PF , // PF 1 ** 47 ** A1
PF , // PF 2 ** 48 ** A2
PF , // PF 3 ** 49 ** A3
PF , // PF 4 ** 50 ** A4
PF , // PF 5 ** 51 ** A5
PF , // PF 6 ** 52 ** A6
PF , // PF 7 ** 53 ** A7
};
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
// PIN IN PORT
// -------------------------------------------
_BV( 0 ) , // PE 0 ** 0 ** USART0_RX
_BV( 1 ) , // PE 1 ** 1 ** USART0_TX
_BV( 2 ) , // PE 2 ** 2 ** D2
_BV( 3 ) , // PE 3 ** 3 ** PWM1
_BV( 4 ) , // PE 4 ** 4 ** PWM2
_BV( 5 ) , // PE 5 ** 5 ** PWM3
_BV( 6 ) , // PE 6 ** 6 ** D6
_BV( 7 ) , // PE 7 ** 7 ** D7
_BV( 0 ) , // PB 0 ** 8 ** SPI_SS
_BV( 1 ) , // PB 1 ** 9 ** SPI_SCK
_BV( 2 ) , // PB 2 ** 10 ** SPI_MOSI
_BV( 3 ) , // PB 3 ** 11 ** SPI_MISO
_BV( 4 ) , // PB 4 ** 12 ** PWM4
_BV( 5 ) , // PB 5 ** 13 ** PWM5
_BV( 6 ) , // PB 6 ** 14 ** PWM6
_BV( 7 ) , // PB 7 ** 15 ** PWM7
_BV( 0 ) , // PD 0 ** 16 ** I2C_SCL
_BV( 1 ) , // PD 1 ** 17 ** I2C_SDA
_BV( 2 ) , // PD 2 ** 18 ** USART1_RX
_BV( 3 ) , // PD 3 ** 19 ** USART1_TX
_BV( 4 ) , // PD 4 ** 20 ** D20
_BV( 5 ) , // PD 5 ** 21 ** D21
_BV( 6 ) , // PD 6 ** 22 ** D22
_BV( 7 ) , // PD 7 ** 23 ** D23
_BV( 0 ) , // PC 0 ** 24 ** D24
_BV( 1 ) , // PC 1 ** 25 ** D25
_BV( 2 ) , // PC 2 ** 26 ** D26
_BV( 3 ) , // PC 3 ** 27 ** D27
_BV( 4 ) , // PC 4 ** 28 ** D28
_BV( 5 ) , // PC 5 ** 29 ** D29
_BV( 6 ) , // PC 6 ** 30 ** D30
_BV( 7 ) , // PC 7 ** 31 ** D31
_BV( 7 ) , // PA 7 ** 32 ** D32
_BV( 6 ) , // PA 6 ** 33 ** D33
_BV( 5 ) , // PA 5 ** 34 ** D34
_BV( 4 ) , // PA 4 ** 35 ** D35
_BV( 3 ) , // PA 3 ** 36 ** D36
_BV( 2 ) , // PA 2 ** 37 ** D37
_BV( 1 ) , // PA 1 ** 38 ** D38
_BV( 0 ) , // PA 0 ** 39 ** D39
_BV( 0 ) , // PG 0 ** 40 ** D40
_BV( 1 ) , // PG 1 ** 41 ** D41
_BV( 2 ) , // PG 2 ** 42 ** D42
_BV( 3 ) , // PG 3 ** 43 ** D43
_BV( 4 ) , // PG 4 ** 44 ** D44
_BV( 5 ) , // PG 5 ** 45 ** PWM8
_BV( 0 ) , // PF 0 ** 46 ** A0
_BV( 1 ) , // PF 1 ** 47 ** A1
_BV( 2 ) , // PF 2 ** 48 ** A2
_BV( 3 ) , // PF 3 ** 49 ** A3
_BV( 4 ) , // PF 4 ** 50 ** A4
_BV( 5 ) , // PF 5 ** 51 ** A5
_BV( 6 ) , // PF 6 ** 52 ** A6
_BV( 7 ) , // PF 7 ** 53 ** A7
};
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
// TIMERS
// -------------------------------------------
NOT_ON_TIMER , // PE 0 ** 0 ** USART0_RX
NOT_ON_TIMER , // PE 1 ** 1 ** USART0_TX
NOT_ON_TIMER , // PE 2 ** 2 ** D2
TIMER3A , // PE 3 ** 3 ** PWM1
TIMER3B , // PE 4 ** 4 ** PWM2
TIMER3C , // PE 5 ** 5 ** PWM3
NOT_ON_TIMER , // PE 6 ** 6 ** D6
NOT_ON_TIMER , // PE 7 ** 7 ** D7
NOT_ON_TIMER , // PB 0 ** 8 ** SPI_MISO
NOT_ON_TIMER , // PB 1 ** 9 ** SPI_MOSI
NOT_ON_TIMER , // PB 2 ** 10 ** SPI_SCK
NOT_ON_TIMER , // PB 3 ** 11 ** SPI_SS
TIMER2A , // PB 4 ** 12 ** PWM4
TIMER1A , // PB 5 ** 13 ** PWM5
TIMER1B , // PB 6 ** 14 ** PWM6
TIMER0A , // PB 7 ** 15 ** PWM7
NOT_ON_TIMER , // PD 0 ** 16 ** I2C_SCL
NOT_ON_TIMER , // PD 1 ** 17 ** I2C_SDA
NOT_ON_TIMER , // PD 2 ** 18 ** USART1_RX
NOT_ON_TIMER , // PD 3 ** 19 ** USART1_TX
NOT_ON_TIMER , // PD 4 ** 20 ** D20
NOT_ON_TIMER , // PD 5 ** 21 ** D21
NOT_ON_TIMER , // PD 6 ** 22 ** D22
NOT_ON_TIMER , // PD 7 ** 23 ** D23
NOT_ON_TIMER , // PC 0 ** 24 ** D24
NOT_ON_TIMER , // PC 1 ** 25 ** D25
NOT_ON_TIMER , // PC 2 ** 26 ** D26
NOT_ON_TIMER , // PC 3 ** 27 ** D27
NOT_ON_TIMER , // PC 4 ** 28 ** D28
NOT_ON_TIMER , // PC 5 ** 29 ** D29
NOT_ON_TIMER , // PC 6 ** 30 ** D30
NOT_ON_TIMER , // PC 7 ** 31 ** D31
NOT_ON_TIMER , // PA 7 ** 32 ** D32
NOT_ON_TIMER , // PA 6 ** 33 ** D33
NOT_ON_TIMER , // PA 5 ** 34 ** D34
NOT_ON_TIMER , // PA 4 ** 35 ** D35
NOT_ON_TIMER , // PA 3 ** 36 ** D36
NOT_ON_TIMER , // PA 2 ** 37 ** D37
NOT_ON_TIMER , // PA 1 ** 38 ** D38
NOT_ON_TIMER , // PA 0 ** 39 ** D39
NOT_ON_TIMER , // PG 0 ** 40 ** D40
NOT_ON_TIMER , // PG 1 ** 41 ** D41
NOT_ON_TIMER , // PG 2 ** 42 ** D42
NOT_ON_TIMER , // PG 3 ** 43 ** D43
NOT_ON_TIMER , // PG 4 ** 44 ** D44
TIMER0B , // PG 5 ** 45 ** PWM4
NOT_ON_TIMER , // PF 0 ** 46 ** A0
NOT_ON_TIMER , // PF 1 ** 47 ** A1
NOT_ON_TIMER , // PF 2 ** 48 ** A2
NOT_ON_TIMER , // PF 3 ** 49 ** A3
NOT_ON_TIMER , // PF 4 ** 50 ** A4
NOT_ON_TIMER , // PF 5 ** 51 ** A5
NOT_ON_TIMER , // PF 6 ** 52 ** A6
NOT_ON_TIMER , // PF 7 ** 53 ** A7
};
#endif
#endif