Pages: [1]   Go Down
Author Topic: Please explain:SPI uses pin 11->13 on the uno and pins 50->52 on the Mega  (Read 860 times)
0 Members and 1 Guest are viewing this topic.
Belgium
Offline Offline
Edison Member
*
Karma: 68
Posts: 1916
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
I'm not an electronics engineer and as such I completely fail to understand the statement: "Arduino communicates with the shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega." found on this page http://arduino.cc/en/Reference/Ethernet
I mean pins 50 to 52 are not connected to the shield. So how can these pins be used by the shield?
Does this mean I can not use pins 50, 51, and 52 of the mega when I use SPI?
As pins 11, 12 and 13 on the mega are PWM pins are pins 50 51 and 52 PWM pins? (as to the documentation not) http://arduino.cc/en/Main/ArduinoBoardMega2560
if pins 11, 12 and 13 are PWM pins and replaced by 50, 51 and 52 do I lose the PWM functionality?

I searched the forum but I didn't find an answer I could understand, I guess I miss some basic information to get to understand this.
Anyone willing to fill the gap?
Best regards
Jantje
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 610
Posts: 49016
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I completely fail to understand the statement
It is not really necessary to understand it. It is a fact that you must respect. Like Ohms law or gravity.

Quote
I mean pins 50 to 52 are not connected to the shield. So how can these pins be used by the shield?
Not directly, but indirectly, through the ICSP header, they are.

Quote
Does this mean I can not use pins 50, 51, and 52 of the mega when I use SPI?
You are using them. For SPI. You can't also use them for other purposes.

Quote
As pins 11, 12 and 13 on the mega are PWM pins are pins 50 51 and 52 PWM pins?
No.

Quote
if pins 11, 12 and 13 are PWM pins and replaced by 50, 51 and 52 do I lose the PWM functionality?
I don't understand the possible cause and effect you have outlined here. The ethernet shield on the Mega does not use pins 11 to 13. Therefore, there is no loss of PWM functionality.
Logged

Southern California
Offline Offline
God Member
*****
Karma: 5
Posts: 539
I like blinky lights
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Jantje,

I was confused by this when I started out as well, hopefully this will help.

The CPU chips that the Arduino (ATMega328) and Mega (ATMega2560) support SPI in the hardware itself. The SPI library just accesses this hardware.

For whatever reason, on the basic chip the SPI pins are on 11-13, but on the Mega they're on 50-52. It was probably a tough decision for the Arduino team to move the physical pins on the Mega so shields that use SPI would work with both boards, but my guess is they went with keeping the pins in the same order so programming is easier.

I ran into this problem myself; I had a regular Ethernet board and couldn't get it to work with the Mega. After wasting a couple of days I came across this web page

http://mcukits.com/2009/04/06/arduino-ethernet-shield-mega-hack/

which explains it better than I can.

I hope this helps, good luck!

Chris
« Last Edit: December 19, 2011, 07:03:41 pm by Chris Magagna » Logged

http://en.wiktionary.org/wiki/magagna <-- My last name.  Pretty apt.

Belgium
Offline Offline
Edison Member
*
Karma: 68
Posts: 1916
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Chris, Paul
Thanks for the quick reply.
With the link to the old way from Chris and the answers to my questions from Paul It all makes sense now.
I never really understood what these extra SPI pins were for. I guess I understand that now  smiley-lol
As I see it now: On the uno pins 11,12 and 13 are connected to the SPI pins
on the mega pins 50, 51, 52 are connected to the SI pins.
The newer version of the Ethernet shield ( the one not needing the hack) uses the SPI pins and does not directly connect to pins 11, 12 and 13.
Therefore: if I use a mega with an Ethernet shield only pin 1O is in use. I can use the pins 11,12 and 13 for something else. smiley-lol
If this is true I may not need the PCB on which I have been working for more than a week now.  smiley-eek

Best regards
Jantje
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 610
Posts: 49016
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If this is true
It is.
Logged

Pages: [1]   Go Up
Jump to: