Using mraa on Dragonboard 410c

I am trying to install the mraa to use interrupts on the GPIOs. I went through the instructions given on the github page and got it built. However, when I tried to access the gpio it threw error that mraa has no attribute Gpio.

My kernel version is 4.14.0 and I have built the latest mraa version. Please help

Anyone Anything???
I really need to get the interrupt value or the Amazon forest will die.

@Peeyush_Tekriwal Could you please share the syslog output?

tail -n 100 /var/log/syslog

Nothing new came in the syslog after trying the mraa.Gpio()

@Peeyush_Tekriwal. There is not much detail in your posts to help us debug.
Please post your results for the following so we can see if there is anything different.

$ sudo python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mraa
>>> dir(mraa)
['A96BOARDS', 'ANDROID_PERIPHERALMANAGER', 'Aio', 'Aio_swigregister', 'BANANA', 'BEAGLEBONE', 'DE_NANO_SOC', 'DIR_IN', 'DIR_OUT', 'DIR_OUT_HIGH', 'DIR_OUT_LOW', 'EDGE_BOTH', 'EDGE_FALLING', 'EDGE_NONE', 'EDGE_RISING', 'ERROR_FEATURE_NOT_IMPLEMENTED', 'ERROR_FEATURE_NOT_SUPPORTED', 'ERROR_INVALID_HANDLE', 'ERROR_INVALID_PARAMETER', 'ERROR_INVALID_PLATFORM', 'ERROR_INVALID_QUEUE_TYPE', 'ERROR_INVALID_RESOURCE', 'ERROR_INVALID_VERBOSITY_LEVEL', 'ERROR_NO_DATA_AVAILABLE', 'ERROR_NO_RESOURCES', 'ERROR_PLATFORM_NOT_INITIALISED', 'ERROR_UART_OW_DATA_ERROR', 'ERROR_UART_OW_NO_DEVICES', 'ERROR_UART_OW_SHORTED', 'ERROR_UNSPECIFIED', 'FTDI_FT4222', 'GENERIC_FIRMATA', 'GROVEPI', 'Gpio', 'Gpio_swigregister', 'I2C_FAST', 'I2C_HIGH','I2C_STD', 'I2c', 'I2c_swigregister', 'IEI_TANK', 'INTEL_CHERRYHILLS', 'INTEL_DE3815', 'INTEL_EDISON_FAB_C', 'INTEL_EDISON_GP109', 'INTEL_EDISON_GP110', 'INTEL_EDISON_GP111', 'INTEL_EDISON_GP114', 'INTEL_EDISON_GP115', 'INTEL_EDISON_GP12', 'INTEL_EDISON_GP128', 'INTEL_EDISON_GP129', 'INTEL_EDISON_GP13', 'INTEL_EDISON_GP130', 'INTEL_EDISON_GP131', 'INTEL_EDISON_GP134', 'INTEL_EDISON_GP135', 'INTEL_EDISON_GP14', 'INTEL_EDISON_GP15', 'INTEL_EDISON_GP165', 'INTEL_EDISON_GP182', 'INTEL_EDISON_GP183', 'INTEL_EDISON_GP19', 'INTEL_EDISON_GP20', 'INTEL_EDISON_GP27', 'INTEL_EDISON_GP28', 'INTEL_EDISON_GP40', 'INTEL_EDISON_GP41', 'INTEL_EDISON_GP42','INTEL_EDISON_GP43', 'INTEL_EDISON_GP44', 'INTEL_EDISON_GP45', 'INTEL_EDISON_GP46', 'INTEL_EDISON_GP47', 'INTEL_EDISON_GP48', 'INTEL_EDISON_GP49', 'INTEL_EDISON_GP77', 'INTEL_EDISON_GP78', 'INTEL_EDISON_GP79', 'INTEL_EDISON_GP80', 'INTEL_EDISON_GP81', 'INTEL_EDISON_GP82', 'INTEL_EDISON_GP83', 'INTEL_EDISON_GP84', 'INTEL_EDISON_MINIBOARD_J17_1', 'INTEL_EDISON_MINIBOARD_J17_10', 'INTEL_EDISON_MINIBOARD_J17_11', 'INTEL_EDISON_MINIBOARD_J17_12', 'INTEL_EDISON_MINIBOARD_J17_14', 'INTEL_EDISON_MINIBOARD_J17_5', 'INTEL_EDISON_MINIBOARD_J17_7', 'INTEL_EDISON_MINIBOARD_J17_8', 'INTEL_EDISON_MINIBOARD_J17_9', 'INTEL_EDISON_MINIBOARD_J18_1', 'INTEL_EDISON_MINIBOARD_J18_10', 'INTEL_EDISON_MINIBOARD_J18_11', 'INTEL_EDISON_MINIBOARD_J18_12', 'INTEL_EDISON_MINIBOARD_J18_13', 'INTEL_EDISON_MINIBOARD_J18_2', 'INTEL_EDISON_MINIBOARD_J18_6', 'INTEL_EDISON_MINIBOARD_J18_7', 'INTEL_EDISON_MINIBOARD_J18_8', 'INTEL_EDISON_MINIBOARD_J19_10', 'INTEL_EDISON_MINIBOARD_J19_11', 'INTEL_EDISON_MINIBOARD_J19_12', 'INTEL_EDISON_MINIBOARD_J19_13', 'INTEL_EDISON_MINIBOARD_J19_14', 'INTEL_EDISON_MINIBOARD_J19_4', 'INTEL_EDISON_MINIBOARD_J19_5', 'INTEL_EDISON_MINIBOARD_J19_6', 'INTEL_EDISON_MINIBOARD_J19_8', 'INTEL_EDISON_MINIBOARD_J19_9', 'INTEL_EDISON_MINIBOARD_J20_10', 'INTEL_EDISON_MINIBOARD_J20_11', 'INTEL_EDISON_MINIBOARD_J20_12', 'INTEL_EDISON_MINIBOARD_J20_13', 'INTEL_EDISON_MINIBOARD_J20_14', 'INTEL_EDISON_MINIBOARD_J20_3', 'INTEL_EDISON_MINIBOARD_J20_4', 'INTEL_EDISON_MINIBOARD_J20_5', 'INTEL_EDISON_MINIBOARD_J20_6', 'INTEL_EDISON_MINIBOARD_J20_7', 'INTEL_EDISON_MINIBOARD_J20_8', 'INTEL_EDISON_MINIBOARD_J20_9', 'INTEL_GALILEO_GEN1', 'INTEL_GALILEO_GEN2', 'INTEL_JOULE_EXPANSION', 'INTEL_MINNOWBOARD_MAX', 'INTEL_NUC5', 'INTEL_SOFIA_3GR', 'INTEL_UP', 'INTEL_UP2', 'Led', 'Led_swigregister', 'MOCK_PLATFORM', 'MODE_HIZ', 'MODE_IN_ACTIVE_HIGH', 'MODE_IN_ACTIVE_LOW', 'MODE_OUT_OPEN_DRAIN', 'MODE_OUT_PUSH_PULL', 'MODE_PULLDOWN', 'MODE_PULLUP', 'MODE_STRONG', 'MTK_LINKIT', 'MTK_OMEGA2', 'NULL_PLATFORM', 'PHYBOARD_WEGA', 'PIN_AIO', 'PIN_FAST_GPIO', 'PIN_GPIO', 'PIN_I2C', 'PIN_PWM', 'PIN_SPI', 'PIN_UART', 'PIN_VALID', 'Pwm', 'Pwm_swigregister', 'RASPBERRY_PI', 'RASPBERRY_WIRING_PIN0', 'RASPBERRY_WIRING_PIN1', 'RASPBERRY_WIRING_PIN10', 'RASPBERRY_WIRING_PIN11', 'RASPBERRY_WIRING_PIN12', 'RASPBERRY_WIRING_PIN13', 'RASPBERRY_WIRING_PIN14', 'RASPBERRY_WIRING_PIN15', 'RASPBERRY_WIRING_PIN16', 'RASPBERRY_WIRING_PIN17', 'RASPBERRY_WIRING_PIN18', 'RASPBERRY_WIRING_PIN19', 'RASPBERRY_WIRING_PIN2', 'RASPBERRY_WIRING_PIN20', 'RASPBERRY_WIRING_PIN21', 'RASPBERRY_WIRING_PIN22', 'RASPBERRY_WIRING_PIN23', 'RASPBERRY_WIRING_PIN24', 'RASPBERRY_WIRING_PIN25', 'RASPBERRY_WIRING_PIN26', 'RASPBERRY_WIRING_PIN27', 'RASPBERRY_WIRING_PIN28', 'RASPBERRY_WIRING_PIN29', 'RASPBERRY_WIRING_PIN3', 'RASPBERRY_WIRING_PIN4', 'RASPBERRY_WIRING_PIN5', 'RASPBERRY_WIRING_PIN6', 'RASPBERRY_WIRING_PIN7', 'RASPBERRY_WIRING_PIN8', 'RASPBERRY_WIRING_PIN9', 'SPI_MODE0', 'SPI_MODE1', 'SPI_MODE2', 'SPI_MODE3', 'SUCCESS', 'Spi', 'Spi_swigregister', 'UART_PARITY_EVEN', 'UART_PARITY_MARK', 'UART_PARITY_NONE', 'UART_PARITY_ODD', 'UART_PARITY_SPACE', 'UNKNOWN_PLATFORM', 'Uart', 'Uart_swigregister', '__builtin__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_mraa', '_newclass', '_object', '_swig_getattr', '_swig_property', '_swig_repr', '_swig_setattr', '_swig_setattr_nondynamic', 'adcRawBits', 'adcSupportedBits', 'addSubplatform', 'aioFromDesc', 'getDefaultI2cBus', 'getGpioLookup', 'getI2cBusCount', 'getI2cBusId', 'getI2cLookup', 'getPinCount', 'getPinName', 'getPlatformName', 'getPlatformType', 'getPlatformVersion', 'getPwmLookup', 'getSpiLookup', 'getSubPlatformId', 'getSubPlatformIndex', 'getUartCount', 'getUartLookup', 'getVersion', 'gpioFromDesc', 'hasSubPlatform', 'i2cFromDesc', 'init', 'initJsonPlatform', 'isSubPlatformId', 'ledFromDesc', 'pinModeTest', 'printError', 'pwmFromDesc', 'removeSubplatform', 'setLogLevel', 'setPriority', 'spiFromDesc', 'uartFromDesc', 'uint8Array', 'uint8Array_frompointer', 'uint8Array_swigregister']
>>> mraa.__file__
'/usr/lib/python3.5/dist-packages/mraa.py'
>>> mraa.getPlatformName()
'DB410C'
>>> exit()
$ ls -la /usr/lib/python3.5/dist-packages/mraa.py
-rw-r--r-- 1 root root 25903 Apr 28 20:08 /usr/lib/python3.5/dist-packages/mraa.py

