1 2 Previous Next 28 Replies Latest reply on Dec 13, 2014 11:23 PM by orphanping

    Intel Edison + Arduino Breakboard -- Eclipse Kepler

    jchozas

      Hi all,

       

      First all, sorry i my English it is not good because it is not my mother tongue.

       

      I have followeed the "Edison Getting Started Guide - Windows" and I have my Edison already flashed and I can access via WiFi. I have check the example of the blink LED with Arduino IDE and it works OK.

       

      My issue is related with the dev kit-ide-win of Intel.I have followed the Getting Started ‒ Installing Intel® IoT Developer Kit  (but my host OS is Windows 7). I build the "4_cpp_onboard_LED_blik" without errors.

       

      12:42:30 **** Rebuild of configuration Debug for project 4_cpp_onboard_LED_blink ****

      Info: Internal Builder is used for build

      i586-poky-linux-g++ "-IC:\\iotdk-ide-win/devkit-x86/sysroots/i586-poky-linux/usr/include" "-IC:\\iotdk-ide-win/devkit-x86/sysroots/i586-poky-linux/usr/include/c++" "-IC:\\iotdk-ide-win/devkit-x86/sysroots/i586-poky-linux/usr/include/c++/i586-poky-linux" "-IC:\\iotdk-ide-win/devkit-x86/sysroots/i586-poky-linux/usr/include/c++/bits" "-IC:\\iotdk-ide-win/devkit-x86/sysroots/i586-poky-linux/usr/include/mraa" -Os -g3 -Wall "--sysroot=C:\\iotdk-ide-win\\devkit-x86\\sysroots\\i586-poky-linux" -m32 -march=i586 -c -ffunction-sections -fdata-sections -o "src\\4_cpp_onboard_LED_blink.o" "..\\src\\4_cpp_onboard_LED_blink.cpp"

      i586-poky-linux-g++ "--sysroot=C:\\iotdk-ide-win\\devkit-x86\\sysroots\\i586-poky-linux" -lmraa -o 4_cpp_onboard_LED_blink "src\\4_cpp_onboard_LED_blink.o"

       

      12:42:32 Build Finished (took 2s.382ms)

       

      Then I go to "Run Configurations" setup to change the connection from "local" to "Galileo", and I got the error:

      "Error during file upload.

      Daemon failed to launch server on 192.168.1.127 using port 0"


      To solve that,  I have deleted the Gaileo remote connection from the Remote System Explorer and I have created a new one "SSH Only"  with the IP Edison's WiFi, and I have repeated the steps and I do not obtain the above error, it seems works well because I obteined this console output,  but the onboard LED is not blinking (the file is updated to the /tmp of my Edison).

       

      root@Edison:~ # echo $PWD>

      /home/root

      root@Edison:~ #

      root@Edison:~ # chmod 755 /tmp/4_cpp_onboard_LED_blink;/tmp/4_cpp_onboard_LED_bli

      nk;exit

      Provide an int arg if you eant to flash an LED on some other IO port than IO 13


      Any Guess why I cannot running a program in the Edison's Memory just the Arduino IDE does?


      I power the Arduino breakboard via micro-USB connector (closest to SW), I have tried connecting the both micro-USB connectors but I got the same result.


      Thanks in advance,

      Jesús Chozas.

        • 1. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
          deium

          If you SSH into the console of your Edison, or in the IDE open an SSH only terminal - you can copy or create any programs you like.

          The /home partition does have the most space by default

          Issuing /tmp/4_cpp_onboard_LED_blink will run the program in Edison's memory.

          In the IDE you can also copy files from your local computer to the remote Edison module which utilizes scp over SSH to do so,

          which is mainly how I copy the cross-compiled binary to my Edison, and then I can run my programs via the console.

          I am not an expert on the IDE as I use a different method to develop, I hope this was helpful.

          • 2. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
            jchozas

            Ok , thanks deium. I just tried to execute the file directly from Edison's console and I giot response but it does not do anythnig

            root@Edison:~ #

            root@Edison:~ # cd /tmp

            root@Edison:~ # ./04_cpp_onboard_LED_blink

            Provide an int arg if you eant to flash an LED on some other IO port than IO 13


            ^C

            Closing IO13 nicely

            root@Edison:~ #


            Anyway, I have tried the example from (mraa/Blink-IO.cpp at master · intel-iot-devkit/mraa · GitHub) which uses GPIO 8 and it works well (i am using the Arduino Breakboard) but when I tried to change the code to leave the LED ON all the time, it keeps blinking, however changing the sleeping time for blinking works..., maybe it is something with libmraa and Arduino Breakboard issue.

            while (running == 0) {

                  // response = gpio->write(0);

                 //  sleep(1);

                    response = gpio->write(1);

                 //  sleep(1);

               }

             

            On the other hand, I know from Linux you can run a program in bakground just using & character at the end of the command, but with Eclipse, Is there a mean to make  "persistent in memory " the program, after unplugged the power just like Arduino IDE does with the scketches?


            Thanks,

            Jesus Ch.

            • 3. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
              deium

              jchozas, did you try ./04_cpp_onboard_LED_blink 8  -- since GPIO 8 worked for you.

              In that the LED doesn't remain on, when it is cross-compiled on the local side, it has to be copied to the remote (Edison) side

              The fact the LED behaviour doesn't reflect your code change, leads me to believe the copy did not complete.  I'd try again.

              For persistence, as in the sketches portion, I will leave that to someone else who deals uses the Arduino to answer.

              1 of 1 people found this helpful
              • 4. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
                deium

                jchozas,

                The sketches get loaded by the clloader on Edison in the /opt/edison/launcher.sh

                1 of 1 people found this helpful
                • 5. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
                  deium

                  jchozas, can you let me know what part of the question still remains to be answered?

                  • 6. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
                    jchozas

                    Hi, deimun.

                     

                    I have tried to run ./04_cpp_onboard_LED_blink 8 from Edison's console and it is works, also for the rest of ports except the 13 that it is in ON state like the on board LED "DS2". I tried ./04_cpp_onboard_LED_blink 13 but i don't get anything.

                     

                    The other issue I was asking for, (how to save in memory the Eclipse cross-compiled program ), I have not tried yet but your answer are quite useful to me.

                    • 7. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
                      deium

                      Intel® Edison Arduino Board Hardware Guide, will help you with the pinout guides.

                      1 of 1 people found this helpful
                      • 8. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
                        jchozas

                        Thank you.

                         

                        The IO13 is a Digital I/O, or SPI clock. The thing is that the Arduino's IDE blinking example works perfectly with pin 13, but I don't know why in C++ example it is not working. It remains the state of Arduino IDE sketch because these design are memory persistent.

                         

                        I have done a test using the Arduino IDE blinking example for IO11 (LED blinks perfectly) and then I have cross-compiled the 04_ccp_onboard_LED_blink.cpp but changing the cpp code so it keeps ON state only, to test that port. In this case when I run in Edison's console ./04_ccp_onboard_LED_blink 11, the LED keeps ON so works like it is supposed to do. When I kill the script via CTRL+C, IO11 remains the Arduino IDE state. On the other words, there something with IO13 does not like it .

                         

                        I am going to keep my research, thanks for you help deium. I want to make persistent my cross-compiled code so it can be runned after unplugged-plugged the Arduino breakboard power supply.

                        • 9. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
                          deium

                          The C++ example would be using the mraa library at mraa: Main Page which uses an mraa number for the routines.

                          I will look for the sketch reset command that will reset your sketch.  All programs copied over to the Edison file system will persist - which you are experiencing.

                          • 10. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
                            jchozas

                            Hi, I plugged my Arduino breakboard and LED IO11 starts blinking (just like yesterday with cross-compiled file) after booting Yocto Linux  althoug there is no 04_cpp_onboard_LED_blink file in /tmp. I have checked there is a launch process running on background but I could not find where is the boot configuration file since there is no /etc/init.c or /etc/rc netiher a crontab conf. files for this Linux kernel. In fact, I got persistent data in memoey without making any physical copy of cross-compiled file.


                            On the other hand, I have tried to kill the app using the sketch reset command but nothings happened, the LED gone on blinking

                            root@Edison:/opt/edison# ls -lart

                            -rwxr-xr-x    1 root    root            58 Oct  9 09:26 sketch_reset.sh

                            -rwxr-xr-x    1 root    root          341 Oct  9 09:26 launcher.sh

                            -rwxr-xr-x    1 root    root          5896 Oct  9 09:27 sketch_reset

                            -rwxr-xr-x    1 root    root        48676 Oct  9 09:27 clloader

                            drwxr-xr-x    2 root    root          4096 Oct 14 13:32 .

                            drwxr-xr-x    4 root    root          4096 Nov 20 17:03 ..

                            root@Edison:/opt/edison#

                            root@Edison:/opt/edison# sh sketch_reset.sh

                            root@Edison:/opt/edison#


                            However I used  kill command to stop the application:

                            root@Edison:/opt/edison# ps | grep launcher.sh

                              165 root      2412 S    {launcher.sh} /bin/sh /opt/edison/launcher.sh

                              293 root      2420 S    grep launcher.sh

                            root@Edison:/opt/edison#

                            root@Edison:/opt/edison# kill 165

                            root@Edison:/opt/edison#

                             

                            So, I could stopped the blinking LED by killing the process

                            root@Edison:/opt/edison# sh sketch_reset.sh

                            killall: clloader: no process killed

                            killall: clloader: no process killed

                            root@Edison:/opt/edison#

                             

                            I have repeteaded the process but running the blinking program first and then killing it with sketch reset command and this time , it worked.

                             

                            root@Edison:/opt/edison# sh launcher.sh

                            Opened /dev/ttyGS0 as inputOpened /dev/ttyGS0 as outputSketch child process sta

                            rted, pid=0301

                            Starting /sketch/sketch.elf /dev/pts/0 ▒▒Ç

                            ^C

                            root@Edison:/opt/edison#

                             

                            root@Edison:/opt/edison# sh sketch_reset.sh

                            signal- hup  signal rxed.. go back to wait for command ...

                            critical fault during select errno=4HUP or CHLDTERM Received, Change state to wait for command from host

                            Going to kill child process:pid 301

                            Waiting for terminated child process:pid 301

                            signal- child ignore  signal rxed

                            /opt/edison/clloader: caught signal 15; exiting

                            root@Edison:/opt/edison#

                            • 11. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
                              deium

                              the yocto Linux uses systemctl (instead of init.d), and clloader for starting.

                              I am going to as KurtE if he can help you with this.

                              1 of 1 people found this helpful
                              • 12. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
                                KurtE

                                Hi Guys, not sure what the question is?

                                 

                                The Arduino system is setup, that it puts the compiled sketch into the /sketch directory.  Paralytically as /sketch/sketch.elf  As already mentioned there is system control (the launcher) that will start up that app at system startup time and also when the Arduino system downloads a new program to run.

                                 

                                When I don't want it to run, I simply remove that app. I also have a sledgehammer Arduino sketch I keep around for doing that:

                                void setup() {
                                  // put your setup code here, to run once:
                                  delay(2000);
                                  Serial.begin(1152000);
                                  Serial.println("Kill the program");
                                  system ("cp -f /tmp/log* /home/root/");
                                  system ("mv -f /sketch/sketch.elf /sketch/sketch.elf.old");
                                  //system("rm \/sketch\/\*");
                                  delay(500);
                                  system("reboot");
                                }
                                
                                void loop() {
                                  // put your main code here, to run repeatedly: 
                                  
                                  
                                }
                                
                                

                                Some reason the paste did in clude the final } line,   Again this one I use when things are not going right.  It keeps the temporary log files that Arduino creates when the program runs, it renames the sketch  and reboots the processor...

                                1 of 1 people found this helpful
                                • 13. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
                                  deium

                                  KurtE, he has a blink program from the iotdk, when run, blinks an led.

                                  His setup Arduino and IDE, did not clear his sketch - so the program was persisting each time he booted, the blink program kicked in.

                                  • 14. Re: Intel Edison + Arduino Breakboard -- Eclipse Kepler
                                    jchozas

                                    Hi KurtE,

                                     

                                    I just starting with the Edison+Arduino breakboard seeing how it works to develop more difficult apps so I have some doubts at the beginning,

                                     

                                    I am not using Arduino IDE because althouh it is easier, my final goal of all of this is to make an IoT project to streams data sensor from Edison + Arduino to a server, so as I am going to need websockects I am trying to familiarize with Eclise IDE to do the implemetation in C++ or node.js

                                     

                                    Thanks for your help.

                                    1 2 Previous Next