Ethermega pin problems

Combining the power of the ATmega2560 MCU with onboard Ethernet, a microSD card slot, an efficient switchmode power supply, and a small prototyping area. [Product page]
Post Reply
The Doc
Posts: 20
Joined: Fri Jul 12, 2013 10:57 pm

Ethermega pin problems

Post by The Doc » Sat Aug 17, 2013 10:03 am

I'm working towards a project that uses the ethermega as a basis for Ethernet, LCD, RTC, SD card, various digital and analogue inputs and an XBee card. All but the last is from Freetronics.

Most quick start guides and general information relates to pins on other arduino boards and don't seem to match pins on Ethermega, obviously because of different processor and increased number of pins.

I read somewhere that pin 4 is needed for something specific (SD Card or Ethernet) so I redirected LCD from pin 4 to pin D14, changing the appropriate line to LiquidCrystal lcd( 8, 9, 14, 5, 6, 7); LCD works ok.

I installed <DS3232RTC.h> and <SoftI2C.h> as in the quick start guide and advice from a previous post. I moved SCL and SDA from the RTC to from pins A4 and A5 to pins D20 and D21, again because of something I read somewhere else on freetronics. Clock examples Dump and Test RC work with that setup.

BUT - I need to understand how come I can swap an input from an analogue input to a digital input without consequence, and how I can successfully use the line SoftI2C i2c(A4, A5); when nothing is inputting to A4 and A5 but the output shows the input at D20 and D21 is being received.

Is there a sheet anywhere that lists the quirks of the ethermega ? I'm worried that as I get into the Ethernet and SD card routines I'm going to get problems building up.

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: Ethermega pin problems

Post by andrew » Sun Aug 18, 2013 7:42 am

It's not a quirk as such, just the Mega boards are different.
Pin 4 is used on the EtherMega as the SS line for the microSD card socket.

On the ATmega328P microcontrollers used in Arduino Uno, FT Eleven etc. the pins A4/A5 are act as either analogue input or I2C; on the ATmega2560 they're either as you noted. It's just the way Atmel designed them.

The Ethermega is the same as an Arduino Mega2560 except for the addition of microSD and Ethernet (and optional PoE, but this doesn't use I/O pins). Thus digital pins 4 and 10~13 are reserved for Ethernet and microSD.

Post Reply