1 2 Previous Next 26 Replies Latest reply on Nov 8, 2016 12:39 PM by Intel Corporation

    Arduino analogRead(), strange behavior after reboot

    A-Ba

      Hallo.

      I just got the solution to my last problem with the Galileo gen1, and this leads me right into the next one.

      I just got the SD card working that saves the Arduino sketch and loads it again after a  power off and it works now. After a reboot the last uploaded sketch is loaded again (after a little time).

      But from here it gets strange. If i upload a sketch that uses the "analogRead()" command, it works correctly at first. By turning the potentiometer i get a value between 0 and 1023 (given out on the serial Monitor).

      Then i unplug the power-supply and plug it in again.

      Every sketch that does not include the "analogRead()" command would get loaded again and works as it is supposed to.

      The sketches with the "analogRead()" command get loaded too, but when they should give values between 0 and 1023, they just give back 0 regardless of the voltage on the pin i am reading.

      This happens to my sketches and to the examplesketches in the Arduino IDE.

        • 1. Re: Arduino analogRead(), strange behavior after reboot
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi

          This is an interesting behavior. I ran one of the sample sketches on the Arduino IDE. This example had the analogRead() function, but was unable to see the same behavior as you. Once I uploaded the code to the board I ran the ps command in the Linux console and saw the sketch.elf file. I unplugged the power supply and plugged it again and the sketch.elf process was running. This means that the sketch should still be active. Can you see the sketch.elf process running after a reboot? Are you using the same Arduino IDE and serial monitor window to view the data? What’s the result of rebooting the board, closing the IDE and serial monitor and opening them again?

          We’ll be waiting for your response.

          -Sergio
           

          • 2. Re: Arduino analogRead(), strange behavior after reboot
            A-Ba

            Hallo.

            I am using the Arduino IDE version 1.64. It is the version that can be dowwnloaded from intel.

            I have no idear about the processes in Linux. I am in no way familiar with Linux. There fore i would need a step by step instruction.

            I Just made the Image like the tutorial told me.

            In many other Posts i was told, that the SD Card should have several objects as contend after mounting the image and one of them should be the "sketch.elf."

            My SD Card just has two objects, the "boot" folder and the "bzimage".

            To make the SD Card i used the "iot-devkit-prof-dev-image-galileo-20160606" and "Win32Diskimager".

            Strange is, that every oder sketch not using the "analogRead()" just works perfectly after the reboot.

            • 3. Re: Arduino analogRead(), strange behavior after reboot
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              Hi A-Ba,

              Don’t worry, we’ll guide you through the process of entering to the Linux console. First, you need the appropriate connector. You can see more information on the cables required here http://www.intel.com/content/www/us/en/support/boards-and-kits/intel-galileo-boards/000006142.html . For the Gen 1, install the drivers that should have been provided with your serial to USB converter from the manufacturer. You can see more information here https://software.intel.com/en-us/articles/getting-started-with-the-intel-galileo-board-on-windows .

              Now, inside the Linux console, we can monitor the process of the sketch.elf. Before uploading the Arduino sketch, type ps in the console, look at all the process list and notice there shouldn’t be any sketch.elf file.

              Next, upload the Arduino sketch to your board. Once the transfer is complete run the ps command again in the console. Now you should see a process called sketch.elf.
              If the sketch persistent feature is enabled, then after restarting the board you should still see this process running. Please let us know if with the analogRead() example you’re trying out if this behavior happens.

              Now, for the contents of the SD card. It’s important to know that there are two kinds of images available, the uclibc and the eglibc.
              The uclibc image has the following contents on the SD card: boot, bzImage, core-image-minimal-initramfs-clanton.cpio.gz, grub.efi, image-full-galileo-clanton.ext3
              The eglibc image has the following contents on the SD card: boot, firmware, win-driver and bzimage. This can be confirmed here https://software.intel.com/en-us/get-started-galileo-windows-step1 .Did you followed this guide?

              -Sergio
               

              • 4. Re: Arduino analogRead(), strange behavior after reboot
                A-Ba

                Hmm.

                I have tryed ti establish a connection to the Galileo using "PuTTY" and my frustration reached new levels.

                Folowing your tutorial i used the direct LAN method, because i have no UART connector.

                I found several tutorials how to start the ethernet using this arduino sketch.

                 

                "

                void setup()

                {

                  system("telnetd -l /bin/sh");

                  system("ifconfig eth0 169.254.1.1 netmask 255.255.0.0 up");

                }

                void loop(){}

                "

                 

                After uploading the sketch, rebooting the Galileo and conecting it to the Laptop via Lan, I started PuTTY with the following settings.

                Putty.PNG

                The following connection lastet for 30 seconds before an Network error occured.

                in putty.PNG

                Before that i typed "ps" into the console with no response.

                 

                I had a look at the link you send me regarding the image. I downloaded my image from this page, so i think i have the "eglibc image". The content on the sd looks like this.

                Sd Inhalt.PNG

                 

                What have i done wrong?

                • 5. Re: Arduino analogRead(), strange behavior after reboot
                  wilson caro

                  good night.

                  I have the answer to your fault, the problem is that Intel provides new updates on Linux but does not expose lso changes required under the new platform.

                  I discovered connecting me and checking for linux terminal.

                  so you must write your code:

                   

                  system ( "ifconfig enp0s20f6 down");

                  system ( "ifconfig enp0s20f6 192.168.0.5 netmask 255.255.255.0 up");

                  system ( "telnetd -l / bin / sh"); // Start the telnet server on Galileo

                   

                  Try it and you'll notice that it works.

                   

                  Greetings and excuse my English

                  • 6. Re: Arduino analogRead(), strange behavior after reboot
                    Intel Corporation
                    This message was posted on behalf of Intel Corporation

                    Hi A-Ba,

                     

                    Please let us know what’s the result of following @wilson's suggestion. Basically, you must turn the interface off, assign an ip, enable the interface and then connect through telnet. You should do this using the system commands in the Arduino IDE.

                     

                    Let us know if you’re successful in using the Linux console.

                     

                    -Sergio

                    • 7. Re: Arduino analogRead(), strange behavior after reboot
                      A-Ba

                      I tryed your code to stard the LAN adapter today.

                      I did the exact same steps like before, but with the new Code in the Arduino IDE. I just disabled the old lines and used the new ip.

                       

                      "

                      void setup()

                      {

                        //system("telnetd -l /bin/sh");

                        //system("ifconfig eth0 169.254.1.1 netmask 255.255.0.0 up");

                       

                        system ( "ifconfig enp0s20f6 down");

                        system ( "ifconfig enp0s20f6 192.168.0.5 netmask 255.255.255.0 up");

                        system ( "telnetd -l / bin / sh"); // Start the telnet server on Galileo

                      }

                      void loop(){}

                      "

                       

                      I am sorry, but the result is still the same.

                      It feels just like something is really off with this thing.

                      • 8. Re: Arduino analogRead(), strange behavior after reboot
                        wilson caro

                        I forgot to indicate the following:

                        DO NOT connect a cable network direct Galileo to the computer. You must pass it by a switch. in this way if it works

                        • 9. Re: Arduino analogRead(), strange behavior after reboot
                          A-Ba

                          Hallo.

                          I managed to get the conection to the Galileo with your (Wilson caro) code yesterday.

                          It was a stupid little mistake in the IP. But your code works fine with the direct conection if a cross over is used.

                           

                          I managed to find the find the file i had to find (sketch.elf) with the commands provided here.

                          Unfortunately like the analogRead command, the commandlines for the Lan Start also stop working after the reboot.

                           

                          So i started to narrow in what of the basic arduino functions exactly works ant what does not work after the reboot.

                          Serial communication                    works

                          Mathematics (+, -, *, /)                   works

                          digitalRead()                                 works

                          analogRead()                               does not work

                          digitalWrite()                                 works

                          analogWrite()                               works

                           

                          From time to time it takes several uploads to get a sketch to get loaded again after restart. Once i had the strange situation, that a sketch i tryed some hours before reapeared after uploading an other sketch and rebooting the Galileo.

                          • 10. Re: Arduino analogRead(), strange behavior after reboot
                            Intel Corporation
                            This message was posted on behalf of Intel Corporation

                            From your previous reply it seems you were able to access the Linux console and see the sketch.elf file using ps.

                            I’ve a few steps to help us get a clearer picture of your issue

                            1. Kill the Arduino sketch process and make sure there’s no sketch.elf file.
                            2. Upload one of the working sketches, such as the blink to see if the sketch.elf file was created.
                            3. If the file was created, reboot the board and check ps again.
                            4. Add a picture of step 1,2 and 3 to help us follow your progress.
                            5. Confirm you can do this with all sketches except with the analogRead().
                            Also, please attach the exact same sketch you’re using to test this behavior ourselves. What Arduino IDE version you’re using?

                            We’ll be waiting for your response.

                            -Sergio
                            • 11. Re: Arduino analogRead(), strange behavior after reboot
                              A-Ba

                              I am sorry, but the problem i am having prevents me from doing as you told me.

                              I could kill the sketch process (dont know the right commants yet) and upload a new sketch to the galileo.

                              But there will be no lan connection after the reboot. Like i told in the last posts. Just like the analogRead somehow the Lan that works after freshly uploading the sketch , stops working with the reboot.

                              My version of the arduino IDE is 1.64.

                              • 12. Re: Arduino analogRead(), strange behavior after reboot
                                Intel Corporation
                                This message was posted on behalf of Intel Corporation

                                I’m confused. You said in your previous message that you managed to get a connection to the Galileo and find the sketch.elf file. Before attempting to fix the analogRead() issue, confirm you’re able to login to the terminal using Putty. Now, from your previous replies you said you were attempting to connect to Putty using the “Use the LAN connection direct to your PC (via SSH).”method described here http://www.intel.com/content/www/us/en/support/boards-and-kits/intel-galileo-boards/000006142.html . Is this correct?

                                Once you have Putty access you can move on and follow the steps we posted on our reply from September 30. To kill a sketch you need to use the kill command from the Linux console. To use kill just type kill <process_ID>. The process ID is found with the ps command. You can see more information here https://www.maketecheasier.com/kill-command-in-linux/ .

                                Confirm you have Putty access, are following “Use the LAN connection direct to your PC (via SSH).” method and followed our steps from our previous reply.
                                Attach the Arduino sketch you’re using so we can test this behavior.

                                We’ll be waiting for your response.

                                -Sergio
                                 

                                • 13. Re: Arduino analogRead(), strange behavior after reboot
                                  A-Ba

                                  Ok. The Probleem is the folowing one.

                                  The Lan conection runs good in the moment i upload the sketch with the Lanstart. I can easily log in on the Galileo with Putty and find the sketch.elf. Given the example that i do not erase the sketch.elf, the Galileo should boot up the sketch with the Lanstart after the Reboot. Is that correct so far?

                                  Now here comes the problem. Even if the Lanstartsketch was the last uploaded sketch, i can not reach the Galileo with Putty after the reboot. To get a connection again i need to upload the Lanstart sketch fresh. This way i get a new connection via Putty. And of cause there is a sketch.elf to find after i log in again, i just uploaded it to get the Lan working again.

                                   

                                  Is there a way to config the Lan in the Linux itself? Is there a way to get the lan running without using a Arduiinosketch to geet it running?

                                  • 14. Re: Arduino analogRead(), strange behavior after reboot
                                    Intel Corporation
                                    This message was posted on behalf of Intel Corporation

                                    Hi A-Ba,

                                    Thank you for letting us know you already have Putty access. With the eglibc image you should have your sketch starting after reboot. Now, you say you can’t reach Putty after a reboot. This should be working because you’re establishing the connection with an Arduino sketch which is supposed to be enabled after reboot, thus making you able to log on to Putty afterwards.

                                    You can try to do this from the Linux side. You can create a shell script with the LAN configuration. And then create a system service. After creating the service you can have it configured to start after a reboot.

                                    Let us know if this approach works for you.

                                    -Sergio
                                     

                                    1 2 Previous Next