Pages: [1]   Go Down
Author Topic: Arduino Mega 2560 with Ethernet Shield with PoE  (Read 1089 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello.

I'm using the Ethernet Shield with PoE (A000075) with the Arduino Mega 2560 Rev03 (A000067) with the arduino 1.0 IDE. The shield fits exactly to the board, but I can't connect to the server neither to the sd card. The shield works fine with an Uno.
I've already read the topics for rewirering the ICSP-Pins from 10-13 to 50-53, but I also found in the SD2PinMap.h which is included within the compilation of the files with th sd library.
Almost at the beginning, there is a defined part for the AVR_MEGA_2560, in which the correct pins are chosen:
// SPI port
uint8_t const SS_PIN = 53;
uint8_t const MOSI_PIN = 51;
uint8_t const MISO_PIN = 50;
uint8_t const SCK_PIN = 52;

At the end for default:
// SPI port
uint8_t const SS_PIN = 10;
uint8_t const MOSI_PIN = 11;
uint8_t const MISO_PIN = 12;
uint8_t const SCK_PIN = 13;

How can I use the already defined section to properly use of the sd card slot?

THX
Paddi

Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5851
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You don't need to rewire anything for those new devices. The SPI data lines are on the ICSP connector. Digital pins 11-13 are not connected to anything on the shield.

Digital pin 10 is the w5100 SS pin, and digital pin 4 is the SD SS pin.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I know that fact,
but the sd card don't work with the mega, but with the uno. When I upload the data to the uno, the terminal comes ith the correct answers.
When I replug the shield to the mega and upload the data to the mega, the initialization fails always.

I've read sometimes that I have to change the wirering to the ICSP.
But I haven't found anything for the IDE 1.0

Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5851
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a Mega and an ethernet shield. I use the SD card also, and it works. Have you tried disabling the w5100 SPI before initializing the SD card? That is where it is failing for you, correct?

Code:
void setup()
{
   Serial.begin(9600);

   pinMode(10,OUTPUT);
   digitalWrite(10,HIGH);

   // you are failing here?
   if(SD.begin(4) == 0)
   {
      Serial.println("SD fail");
   }
   else
   {
      Serial.println("SD ok");
   }

   Ethernet.begin(mac,ip);
   digitalWrite(10,HIGH);

   // rest of the setup
}

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I think so.

Where can I change / disable the w5100?
I've used the sd examples for general testing the new ethernet shield.

THX
paddi
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5851
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is in the code above. That is why I posted it for you.  smiley

This disables the w5100 SPI so it will not interfere with the SD.begin(4) function.
Code:
   pinMode(10,OUTPUT);
   digitalWrite(10,HIGH);
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry for silly answer.

I haven't seen the difference directly.

Many thanks, works fine.

Question:
In this way, the digital pin 10 is not more working, that's right?
And why is the digital output connected with the chip lane 5x?
And does it have any cross connections with the ethernet controller chip?
« Last Edit: March 18, 2012, 03:49:39 pm by paddi » Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5851
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When you disable the w5100 SPI, it is only temporary. That allows the SD SPI to initialize the SD card.

The SD.begin(4) function returns with its SPI disabled (pin 4 HIGH), so nothing needs to be done on the function return.

The Ethernet.begin(mac,ip) function will activate its SPI to set up the w5100, and then returns with its SPI enabled (pin 10 LOW), so you need to set digital pin 10 HIGH again after the Ethernet.begin() function.

At this point, the low level read/write functions of each library control these SS pins, so it is not necessary for you to do it.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot.
Logged

Pages: [1]   Go Up
Jump to: