7 Replies Latest reply on Apr 25, 2015 2:31 PM by MachineLearner

    Cannot run WebServer example with IoT Dev Kit 1.0 SD image

    MachineLearner

      Hello all,

       

      I'm stuck at this step and looking for help.

       

      I boot my Galileo Gen 2 board from the IoT Dev Kit 1.0 SD image (I downloaded from https://software.intel.com/en-us/iot/downloads) and try to run the WebServer example (attached). The example works fine if I boot without the SD card. However, the sketch displays "Server at 255.255.255.255" and does not show the pin readings if I boot from the SD card. The WebClient example works, so I know the Ethernet card is up and running, but I don't know what I need to do to have the board listen to clients.

       

      What do I need to do to work around this? I am looking to have the board host it's own page and post the temperature sensor readings, where I can access from any device connected to the internet. The reason I'm using this SD image is because I use GCC to compile my code for the sensor readings.

       

      Any help with this is very much appreciated.

       

      Thanks.

        • 1. Re: Cannot run WebServer example with IoT Dev Kit 1.0 SD image
          JPMontero_Intel

          Hello MachineLearner,

           

          I just tested it with a fresh new install of the IoT image. When the board booted without the SD card the sketch worked. Then when the board booted with the SD card it automatically connected to Ethernet, but when I uploaded the sketch the program is not writing the correct IP address nor reading it. I compared the Ethernet configuration before and after I uploaded the sketch and nothing changed. This could be due to the fact that the SPI image is based on uclibc and the IoT image in eglibc, also when you select Galileo in the IDE it uses the uclibc. Let me do further tests into this. In the meantime have you tried setting up the IP address and Ethernet connection with Linux commands through the Arduino IDE by using the system() function?

           

          Regards,
          JPMontero_Intel

          • 2. Re: Cannot run WebServer example with IoT Dev Kit 1.0 SD image
            MachineLearner

            Hi JPMontero_Intel

             

            Thank you for looking into this issue. I have added the following lines into my sketch in the setup section to set up the IP and Ethernet:

             

              system("ifconfig enp0s20f6 up");

              delay(5000);

              system("ifconfig enp0s20f6 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255");

              delay(2000);

             

            The sketch is still not writing or reading the correct IP address. I still get "Server at "Server at 255.255.255.255". What do you recommend I do next?

            • 3. Re: Cannot run WebServer example with IoT Dev Kit 1.0 SD image
              JPMontero_Intel

              MachineLearner, You can check the ip address and current configuration with the command ifconfig enp0s20f6 with this you can know if it configured correclty. You can display it in the serial monitor with the following command;

               

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

               

              Try this and let me know if it helps.

               

              Regards,
              JPMontero_Intel

              • 4. Re: Cannot run WebServer example with IoT Dev Kit 1.0 SD image
                MachineLearner

                Thanks JPMontero_Intel.


                ifconfig enp0s20f6 shows the following, which looks to me like it is configured correctly. Does it look the same to you?

                 

                enp0s20f6  Link encap:Ethernet  HWaddr 98:4F:EE:01:D4:D6

                                 inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0

                                 inet6 addr: fe80::9a4f:eeff:fe01:d4d6/64 Scope:Link

                                 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

                                 RX packets:13468 errors:0 dropped:2 overruns:0 frame:0

                                 TX packets:8137 errors:0 dropped:0 overruns:0 carrier:0

                                 collisions:0 txqueuelen:1000

                                 RX bytes:3340365 (3.1 MiB)  TX bytes:1125528 (1.0 MiB)

                                 Interrupt:50

                 

                What do you think?

                • 5. Re: Cannot run WebServer example with IoT Dev Kit 1.0 SD image
                  JPMontero_Intel

                  Hi MachineLearner,

                   

                  Yes, it looks good, Ethernet is now configured. Have you tried replacing this into the Arduino sketch as the Ethernet configuration to see if it works?

                   

                  Regards,
                  JPMontero_Intel

                  • 6. Re: Cannot run WebServer example with IoT Dev Kit 1.0 SD image
                    CMata_Intel

                    Hi MachineLearner,

                     

                    Do you have updates in this? Did you try with the last suggestion from JPMontero?

                     

                    Regards;

                    CMata

                    • 7. Re: Cannot run WebServer example with IoT Dev Kit 1.0 SD image
                      MachineLearner

                      Hi CMata_Intel and JPMontero_Intel

                       

                      I tried doing some research into how web servers work, and what the IoT Dev Kit is capable of (my knowledge is very limited in those topics), and here are some steps I did that helped me:

                       

                      • The WebServer Arduino sketch that I attached uses the default HTTP port (port 80), which I think part of the problem is my ISP is not letting me use that port (I could be wrong). When I replaced it with a different port (e.g., port 81), I was able to connect to the server through that port.
                      • Part of learning about web servers is I learned that I needed to enable a couple of things on the router side, like enable my router to forward traffic from the internet to my Galileo IP address, and declare my Galileo as a DMZ so it can accept requests from outside of the network, etc., so I did that.
                      • I also learned that the IoT Dev Kit 1.0 SD image includes lighttpd !! so I spent few days learning about lighttpd, and I managed to start a web server and display my temperature sensor readings on a HighChart using JavaScript.


                      So the summary is, yes, I found a way to start a web server on my Galileo board that displays a static page, and now I need to find a way to use a scripting language (NodeJS maybe?) to be able to write apps that talk to the board and do some more controls.


                      My next project is to enable a wireless communication between the Galileo board and an orientation/rotation sensor, so when my garage door is open, I get a nudge from a web app letting me know so I can go close the door. This will be a lot of fun to learn!

                       

                      Thanks for all the help!