8 Replies Latest reply on May 24, 2015 2:14 AM by ericLeongZc

    Galileo Ethernet WebClient

    aodhgan

      hello,

       

      I am trying to get the WebClient arduino example sketch running on a Galileo (below). The sketch uploads fine but is resulting in nothing at all being displayed in the serial monitor. I have only changed the MAC address which I interpreted to be "  0x98, 0x4F, 0xEE, 0x00, 0x90, 0xAF " from the sticker label "984FEE0090AF" on the ethernet connection port. The LAN is DHCP enabled.

       

      The other sketch I have tried is the DhcpAddressPrinter sketch but this has the same issue of returning nothing on the serial monitor.

       

      Can anyone help me with this issue.

       

      Thanks.

       

       

      #include <SPI.h>

      #include <Ethernet.h>

       

       

      // 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, 0x00, 0x90, 0xAF };

      IPAddress server(173,194,33,104); // Google

       

       

      // 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() {

      // Open serial communications and wait for port to open:

        Serial.begin(9600);

         while (!Serial) {

          ; // wait for serial port to connect. Needed for Leonardo only

        }

       

       

        // 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(;;)

            ;

        }

        // give the Ethernet shield a second to initialize:

        delay(1000);

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

       

       

        // if you get a connection, report back via serial:

        if (client.connect(server, 80)) {

          Serial.println("connected");

          // Make a HTTP request:

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

          client.println();

        }

        else {

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

          Serial.println("connection failed");

        }

      }

       

       

      void loop()

      {

        // if there are incoming bytes available

        // from the server, read them and print them:

        if (client.available()) {

          char c = client.read();

          Serial.print(c);

        }

       

       

        // if the server's disconnected, stop the client:

        if (!client.connected()) {

          Serial.println();

          Serial.println("disconnecting.");

          client.stop();

       

       

          // do nothing forevermore:

          for(;;)

            ;

        }

      }

        • 1. Re: Galileo Ethernet WebClient
          JPMontero_Intel

          Hi aodhgan

           

          The Ethernet WebClient example sketch works. Remember to make sure you are using the right serial port and as board you are selecting the Galileo Board, not Galileo Gen 2.

           

          Regards,
          JPMontero_Intel

          • 2. Re: Galileo Ethernet WebClient
            aodhgan

            Hello JP,

             

            Can you confirm that this is the correct "translation" of the sticker to the MAC address?

             

            The sketch is in fact not working. The correct board and port are selected as is the baud rate. 

             

            Does the galileo need linux firmware or otherwise installed via the micro sd card slot before the ethernet port is operational?

             

            I have gotten the blink sketch and other sketches to work correctly on this board.

             

            Thanks.

            • 3. Re: Re: Galileo Ethernet WebClient
              flummer

              Hi aodhgan,

               

              I have just tried a few things, and it looks like the wired ethernet isn't brought up during boot, when you run the Galileo board from the built-in flash (I have tested with firmware version 1.0.2).

               

              If I boot the board, and upload the WebClient sketch, I get the following in the terminal window in the Arduino Environment (In theory the window should be opened very quickly, since the code will only try once, but it seems like the output is being cached/buffered so the timing isn't that important. I'm testing this on Mac OS/X):

               

              connecting...
              connection failed
              
              disconnecting.
              

               

              If I login via the serial console (RS232 jack) and bring up eth0 (using command ifup eth0) and upload the sketch aging, it works and I get the output from the Google search including some headers.

               

              When doing the same with the SD card image and booting from that, it seems that eth0 is brought up during boot and when uploading the WebClient sketch, it works without doing anything via the serial console (RS232 jack).

               

              I don't know if it's intentionally on the SPI flash image, or I'm doing something weird, but if you add in the following in the beginning of the setup() routine in the sketch to bring up the wired ethernet connection, it works for me without an SD card and without the need to login via RS232 serial console:

               

                system("ifup eth0");
                delay(5000);
              

               

              The delay() is just to give it a little time for dhcp before continuing.

               

              I hope it helps!

               

              /Thomas

              • 4. Re: Galileo Ethernet WebClient
                ccordero

                Morning.

                 

                I confirm flummer's post. Booting from built-in flash does not brought up eth0; botting from sd does in 1.0.2.

                 

                Now the weird thing: Ethernet webclient example sometimes works as expected, sometimes crash with ** B0100000063f694.

                 

                I can trace the crash to ethernetclient.cpp EthernetClient::available() function, line 225 *_inactive_counter = 0;

                 

                I am stuck with this, and getting really frustated as I can't workaround this ...

                 

                Any advise? Thanks.

                 

                C.

                • 5. Re: Galileo Ethernet WebClient
                  flummer

                  Hi,

                   

                  That sounds like the same as Re: Ethernet Library: sketch crashes when remote client closes connection where AlexT_Intel seems to have a fix (I haven't tried it).

                   

                  Depending on what you want to use the ethernet code for, one option could also be to use python or similar on the Linux side and do all the heavy network lifting there, and then get the data back in the Arduino sketch and do I/O with if needed.

                   

                  /Thomas

                  • 6. Re: Galileo Ethernet WebClient
                    ccordero

                    Thomas, if I am not wrong, those fixes have been applied in core libs 1.0.2 by Intel, but there is still something weird on them ...

                     

                    Can't make use of Python to talk to Ethernet. I am porting/extending an arduino lib to talk to twitter (as part as a datamonster Project - Intel thank you for the idea ), and moving the OAuth portion of the code to Python would be a no-go for me.

                     

                    Anybody else has found similar problema(s) working with the Galileo Ethernet stuff?

                     

                    Txs.

                     

                    C.

                    • 7. Re: Galileo Ethernet WebClient
                      widzz

                      I have a similar problen working with galileo gen 2 and ethernet. there's no response

                      • 8. Re: Re: Galileo Ethernet WebClient
                        ericLeongZc

                        I solve this using the startup guide.

                        https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=6&cad=rja&uact=8&ved=0CEIQFjAF&url=http%3A%2F%2Fwww.thingw…

                         

                        I notice that in device manager it have to appear as Intel IoT dev kit serial for it to connect to the internet