8 Replies Latest reply on Jun 22, 2015 8:23 AM by DiegoV_Intel

    Atom / Quark <> MCU / APP

    Bob_Denver

      So loaded up the Edison v2.1 platform and am running the following on a Arduino Breakout board:

       

      1.  Eclipse MCU SDK to program the Quark CPU

      2.  Eclipse IDE to program the Atom CPU

      3.  Intel XDK IoT Edition

       

      So I have been familiarizing myself by using the blink to blink the onboard LED.  To let me know my programs are working I vary the on/off interval. What I have found was that a programs loaded from the Eclipse IDE overrun a program loaded from the MCU SDK.

       

      Is there a way from a terminal session to verify which codebase is running at any given time?

       

      Thanks very much.

      Bob.

        • 1. Re: Atom / Quark <> MCU / APP
          DiegoV_Intel

          Hello Bob_Denver,

           

          You can use the command ps to check all the processes running on your Edison. You will be able to identify which codebase is running by checking the output of the ps command. For example, if I upload a blink example from the Eclipse IDE, the process listed in the ps command output is the following:

          EclipseScript.JPG

          If you run a codebase from the XDK and check the ps command output, you will get the following process which means that there is a codebase running from the XDK:

          XDKScript.JPG

           

          Regards,

          Diego.

          • 2. Re: Atom / Quark <> MCU / APP
            Bob_Denver

            Thanks very much - very infromative.  What would a MCU Quark based process look like you think?

             

            I am running this program:  (Named mcu_main.c)

             

            #include "mcu_api.h"

            #include "mcu_errno.h"

            void mcu_main() {

                gpio_setup(40, 1);

                while (1) {

                gpio_write(40, 1);

                    mcu_sleep(1000);

                    gpio_write(40, 0);

                    mcu_sleep(5000);

                }

            }

             

            That looks like it is made into:  intel_mcu.bin.

             

            thing is - the LED ought to be on for 1 second and off for 5 seconds - but it is on/off just for 1 second each.

             

            So a bit confused.

             

            Thanks.

            • 3. Re: Atom / Quark <> MCU / APP
              DiegoV_Intel

              Hello Bob_Denver,

               

              I've tested the blink example with the same modifications you did. Please check the code below:

               

              #include "mcu_api.h"
              #include "mcu_errno.h"
              /*
              * This program will blink GPIO 40, which connects to Edison Arduino board DIG 13
              */
              void mcu_main()
              {
                  /* your configuration code starts here */
                  gpio_setup(40, 1);
                  while (1)
                  {
                      gpio_write(40, 1);
                      mcu_sleep(100);
                      gpio_write(40, 0);
                      mcu_sleep(500);
                  }
              }
              

               

              The mcu_sleep() function takes a time value argument that is given in ms (milliseconds), so a value of 100 would be equal to a second. In the code you posted, you have a value of 1000 and a value of 5000. To achieve a second and 5 seconds you have to use a value of 100 and 500 instead.

               

              I tested the code and it worked. I was able to get a one second lapse where the LED was ON, and a five second lapse where the LED was OFF. However I faced some troubles at first. When I tested the Blink using the MCU, I didn't notice that a Node.js script was running (another blink example from the XDK) so every time I uploaded a new MCU script I got the same results (a blink every one second). The reason was that the Node.js script was running and it takes priority over the MCU. Once I terminated the Node.js process and upload again the MCU script I got the results expected. Check if you are getting this same issue with any other script running in your Edison.

               

              Regarding how the MCU process looks like in the list of processes running, it doesn't appear in the ps command output because a MCU script is not running in the Atom. The ps command shows the processes running in the host device, which in the Edison’s case is the Atom SoC that is running the Linux Yocto OS. The Quark is the one running the script, but there is no way to check a process running from Quark.

               

              Regards,

              Diego.

              1 of 1 people found this helpful
              • 4. Re: Atom / Quark <> MCU / APP
                Bob_Denver

                Thanks very much for the insights Diego - is there a way for me to tell what PID to look for i a node.js script to turn down?

                IO

                And thanks for confirming that what is on ATOM takes precidence over the quark on the I/O lines.  Kind of curious whay that would be.

                 

                Thanks.

                • 5. Re: Atom / Quark <> MCU / APP
                  Bob_Denver

                  Got it - thanks Diego - re-read your post above and saw the right answer on the Node.Js.

                   

                  Woudl you know what takes preciece?

                   

                  process built with python?

                  One built with Edison IDE?

                  Node.Js

                   

                  And presume one loaded onto the Quark takes the lowest slot in precidence.

                   

                  Thanks.

                  • 6. Re: Atom / Quark <> MCU / APP
                    Stevie67

                    Hi Diego,

                     

                    sorry to contradict you. But your answer is somehow not consistent. You write "The mcu_sleep() function takes a time value argument that is given in ms (milliseconds), so a value of 100 would be equal to a second". If it is a millisecond, then the value should be 1000. So the original values of 1000 and 5000 would be right to achieve a 1 s / 5 s cycle.

                     

                    Regards,

                     

                    Stefan

                    • 7. Re: Atom / Quark <> MCU / APP
                      DiegoV_Intel

                      Hello Stevie67,

                       

                      You're right, thanks for noticing this detail. The argument of mcu_sleep() is given in milliseconds, however one tick is equal to 10ms (I forgot to mention this detail). So for example if the argument if 100, it would be equal to 100x10ms = 1000ms = 1s.

                       

                      I hope it is clear now. There is a file with more information about the Edison MCU API in the Edison MCU SDK directory: C:\...\edison-mcusdk-win64-1.0.10\docs\api_doc\html\mcu__api_8h

                       

                      Regards,

                      Diego.

                      • 8. Re: Atom / Quark <> MCU / APP
                        DiegoV_Intel

                        Hello Bob_Denver,

                         

                        I'm not sure which process takes precedence since both of them run from the Atom side. A quick test would be to upload a blink example from each IDE: Eclipse, XDK and a python script. If you upload each blink example at different blink intervals you will notice which interval is the one currently running and consequently which blink example takes precedence.

                         

                        Regards,

                        Diego.