1 2 Previous Next 20 Replies Latest reply on Oct 16, 2016 12:35 PM by javilez

    Arduino sketch stops running after 2 mins on Edison

    dansam

      hi eveyone,  I am testing the following basic arduino sketch :

       

      void setup() {

        Serial1.begin(9600);

      }

       

      void loop() {

        Serial1.print("1");

        delay(1000);

      }

       

      this is correctly uploaded and starts regularly during boot; I can see the process running:

       

      /sketch/sketch.elf /dev/ttygc0 /dev/ttygc0

       

      and the data being sent out on UART1

       

      BUT, the program stops after a couple of minutes, and I cannot figure out why..

      your help is much appreciated

      dan

        • 1. Re: Arduino sketch stops running after 2 mins on Edison
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi,

          Is the process ended when the program stops responding? You can check the processes running with ps. What image version and IDE version are you using? I’m running the latest image 201606061707 and am using the Arduino IDE 1.6.11. I left the script running for about 15 minutes and the process was still running after that.

          We’ll be waiting for your response.

          -Sergio
           

          • 2. Re: Arduino sketch stops running after 2 mins on Edison
            dansam

            Hi Sergio, thanks for your reply.

            the process ends after 2 mins,  ps wont retrieve it anymore...

            the sketch starts properly at startup, automatically... no issues... but it stops very soon.

            The signal is correctly generated by the UART1 and monitored with a scope.

             

            the image is : 3.10.98-poky-edison+ #1 SMP PREEMPT Mon Jun 6 14:32:08 PDT 2016 i68

            I have a session open over wifi to check the ps output, and the module is self powered with a 3.7 lithium battery. No usb cable is plugged

             

            I have also noticed that if the usb cable is plugged to the otg port, the script runs continuously without stopping. So, it must be something related to being detached from the laptop, and being able to run wirelessly

             

            what else can I check?

            • 3. Re: Arduino sketch stops running after 2 mins on Edison
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              Hi Dan,

               

              The OTG port can be used to supply power to the Edison. If an USB cable is connected to that port and the sketch runs continuously then it’s possible that the board is not receiving enough power to maintain the sketch running. Can you try to power your board using an external power supply on J1 and see if this problem persists? The external power must be in the range of 7 to 17 V. Also, if possible, use another lithium-ion battery on J2. Make sure this battery is providing between 3.0 and 4.3V when connected.

               

              We’ll be waiting for your response.

               

              -Sergio

              • 4. Re: Arduino sketch stops running after 2 mins on Edison
                Intel Corporation
                This message was posted on behalf of Intel Corporation

                Do you still need help with this thread? What were the results of following our previous suggestion?

                -Sergio
                 

                • 5. Re: Arduino sketch stops running after 2 mins on Edison
                  dansam

                  Hi Sergio,

                   

                  during my tests I used the sparkfun breakout boards. including the power module with the 3.7v lithium battery.

                  I have purchased another edison with the mini board and I got it just tdy.

                  Will wire the board to execute a test tmw, and update you by tmw.

                   

                  take care, and thanks for your support

                  dan

                  • 6. Re: Arduino sketch stops running after 2 mins on Edison
                    dansam

                    Sergio

                     

                    my update from today:

                    • Edison running on a sparkfun running the usb/otg breakout. Both miniports connected with 2 usb cables to a 5V power source ( no laptop , no RTX lines connected)
                    • ifconfig shows lo and wifi only
                    • I connect to the module over putty with the wifi ipaddress
                    • all starts fine all is good, the sketch autostarts at boot. the autostart has been setup according to this procedure Procedure to Autostart the Arduino Sketch on Edison | Intel® Software
                    • after 3 mins the sketch stops.
                    • using putty, i restart manually the /etc/init.d/automateSketch.sh and it seams to run without stopping

                     

                    based on this, I  would rule out any power issues... perhaps some conflict or issues with ttyGS0?

                    I haven't installed anything else on the board besides the OS image (3.10.98-poky-edison+) and the sketch

                     

                    ciao

                    dan

                    • 7. Re: Arduino sketch stops running after 2 mins on Edison
                      Intel Corporation
                      This message was posted on behalf of Intel Corporation

                      Hi Dan,

                      Thank you for providing this description. As I understand from your last reply was that both the first board with the Arduino expansion board, as well as the new Edison module with the mini breakout board have the same behavior, is this correct? I’ve a couple of questions:

                      You mention that after manually restarting automateSketch.sh your script runs without stopping, does this happen with both modules?

                      Could you try the mini breakout board test using a different set of USB cables?
                      We’ll be waiting for your response.

                      -Sergio
                       

                      • 8. Re: Arduino sketch stops running after 2 mins on Edison
                        dansam

                        Ciao Sergio,

                         

                        here my latest findings...

                        • I moved the edison from the sparkfun stacked breakouts onto the Intel mini board.
                        • No USB cables are connected  the module connected over WiFi only
                        • On J21 I connected a 12V  DC power supply.
                        • At start time I open an SSH with putty, and start monitoring with a ps command the processes running.
                        • The arduino sketch starts at boot regularly, and stops after 3 mins...
                        • After that I start from command line the /sketch/sketch.elf /dev/ttyGS0 /dev/ttyGS0 &
                        • the sketch runs without issues forever...
                        • the behavior is basically unchanged, so the first instance of the process created at boot stops for unknown reasons within 3 mins...

                         

                        what would you advice?

                        br

                        dan

                        • 9. Re: Arduino sketch stops running after 2 mins on Edison
                          Intel Corporation
                          This message was posted on behalf of Intel Corporation

                          Hi Dan,

                          It’s hard to say why your sketch stops. Again, I’ve tested the code provided above and left it running for around 20 minutes. Ps still shows the sketch.elf running as a process the whole time. I ran the code on both Arduino IDE 1.6.11 and 1.6.5. I used the latest image where the output of cat /etc/version is 201606061707. If you’re using the mini breakout board then 12V applied to J21 is good. I’ve a few questions:

                          • Can you confirm this battery is actually providing this voltage when connected?
                          • Are other Arduino sketches stopping as well? What happens if you leave the blink example running, does it suddenly stop?
                          • Could you try to reflash your Edison to see if you get positive results? You can use the Flash Tool Lite. See instructions here https://software.intel.com/en-us/articles/flash-tool-lite-user-manual
                          We’ll be waiting for your response.
                          -Sergio
                          • 10. Re: Arduino sketch stops running after 2 mins on Edison
                            dansam

                            Hi Sergio,

                             

                            • I can confirm that I have the same version as you do: 201606061707
                            • the battery provides the proper voltage.

                             

                            new findings

                            • I have done a further test, I wrote a simple program in C uart.c and made it loop infinitely to output the "Hello Mraa!". same issues it stops.
                            • then I decided to write under /etc/init.d the simplest script ever:

                             

                                      mytest.sh

                                      -------------

                                      #!/bin/sh

                                      while :

                                      do    

                                         date >> /home/root/mylog

                                         sleep 10

                                      done

                                      -------------

                             

                                     and executed : update-rc.d mytest.sh defaults (***)

                             

                            • rebooted the edison ... and...
                            • the mylog file STOPS being updated after 5min .... the process dies...

                             

                             

                            so, there must be something that stops processes being set to startup in the way I do with (***) ( Procedure to Autostart the Arduino Sketch on Edison | Intel® Software )

                             

                            any suggestions?

                            br

                            dan

                            • 11. Re: Arduino sketch stops running after 2 mins on Edison
                              dansam

                              Sergio,

                               

                              I managed to get the startup script running continuously at all times creating a service instead.

                              Hence the information reported at Procedure to Autostart the Arduino Sketch on Edison | Intel® Software  is not a solution.

                               

                              I am very happy now

                              ciao

                              dan

                              1 of 1 people found this helpful
                              • 12. Re: Arduino sketch stops running after 2 mins on Edison
                                Intel Corporation
                                This message was posted on behalf of Intel Corporation

                                Hi Dan,

                                Thank your lettings us know you managed to resolve this issue. If you have any other issues with the Edison don’t hesitate to open a new thread to get help from the community.

                                -Sergio
                                 

                                • 13. Re: Arduino sketch stops running after 2 mins on Edison
                                  javilez

                                  Hi damsan,

                                  I'm having the same problem as you with my intel edison (cat /etc/version is 201606061707).

                                   

                                  After x mins the sketch is stopped. I'm not sure if the problem is in the code. While I resolve this, I have made a scketch that write in a text file the result of the 'ps' command and then  look if the sketch is started.

                                   

                                  The problem is that this sketch will also stop after x mins.

                                   

                                  Please, can you explain how creating a service instead? You had more problem reset with you solution?

                                   

                                  Thanks in advance.

                                  Javier.

                                  • 14. Re: Arduino sketch stops running after 2 mins on Edison
                                    Intel Corporation
                                    This message was posted on behalf of Intel Corporation

                                    Hi Javier,

                                    You can find a very useful document to create services here https://communities.intel.com/docs/DOC-111103 .

                                    Let us know if this was helpful.

                                    -Sergio
                                     

                                    1 of 1 people found this helpful
                                    1 2 Previous Next