Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Announcements
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9880 Discussions

Galileo Gen 2 Arduino Ethernet problem

JJord1
Novice
1,396 Views

Hi,

I am trying to run the basic Web client example in the Arduino IDE but I am having some problems. I have adapted it to claim a fixed IP as I don't have a DHCP server on the network.

# include

# include

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress server(192, 168, 15, 64);

IPAddress ip(192, 168, 15, 177);

IPAddress dnServer(8, 8, 8, 8);

IPAddress gateway(192, 168, 15, 1);

IPAddress subnet(255, 255, 255, 0);

EthernetClient client;

void setup() {

Serial.begin(9600);

Serial.print("ip - ");

Serial.println(ip);

Ethernet.begin(mac, ip, dnServer, gateway, subnet);

delay(1000);

Serial.println(Ethernet.localIP());

Serial.println("connecting...");

if (client.connect("www.google.com", 80)) {

Serial.println("connected");

client.println("GET /search?q=arduino HTTP/1.1");

client.println("Host: www.google.com");

client.println("Connection: close");

client.println();

}

else {

// if you didn't get a connection to the server:

Serial.println("connection failed");

}

}

// the loop function runs over and over again forever

void loop() {

if (client.available()) {

char c = client.read();

Serial.print(c);

}

if (!client.connected()) {

Serial.println();

Serial.println("disconnecting.");

client.stop();

for(;;)

;

}

}

This is what I see as a result:

ip - 192.168. 15.177 

255.255.255.255

 

connecting...

 

connection failed

 

 

disconnecting.

I have tried some workarounds found in forums (interface up, disable de SD card) but nothing worked.

What I am doing wrong?

Thanks

0 Kudos
1 Solution
FTinetti
Honored Contributor I
173 Views

Hi Blasi,

Take a look to comments and exaamples at

HTH,

Fernando.

View solution in original post

2 Replies
FTinetti
Honored Contributor I
174 Views

Hi Blasi,

Take a look to comments and exaamples at

HTH,

Fernando.

JJord1
Novice
173 Views

The solution was to change Interface name. The actual commands to be run are these ones:

system("ifconfig enp0s20f6 down ");

system("ip link set enp0s20f6 name eth0");

system("ifconfig eth0 up");

Thanks.

Reply