Go Down

Topic: Uno <> Mega 2560 shield interchangability (Read 764 times) previous topic - next topic

Nick_Pyner

Feb 15, 2013, 06:03 am Last Edit: Feb 15, 2013, 06:06 am by Nick_Pyner Reason: 1
Inspired by Nantonos's

http://arduino.cc/forum/index.php/topic,125908.0.html#msg946731

and Nick Gammon's

http://arduino.cc/forum/index.php/topic,84190.0.html#msg630702

pictures that I recently stumbled across, I submit the combi below. Use, abuse, and/or feedback is welcome.

I now believe I have fallen into a trap for the unwary. This was not helped by reading somewhere that the 6 pin ICSP cluster isn't much use to ordinary users and might as well be cut off. I suspect that this advice might be OK if you stick with Unos but not a good idea if you Use Megas and could be a very bad idea if you use both.

Now, I'm not sure what is going on with the SPI bus. This is because the potential problem is not self-evident.

By way of example, the gear I am using is

UNO

1. Etherten, this includes on-board Ethernet and on-board SD card - no choice, and no doubts.

MEGA 2560

1. Plain vanilla Mega board

2. Ethernet + SD shield, this has a socket for the ICSP cluster

COMMON to BOTH

1. Home brewed shield with Nokia 5110 display with MOSI on pin 11 and CLK on pin 13.

2. Philips 5110 library with pin assignments edited by me.

Both Arduinos work, but I believe not in the way intended, I have made the wrong assumptions about interchangability, and I have misunderstood the importance of the ICSP six-pin cluster. I can't check this but I believe

1. The Ethernet shield uses the ICSP cluster and pins 11,12,13 thereon are merely pass through. This implies that it can be used with Uno or Mega 2560.

I assume having a common CE pin for both Ethernet and SD is not down to luck, they are standardised, and no change to the libraries was required.

2. When my display shield is used on the Mega, it is no longer on the SPI bus. It is simply using pins 11,13 as assigned by the library.

I'm not if it will be a problem for me, but bad research is something that might be regretted later, and it might have been better to have flying leads for the SPI bus, in the same manner as I have for the I2C pins.

Any comments? I'm happy to edit/remove the picture if needed.

CrossRoads

You could add some jumpers on the Mega to connect pins 50-51-52-53 to pins 10-11-12-13 (SCK-MISO-MOSI-SS, in the correct order) and change the Mega code to have 10-11-12-13 defined as unused input pins.
Both parts will have the SPI library otherwise use the their correct hardware pins for SPI.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Nick_Pyner

Yes, I might solder in some flying leads - if I get a problem. I raise this matter because others may plan better in advance.

Nick Gammon

I haven't checked all the Mega pins, but fundamentally you are right. The SPI header on both boards can be used for SPI (including chip programming) but the individual pins differ, which is why some shields use the SPI header. As you note, the SPI slave select is not brought out to the SPI header, but that can be any pin provided the hardware SS pin is set to be an output.

More recent Uno boards have done a similar thing with the I2C interface (having the I2C pins duplicated next to AREF).

Go Up