3 Replies Latest reply on Apr 23, 2015 10:42 AM by JPMontero_Intel

    Running webserver example on Galileo 2 (Gen2)...

    phanids

      Hi,

       

      I am trying to run the webserver example on the Galileo 2 (Gen 2) board. Trials/ experiments I have done are

       

      1. a. Connect laptop (with static IP) and Galileo-2 with Ethernet cable.

      b. Run the below in the Galileo

      void setup() {

        Serial.begin(9600);

        //It’ll not continue until you send an ‘a’ through the serial monitor

        while(Serial.read()!='a'){

          Serial.println("hello");

          delay(1000);

        }

        //Display ifconfig result to serial monitor

        system("ifconfig > /dev/ttyGS0");

      }

       

      void loop() {

      }

      Sent - a and I see the IP Address

      enp0s20f6:avahi Link encap:Ethernet  HWaddr 98:4F:EE:01:ED:AA

                inet addr:169.254.10.53  Bcast:169.254.255.255  Mask:255.255.0.0

                UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

                Interrupt:49 Base address:0x4000

      c. Set the IP address of laptop as 169.254.63 (so both these guys are in network).

      d. Putty to Galileo-2 and I can get into root and browse the different directories

      (with this I assume - my IP address for Galileo is fine and working).

       

      2. a. Use the webserver example code.

      b. Modified mac and IP address details

      byte mac[] = { 0x98, 0x4f, 0xeE, 0x01, 0xED, 0xAA }; and

      Address ip(169, 254, 10, 53);

      c. Tweak the code for more debug messages.

      d. and when I run

       

      I always see "server is at 255.255.255.255" not sure what is missing?

       

      3. In the setup function itself, added the below code - just to see if the Ethernet.begin itself is working or not

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

          Serial.println("Ethernet.begin() succeeded!");

          Serial.print("IP:      ");

          Serial.println(Ethernet.localIP());

          Serial.print("Subnet:  ");

          Serial.println(Ethernet.subnetMask());

          Serial.print("Gateway: ");

          Serial.println(Ethernet.gatewayIP());

          Serial.print("DNS:     ");

          Serial.println(Ethernet.dnsServerIP());

        } else {

          Serial.println("Failed to initialize Ethernet");

          //while(1);

        }

       

      and I always get -

       

      IP:      255.255.255.255

      Subnet:  255.255.255.255

      Gateway: 255.255.255.255

      DNS:     255.255.255.255

       

      4a. Have any of you have run the webserver example (successfully)?

      b. Is there any thing I am obviously missing?

      c. Any thing else I can try out? (basically I want to send some data from webserver - may be temp etc and read some values from client - like max/ min values etc).

       

      Let me know your thoughts/ comments.

       

      Thanks - and with best regards,

      Phani.

        • 1. Re: Running webserver example on Galileo 2 (Gen2)...
          JPMontero_Intel

          Hi phanids,

           

          I have a couple of suggestions. Have you tried connecting the board directly to the router and to use DHCP? You can also try to set up an Ethernet connection by using ifconfig commands from the Arduino side of the board like in your first test. Make sure the IP address you are using is not used by another device and that it is within range. For web servers I’d suggest you to use node.js but it is on the Linux side of the board, here is an example of a simple webserver https://nodejs.org/. I hope this helps.

           

          Regards,
          JPMontero_Intel

          • 2. Re: Running webserver example on Galileo 2 (Gen2)...
            phanids

            Hi,

             

            Other response (as below) helped me - Thanks a lot to Machine Learner!!! This was not shown in the thread (but I got email). Still not sure, why the server example works if there is NO SD card. I don't know why the webserver doe NOT work with SD card inserted. For time being - I will proceed with this approach and may be later try to do some experiment with SD card..

             

            Running webserver example on Galileo 2 (Gen2)...

            created by MachineLearner in Forums - View the full discussion


            Hi all,

             

            I have a similar problem.


            - I connect the Ethernet cable to the router and use DHCP

            - Run the ipconfig to figure out the board's IP address and MAC

            - ping the board to make sure it is available.


            When I boot the board without an SD image, the WebServer code (attached) runs fine, and I see the message "server is at 192.168.  1. 10", on the serial monitor, and I can connect to the board and see the analogue pins readings, and the serial monitor displays the session information, everything looks good. However, when I run the WebClient example (attached), the connection fails, and the board does not download the Google search. Again, this is with without SD image.

             

            Now when I boot the board from the IoT Developer kit v1.0 image (downloaded from https://software.intel.com/en-us/iot/downloads), the opposite happens. The WebClient example works, and the board connects to Google and downloads the search for "Arduino", but the WebServer example does not work. I get "server is at 255.255.255.255" on the serial monitor, and I cannot go to the board's address (192.168.1.10).


            WebServer works only when I boot without SD image.

            WebClient works only when I boot with SD image.

             

            Maybe you can try the WebServer with and without booting from the SD card adn see if you get a similar issue?

            • 3. Re: Running webserver example on Galileo 2 (Gen2)...
              JPMontero_Intel

              Hi phanids,

               

              Let’s continue this in the post Cannot run WebServer example with IoT Dev Kit 1.0 SD image, it could be helpful since it is on the same issue.

               

              Regards,
              JPMontero_Intel