Community
cancel
Showing results for 
Search instead for 
Did you mean: 
NK
New Contributor I
2,021 Views

Galileo causing problem with arduino ethernet library

I have been trying to use gen2 to send UDp packets to the server using arduino ethernet library.

Firstly, the Ethernet.LocalIP() function returned 255.255.255.255 as the address even though I have entered the ,mac address correctly.

Here's the code:

# include

# include

// Enter a MAC address for your controller below.

// Newer Ethernet shields have a MAC address printed on a sticker on the shield

byte mac[] = {0x98,0x4F,0xEE,0x02,0x0A,0x46};

// Initialize the Ethernet client library

// with the IP address and port of the server

// that you want to connect to (port 80 is default for HTTP):

EthernetClient client;

void setup() {

// start the serial library:

Serial.begin(9600);

// start the Ethernet connection:

if (Ethernet.begin(mac) == 0) {

Serial.println("Failed to configure Ethernet using DHCP");

// no point in carrying on, so do nothing forevermore:

for(;;)

}

// print your local IP address:

Serial.println(Ethernet.localIP());

}

void loop() {

}

Any suggestions or inputs are appreciated

Nathan

Tags (1)
13 Replies
FTinetti
Honored Contributor I
101 Views

Hi Nathan,

The Ethernet library is not listed in the "Supported Arduino Libraries" at http://www.intel.com/content/www/us/en/support/boards-and-kits/intel-galileo-boards/000006446.html Arduino* Release Notes (1.0.0) for Boards and Kits but it can be used, I think.

I've made some experiments in the past, documented at

Please post the image you are using, or the URL at which you downloaded it

Fernando.

Pedro_M_Intel
Employee
101 Views

Hello KS_Nathan,

I believe you are not setting the Ethernet environment correctly on your sketch, for example, you did not set an IP address. Why don't you try with the example included in the Arduino IDE "UDPSendReceiveString" that can be found in Examples>Ethernet (not Ethernet Shield, that's only for when you're using the Ethernet shield but Galileo doesn't need it). Does it work for you? You can take it as an example and modify it to your project's needs.

Peter.

FTinetti
Honored Contributor I
101 Views

Intel_Peter wrote:

...Why don't you try with the example included in the Arduino IDE "UDPSendReceiveString" that can be found in Examples>Ethernet (not Ethernet Shield, that's only for when you're using the Ethernet shield but Galileo doesn't need it). Does it work for you? You can take it as an example and modify it to your project's needs.

 

Peter.

Just curious: did you already try that example?

Fernando.

Pedro_M_Intel
Employee
101 Views

I have not tested that example in specific but I have tested the library successfully using Arduino IDE 1.6.0.

Peter.

FTinetti
Honored Contributor I
101 Views

@KS_Nathan: did you try some example? did you solved the problem?

@Intel_Peter: thank you for your reply. I asked because some examples I tried (not exactly this one) did not work without some "Gallileo adaptation".

Fernando.

NK
New Contributor I
101 Views

Nope it did not work yet.It is still giving me the universal broadcast address.

Have you tried something

FTinetti
Honored Contributor I
101 Views

KS_Nathan wrote:

Nope it did not work yet.It is still giving me the universal broadcast address.

Have you tried something

I have not, I'll post if I get something useful when experimenting.

Fernando.

FTinetti
Honored Contributor I
101 Views

Hi again,

I've tried the example suggested by @Intel_Peter and it did not work just as reported by @KS_Nathan:

a) Interface IP is not set with the value given at Ethernet.begin(mac,ip);

b) Ethernet.localIP() returns the universal broadcast address.

Best regards,

Fernando.

FTinetti
Honored Contributor I
101 Views

Replying to myself just to add that using ifconfig it is possible to set the interface IP but Ethernet.localIP() still returns the universal broadcast address.

HTH,

Fernando.

NK
New Contributor I
101 Views

So is there a way or is it just that the OS problem ?

FTinetti
Honored Contributor I
101 Views

KS_Nathan wrote:

So is there a way or is it just that the OS problem ?

As I posted previously: it is possible to set the interface IP. More specifically, I used

system("ifconfig enp0s20f6:avahi netmask 255.255.0.0 up");

in the setup function of my sketch. Take into account that the interface name (enp0s20f6:avahi in the example) depends on the image you are using, which is the latest egclibc in the example, used in a Galileo Gen 1. You can find the interface name using the ifconfig command. I was able to ping the Galileo (so the Ethernet interface was "up & running"), but I did not check the UDP code of the example. Up to this point, there is no problem at the OS level. Furthermore, since Ethernet.localIP() still returns the universal broadcast address I think there is some problem or missing functionality at the Ethernet library (I think I posted some of this at the link I refer to about in another previous post in this thread: ).

HTH,

Fernando.

NK
New Contributor I
101 Views

I even tried that but still, as you said , It might the problem with the library itself

FTinetti
Honored Contributor I
101 Views

KS_Nathan wrote:

I even tried that but still, as you said , It might the problem with the library itself

Yes, I think so.

Were you able to test the UDP code? I think it might work because the interface is working, and you set the IP via "system(...)", so you do not need Ethernet.localIP().

HTH,

Fernando.

Reply