Go Down

Topic: Arduino Mega and Slave Select Quick Question :D? (Read 950 times) previous topic - next topic

ahref

Hello,

Can any of the digital pins on the Mega be used for Slave Select. i see 53 listed on the page.

Im coming from an UNO background where i've used 8,9 and 10 as SS and would like to keep it that way but just wanted to check that there were no restrictions when hoping over to a mega.

The only reason I ask is i've had to relocate the other SPI pins MOSI etc over to the 5x mega equivelants. :(


SurferTim

You can use other pins for slave selects. I use D10 for the w5100 part of the ethernet shield, and D4 for the SD part.

The other pins cannot be moved if you use the hardware SPI.

retrolefty

Yes you can use other pins for the slave select function. However it may seem a quirky thing but for the SPI hardware and library to function correctly pin 10 on a Uno and pin 53 must still be set to be an output pin, even if you are not using the pin as your slave select pin.

Lefty

ahref

Fantastic, Does anyone know the logic as to why the SPI pins were moved in the mega.

I'm guessing it was the layout of the pins on the actual microcontroller combined with its size that made it hard to get them back to their old places ?

The statement on its product page about most UNO shields being compatible was misleading :'(

retrolefty


Fantastic, Does anyone know the logic as to why the SPI pins were moved in the mega.

I'm guessing it was the layout of the pins on the actual microcontroller combined with its size that made it hard to get them back to their old places ?

The statement on its product page about most UNO shields being compatible was misleading :'(


Not only is the SPI signals on different pins for the Uno Vs mega boards, but also the I2C clock and data signals are on different pins. This does make shield compatibility a challenge for shield builders and is probably the reason that so many shields are Uno compatible only without wiring modification or jumper clip options built onto the shield. The new arduino ARM based board, the Due will make shield compatibility even more difficult in the future.

Lefty


SurferTim

Adding to Lefty:
...and the Leonardo. It has the SPI data lines on the ICSP connector only. The ICSP connector is the key to SPI compatibility. It is what makes a device Mega/Leonardo compatible. Without it, you must jumper or you are DOOMED!!

ahref

That's a shame, I'm wondering if an adapter style shield would be possible? Similar to the go between sheild but more hard traced. It would move the SPI traces back to their original position along with perhaps the ic2 pins and perhaps bring one of the hardware UARTS to pins 2 and 3 seeing as every shield and their dog use them as a software serial(GPS,Cellular etc). I could even then shift the digital pins that are now present in the old SPI places over to the new SPI places so they are not lost.

What do you think?

SurferTim

You should not have a problem with that. Use the ICSP connector for universal compatibility, and run those to D11-D13 like the Uno. Use a proto shield between the two boards to route the traces.

retrolefty


That's a shame, I'm wondering if an adapter style shield would be possible? Similar to the go between sheild but more hard traced. It would move the SPI traces back to their original position along with perhaps the ic2 pins and perhaps bring one of the hardware UARTS to pins 2 and 3 seeing as every shield and their dog use them as a software serial(GPS,Cellular etc). I could even then shift the digital pins that are now present in the old SPI places over to the new SPI places so they are not lost.

What do you think?


It would add another level of complexity to the already abstracted arduino pin concept and would probably be difficult for beginners to set up correctly and not be a cheap add on I bet. In concept it could be made to work I suspect but the arduino platform is already getting so complex and splintered in my opinion with supporting so many different board types now with basic hardware differences that I fear it's losing a lot of it's beginners user friendliness that it once had. Oh well that is the price of progress and choices I guess.  ;)

Lefty

ahref

Fantastic for the support. Using a protoboard might be tricky though especially for the top row of digital pins :'(. I'll see if an autotracer for a PCB can handle the crazyness that is that row D:

SurferTim

Here is a proto shield you could set up to do that. It has the ICSP connector included. How convenient!  :)
http://www.nkcelectronics.com/MEGAshield-KIT-for-Arduino-MEGA-2560-R3-and-Arduino-DUE_p_309.html

ahref

Oh wow that looks like it'll work i'll find a uk supplies and get on it.

Looks like i'll need a spool of wire too :D.

Go Up