4 Replies Latest reply on Nov 30, 2015 10:01 AM by arfoll

    python error in mraa.gpio on Edison-arduino breakout board




      I am trying to run a python scrip on Edison-arduino breakout board. 

      The script is as followed:

      Header 1

      import mraa

      import time



      led = mraa.Gpio(9)


      It runs successfully.  After that, I create a systemd .services file for running it upon system startup.   The new file called example.service is under /lib/systemd/system.  I also add it to boot-up chain by issuing "systemctl daemon-reload &systemctl enable example".




      Description=Daemon to handle my own routine (made by cjia)















      Now I meet an issue:

      1. Once system is booting from cold off.  Service is invoked as expected and script runs well.

      2. If I hit reset button on Arduino breakout to reboot system.  Service is invoked but reported as failure. I checked log by using "systemctrl status example". It reported python assertion on "led=mraa.Gpio(9)".

      root@edison:~# python

      Python 2.7.3 (default, Jun 19 2015, 07:08:38)

      [GCC 4.9.1] on linux2

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

      >>> import mraa

      >>> mraa.getVersion()


      >>> mraa.getPlatformName()

      'Intel Edison'

      >>> mraa.getPlatformType()


      >>> pin.mraa.Gpio(9)

      Traceback (most recent call last):

        File "<stdin>", line 1, in <module>

      NameError: name 'pin' is not defined

      >>> pin=mraa.Gpio(9)



      The release I used is 2.1. Mraa version is v0.7.2.

      So far, it could only be reproduced upon reset.


      I also checked sysfs for gpio devices and find some differences.

      Cold bootreset/reboot

      ls /sys/class/gpio/

      export       gpio126      gpio129      gpio131      gpio134      gpiochip232

      gpio124      gpio127      gpio13       gpio132      gpio9        gpiochip248

      gpio125      gpio128      gpio130      gpio133      gpiochip0    unexport

      root@edison:~# ls /sys/class/gpio

      export       gpio129      gpio183      gpio243      gpio262      gpiochip0

      gpio124      gpio130      gpio207      gpio256      gpio263      gpiochip200

      gpio125      gpio131      gpio214      gpio257      gpio40       gpiochip216

      gpio126      gpio132      gpio215      gpio258      gpio41       gpiochip232

      gpio127      gpio133      gpio240      gpio259      gpio43       gpiochip248

      gpio128      gpio134      gpio241      gpio261      gpio49       unexport



      I can not figure out why this happen.  Could you help me?