[SOLVED] Arduino Mega 2560 interface problem with Wiznet W5100 Ethernet Shield

Status
Not open for further replies.

dev185

Newbie level 4
Joined
Jun 6, 2015
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
31
Hi all,

I am getting problem with my W5100 Ethernet shield interface with Arduino Mega 2560
I am getting localip address of my shield 255.255.255.255.

I have set the IP address of my shield at 192.168.0.50, gateway at 192.168.0.1,
subnet mask at 255.255.255.0. and used the library method Ethernet.begin(mac,ip,gateway,subnet) and called Serial.println(Ethernet.localipaddress()) method and the output as I mentioned (255.255.255.255)
please help me to sort this problem.

Thanks and regards,

Sayandev

- - - Updated - - -

My Code:-

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <SPI.h>
#include <Ethernet.h>
#include <utility/w5100.h>
 
byte mac[] = { 0x80, 0xA2, 0xDA, 0x01, 0x59, 0x66 };  
byte ip[] = { 192, 168, 0, 7 };    
byte gateway[] = { 192, 168, 0, 157 };
byte subnet[] = { 255, 255, 255, 0 };
 
byte ipBuf[4];
char outBuf[18];
 
void setup()
{
  Serial.begin(9600);
  pinMode(53,OUTPUT);
  digitalWrite(53,1);
  //Ethernet.begin(mac, ip, gateway, subnet);
 W5100.setIPAddress(ip);
 W5100.setSubnetMask(subnet);
 W5100.setGatewayIp(gateway);
  W5100.setMACAddress(mac);
  W5100.getIPAddress(ipBuf);
  //sprintf(outBuf,"%u.%u.%u.%u\r\n",ipBuf[0],ipBuf[1],ipBuf[2],ipBuf[3]);
  //Serial.println(Ethernet.localIP());
   //Serial.println(outBuf);
   Ethernet.begin(mac, ip, gateway, subnet);
  
  delay(1000);
  
}
 
void loop()
{
  Serial.println("Tick");
  delay(1000);
}

 
Last edited by a moderator:

Same ip it is displaying Server at 255.255.255.255 please guide me..
I have used Mega 2560 53 as CS,52 as Sck, 51 MOSI,50 MISO and in W5100 Shield side I have used 10 as CS, 13as CLk, 12 MISO, 11 MOSI.

regards,
Sayandev
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…