13 Replies Latest reply on Aug 6, 2015 12:54 AM by yidihan

    mraa affect other program?

    yidihan

      My program(use some ios by sys/class/gpio) worked fine

       

      But when I typed in "import mraa " in python.

       

      The program does not work.

       

      what is the problem?

       

      thanks

        • 1. Re: mraa affect other program?
          DiegoV_Intel

          Hi yidihan,

           

          What do you mean by "the program doesn't work"? Could you attach your Python code so we can take a look at it?

           

          Regards,

          Diego.

          • 2. Re: mraa affect other program?
            yidihan

            Hi

            my program is a model that connected with RF board through SPI and some other ios

            I write nothing in python

            just import mraa...

            • 3. Re: mraa affect other program?
              DiegoV_Intel

              I'm not following you. If you haven't written any Python script, why are you importing MRAA?

               

              Could you explain what are you trying to do? To import the MRAA library you should enter in the Python environment by typing “python” in your terminal, and then run the following line:

               

              import mraa

               

              Are there any error messages after running that line?

               

              Regards,

              Diego.

              • 4. Re: mraa affect other program?
                yidihan

                hi,

                sorry, I did not explain it clearly

                My code is used to communicate with computer through a RF board.

                It works fine, computer can send data to edison and get feedback something like ping command.

                At the same time, I want to control some gpio through mraa.


                if I typing in  

                python

                >>> import mraa

                just here

                computer can not receiver feedback

                even before I write some other code in python like blink led

                • 5. Re: mraa affect other program?
                  arfoll

                  How are you sending data through your RF board? What is your code? An arduino sketch?

                   

                  Can you run `journalctl -f` in a different terminal and then run import mraa in python?

                  • 6. Re: mraa affect other program?
                    yidihan

                    Hi

                    I think I kown what the problem is.

                     

                    In my code I used the /sys/class/gpio and set and reset the tri state io (GPIO214)

                     

                    and when I import mraa, it do it again and affect the GPIO in my program.

                     

                    Am I right? Do you have some suggestions about it?

                     

                    Thank you

                    • 7. Re: mraa affect other program?
                      yidihan

                      Hi,

                       

                      I still can not import mraa module.

                       

                      The RF code just use some GPIO and spi without mraa.

                       

                      I do not have the code now. It is so wired what does it do when I just type in import mraa? Will it config any IO?

                       

                      Thank you very much.

                      • 8. Re: mraa affect other program?
                        DiegoV_Intel

                        Hello yidihan,

                         

                        MRAA doesn't configure any GPIO with just importing it. Can you take a screenshot of your terminal after importing MRAA?

                         

                        Regards,

                        Diego.

                        • 9. Re: mraa affect other program?
                          yidihan

                          Hi,

                           

                          Thank you for your reply.

                           

                          I ping Edison from Ubuntu(PC) ,edison address is   2103::1:9049:c1ff:feb3:5136

                           

                          64 bytes from 2103::1:9049:c1ff:feb3:5136: icmp_seq=97 ttl=61 time=88.2 ms

                          64 bytes from 2103::1:9049:c1ff:feb3:5136: icmp_seq=98 ttl=61 time=86.1 ms

                          64 bytes from 2103::1:9049:c1ff:feb3:5136: icmp_seq=99 ttl=61 time=99.2 ms

                          64 bytes from 2103::1:9049:c1ff:feb3:5136: icmp_seq=100 ttl=61 time=102 ms

                          64 bytes from 2103::1:9049:c1ff:feb3:5136: icmp_seq=101 ttl=61 time=81.3 ms

                          64 bytes from 2103::1:9049:c1ff:feb3:5136: icmp_seq=102 ttl=61 time=107 ms

                          64 bytes from 2103::1:9049:c1ff:feb3:5136: icmp_seq=103 ttl=61 time=97.2 ms

                          64 bytes from 2103::1:9049:c1ff:feb3:5136: icmp_seq=104 ttl=61 time=103 ms

                          64 bytes from 2103::1:9049:c1ff:feb3:5136: icmp_seq=105 ttl=61 time=94.8 ms

                          64 bytes from 2103::1:9049:c1ff:feb3:5136: icmp_seq=106 ttl=61 time=102 ms

                           

                          But after type in imprt mraa. It will have problem and never get some data from edsion.

                           

                          root@edison1:~# python

                          Python 2.7.3 (default, Oct  9 2014, 11:20:30)

                          [GCC 4.8.2] on linux2

                          Type "help", "copyright", "credits" or "license" for more information.

                          >>> import mraa

                          >>>

                          Just here

                          • 10. Re: mraa affect other program?
                            DiegoV_Intel

                            Hello yidihan,

                             

                            That happens because you are in the Python environment. Once you type "python" in your terminal, you will enter in the Python environment. That means that you are not seeing the terminal prompt. You can know if you are in the Python environment by checking the >>> to the left.

                             

                            If you want to exit from the Python environment and return to the shell command prompt, you only have to type "exit()"

                             

                            Regards,

                            Diego.

                            • 11. Re: mraa affect other program?
                              yidihan

                              Hi,

                              I am sorry that I did not describe it clearly.

                               

                              64 bytes from 2103::1:9049:c1ff:feb3:5136: icmp_seq=99 ttl=61 time=99.2 ms

                              64 bytes from 2103::1:9049:c1ff:feb3:5136: icmp_seq=100 ttl=61 time=102 ms

                               

                              This kind of messages come from Ubuntu which running on my PC.

                              My code which I said was affected by the mraa will answer ping command

                              So the terminal of my computer will keep sending ping command and receiving response. Then show this text.

                               

                              64 bytes from 2103::1:9049:c1ff:feb3:5136: icmp_seq=99 ttl=61 time=99.2 ms


                              when I type in python it works.It means that  the ping command can get data and keep going


                              But after I typed in import mraa, the terminal of my computer will stop there and nerver get ping response data.

                              That is way I think something hanppeds and affect my code in edison. It no longer send response data to my computer.


                              Thanks a lot

                              • 12. Re: mraa affect other program?
                                arfoll

                                Yes on arduino breakout we're forced to toggle the tristate on mraa_init(). Not much we can do about that, that's just the way IO on edison with the breakout works.

                                • 13. Re: mraa affect other program?
                                  yidihan

                                  Hi,

                                  Thanks for your answer.

                                  1.I have a doubt that if I need to use mraa twice. How should I do it?

                                  First program import mraa and it begins to work. I can not import mraa again in another program?otherwise it will toggle the tri state and affect the firsts operation?

                                  2.Is there any suggestion about how should I do to change mraa a little to disable the tri state in mraa-init()

                                   

                                  Thanks a lot