Still, it would be helpful to see the platform initialization log.

linaro@edge1:~$ sudo python3
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mraa
>>> dir(mraa)
['__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
>>> mraa.__file__
>>> mraa.getPlatformName()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'mraa' has no attribute 'getPlatformName'
>>> exit()
linaro@edge1:~$ ls -la /usr/lib/python3 python3/ python3.7/ linaro@edge1:~$ ls -la /usr/lib/python3.7/dist-packages ls: cannot access '/usr/lib/python3.7/dist-packages': No such file or directory

@Peeyush_Tekriwal From your logs it seems like the platform is not all detected. This should never happen if you are using the non-modified Debian os provided by Linaro.

Can you please share below the output of below commands?

$ cat /proc/device-tree/model
$ tail -n 100 /var/log/syslog

Aug 28 16:17:51 edge1 NetworkManager[1715]: [1567009071.0575] device (wlan0): supplicant interface state: disabled → inactive
Aug 28 16:17:51 edge1 wpa_supplicant[1714]: wlan0: Reject scan trigger since one is already pending
Aug 28 16:19:55 edge1 libmraa[3474]: libmraa version v1.9.0 initialised by user ‘linaro’ with EUID 1000
Aug 28 16:19:55 edge1 libmraa[3474]: libmraa initialised for platform ‘DB410C’ of type 9

@Peeyush_Tekriwal One more question, are you having issues with non-python interfaces as well? Like C/C++. And there are some tools provided with MRAA. It would be good if you can try using those:

$ mraa-gpio list

How do I exactly test them? But given that there are already some of the processes running on the board, I didn’t get any other error messages with any other app or service.

And BTW what according to you is the issue here? Is it due to the kernel version being 4.14 or because of python being 3.7 or something else. I know you cannot be sure of it but I just want to know what could be the reason causing this

Either you can execute the command I mentioned above or try to run the C/C++ examples which gets installed by default.

$ <mraa installed location>/examples/c/gpio
$ <mraa installed location>/examples/c/gpio_advanced

Source code of those examples:

Well I did try this but it gave me syntax error

There should be no issue with the kernel as long as you haven’t messed up with devicetree. My suspection is Python and that’s why I asked you to try C/C++.

Also, the mraa import is not working with python2.7
It is giving me an error:

Python 2.7.16 (default, Apr 6 2019, 01:42:57)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mraa
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/mraa.py", line 207, in <module>
MTK_LINKIT = _mraa.MTK_LINKIT
AttributeError: 'module' object has no attribute 'MTK_LINKIT'

The fact that this is giving you no output is symptom of why you are getting errors. I don’t understand how you can do an “import mraa” without error and have no file location.
Do you have a file called mraa.py or a directory call mraa where you are starting Python?

Can you post your output from the following:

$ sudo python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> for p in sys.path:
...     print(p)
...

/usr/lib/python35.zip
/usr/lib/python3.5
/usr/lib/python3.5/plat-aarch64-linux-gnu
/usr/lib/python3.5/lib-dynload
/usr/local/lib/python3.5/dist-packages
/usr/lib/python3/dist-packages
/usr/lib/python3.5/dist-packages
>>> exit()
$ mraa-gpio list
12     SPI0_CS: GPIO
23      GPIO-A: GPIO
24      GPIO-B: GPIO
25      GPIO-C: GPIO
26      GPIO-D: GPIO
27      GPIO-E: GPIO
28      GPIO-F: GPIO
29      GPIO-G: GPIO
30      GPIO-H: GPIO
31      GPIO-I: GPIO
32      GPIO-J: GPIO
33      GPIO-K: GPIO
34      GPIO-L: GPIO
$ mraa-gpio version
Version v2.0.0-32-g8d65c2c on DB410C

Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import sys
>>> for p in sys.path:
... print(p)
...

/usr/lib/python37.zip
/usr/lib/python3.7
/usr/lib/python3.7/lib-dynload
/usr/local/lib/python3.7/dist-packages
/usr/lib/python3/dist-packages
>>> exit()
linaro@edge1:~$ mraa-gpio list
12 SPI0_CS: GPIO
23 GPIO-A: GPIO
24 GPIO-B: GPIO
25 GPIO-C: GPIO
26 GPIO-D: GPIO
27 GPIO-E: GPIO
28 GPIO-F: GPIO
29 GPIO-G: GPIO
30 GPIO-H: GPIO
31 GPIO-I: GPIO
32 GPIO-J: GPIO
33 GPIO-K: GPIO
34 GPIO-L: GPIO
linaro@edge1:~$ mraa-gpio version
Version v2.0.0-37-g0a12c5a on DB410C

Error when trying to compile the c file

linaro@edge1:~$ gcc gpio.c -o gpio
/usr/bin/ld: /tmp/ccEmyO3x.o: in function main': gpio.c:(.text+0x70): undefined reference to mraa_init’
/usr/bin/ld: gpio.c:(.text+0x78): undefined reference to mraa_gpio_init' /usr/bin/ld: gpio.c:(.text+0xac): undefined reference to mraa_deinit’
/usr/bin/ld: gpio.c:(.text+0xbc): undefined reference to mraa_gpio_init' /usr/bin/ld: gpio.c:(.text+0xf0): undefined reference to mraa_deinit’
/usr/bin/ld: gpio.c:(.text+0x104): undefined reference to mraa_gpio_dir' /usr/bin/ld: gpio.c:(.text+0x120): undefined reference to mraa_gpio_dir’
/usr/bin/ld: gpio.c:(.text+0x140): undefined reference to mraa_gpio_write' /usr/bin/ld: gpio.c:(.text+0x15c): undefined reference to mraa_gpio_write’
/usr/bin/ld: gpio.c:(.text+0x180): undefined reference to mraa_gpio_write' /usr/bin/ld: gpio.c:(.text+0x19c): undefined reference to mraa_gpio_write’
/usr/bin/ld: gpio.c:(.text+0x1d0): undefined reference to mraa_gpio_close' /usr/bin/ld: gpio.c:(.text+0x1e8): undefined reference to mraa_gpio_close’
/usr/bin/ld: gpio.c:(.text+0x1fc): undefined reference to mraa_deinit' /usr/bin/ld: gpio.c:(.text+0x248): undefined reference to mraa_result_print’
/usr/bin/ld: gpio.c:(.text+0x24c): undefined reference to `mraa_deinit’
collect2: error: ld returned 1 exit status

I asked you to execute the built example. For building the example on your own, you need to pass -lmraa flag. Anyway, the issue seems to be coming only from the Python interface. I will test it on my system tomorrow.

Is there anything that can be done today to solve this or move a step ahead in this?