Ubuntu 22.04 mraa

New Member Posts: 3

Hello,

I'm having issues trying to get GPIO functionality on Ubuntu 22.04 working. I installed the pinctrl package and built & installed mraa from source, but running mraa-gpio list gives me "no pins". The mraa examples also seem to error out not being able to find pins. Any solutions?

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • New Member Posts: 4
  • New Member Posts: 4
    edited April 2023

    In the past, I believe the correct way to do this was to use the UP fork of mraa. However, I just tried this with sudo add-apt-repository ppa:up-division/mraa and was notified that there is no Jammy release file for it. Which makes it sound like Ubuntu 22.04 isn't being supported?

  • New Member Posts: 3

    I tried building the up version of mraa for 22.04 and still can't detect pins. Is there an alternative to using mraa on 22.04 for pin/spi control?

  • New Member, Moderator, AAEON Posts: 82 admin

    @justinGE
    install UP HAT pinctrl-upboard driver
    https://github.com/up-division/pinctrl-upboard

    build and install mraa from up-rpi branch
    https://github.com/up-division/mraa/tree/up-rpi

    GPIO mapping is the same in all upboards with new pinctrl-upboard driver, you can refer our wiki for GPIO number
    https://github.com/up-board/up-community/wiki/40Pin-Header

  • New Member Posts: 3

    That worked, thanks! There is one more issue though. The board will now hang on shutdown/reboot after installing the up-extra package to enable user-space GPIO access.

  • New Member, Moderator, AAEON Posts: 82 admin

    @justinGE
    could you take a screenshot to see if there any information to know hang in where?

  • New Member Posts: 2

    Hello,
    A new UP-user here. Thank you for your instructions.

    I tried setting up the driver and use "up-rpi" branch for building. Although I get the list of pins (not all), I am still not able to exrecise control over the GPIOs. I tried with both mraa-gpio set <pin> out mraa-gpio setraw <pin> 1

    This is the output I get from the terminal
    Could not initialize gpio 13

    mraa-gpio list <br> 00 ID_SD: GPIO I2C 01 ID_SC: GPIO I2C 02 I2C_SDA: GPIO I2C 03 I2C_SCL: GPIO I2C 04 ADC0: GPIO AIO 05 GPIO5: GPIO 06 GPIO6: GPIO 07 SPI_CS1: GPIO SPI 08 SPI_CS0: GPIO SPI 09 SPI_MISO: GPIO SPI 10 SPI_MOSI: GPIO SPI 11 SPI_CLK: GPIO SPI 12 PWM0: GPIO PWM 13 PWM1: GPIO PWM 14 UART_TX: GPIO UART 15 UART_RX: GPIO UART 16 UART_CTS: GPIO UART 17 UART_RTS: GPIO UART 18 I2S_CLK: GPIO 19 I2S_FRM: GPIO 20 I2S_DIN: GPIO 21 I2S_DOUT: GPIO 22 GPIO22: GPIO I2C 23 GPIO23: GPIO 24 GPIO24: GPIO 25 GPIO25: GPIO 26 GPIO26: GPIO 27 GPIO27: GPIO

    mraa-gpio set 13 out Could not initialize gpio 13

    as this throwed a permission issue (even after adding gpio group to sudo, I tried running it as root.

    'sudo mraa-gpio set 13 out
    Could not initialize gpio 13'

    -- corresponding syslog

    libmraa version v2.1.0-24-gf0f62c4 initialised by user 'bmterra' with EUID 1000 Aug 09 08:22:38 frosst2906 libmraa[22898]: UP Xtreme: Platform failed to find I2C0 controller Aug 09 08:22:38 frosst2906 libmraa[22898]: UP Xtreme: Platform failed to find I2C0 controller Aug 09 08:22:38 frosst2906 libmraa[22898]: UP Xtreme: Platform failed to find I2C1 controller Aug 09 08:22:38 frosst2906 libmraa[22898]: UP Xtreme: Platform failed to find I2C1 controller Aug 09 08:22:38 frosst2906 libmraa[22898]: Adding i2c bus found on i2c-3 on adapter i2c_designware.4 Aug 09 08:22:38 frosst2906 libmraa[22898]: Adding i2c bus found on i2c-5 on adapter i2c_designware.6 Aug 09 08:22:38 frosst2906 libmraa[22898]: Adding i2c bus found on i2c-2 on adapter i2c_designware.3 Aug 09 08:22:38 frosst2906 libmraa[22898]: up: Failed to find pin name I2C2_SDA Aug 09 08:22:38 frosst2906 libmraa[22898]: up: Failed to find pin name I2C2_SCL Aug 09 08:22:38 frosst2906 libmraa[22898]: up boards: kernel pinctrl driver available Aug 09 08:22:38 frosst2906 libmraa[22898]: Checking additional Platform support for LEC-AL iPI Aug 09 08:22:38 frosst2906 libmraa[22898]: gpio: platform doesn't support chardev, falling back to sysfs Aug 09 08:22:38 frosst2906 libmraa[22898]: libmraa initialised for platform 'UP' of type 12 Aug 09 08:23:22 frosst2906 libmraa[22992]: libmraa version v2.1.0-24-gf0f62c4 initialised by user 'bmterra' with EUID 1000 Aug 09 08:23:22 frosst2906 libmraa[22992]: UP Xtreme: Platform failed to find I2C0 controller Aug 09 08:23:22 frosst2906 libmraa[22992]: UP Xtreme: Platform failed to find I2C0 controller Aug 09 08:23:22 frosst2906 libmraa[22992]: UP Xtreme: Platform failed to find I2C1 controller Aug 09 08:23:22 frosst2906 libmraa[22992]: UP Xtreme: Platform failed to find I2C1 controller Aug 09 08:23:22 frosst2906 libmraa[22992]: Adding i2c bus found on i2c-3 on adapter i2c_designware.4 Aug 09 08:23:22 frosst2906 libmraa[22992]: Adding i2c bus found on i2c-5 on adapter i2c_designware.6 Aug 09 08:23:22 frosst2906 libmraa[22992]: Adding i2c bus found on i2c-2 on adapter i2c_designware.3 Aug 09 08:23:22 frosst2906 libmraa[22992]: up: Failed to find pin name I2C2_SDA Aug 09 08:23:22 frosst2906 libmraa[22992]: up: Failed to find pin name I2C2_SCL Aug 09 08:23:22 frosst2906 libmraa[22992]: up boards: kernel pinctrl driver available Aug 09 08:23:22 frosst2906 libmraa[22992]: Checking additional Platform support for LEC-AL iPI Aug 09 08:23:22 frosst2906 libmraa[22992]: gpio: platform doesn't support chardev, falling back to sysfs Aug 09 08:23:22 frosst2906 libmraa[22992]: libmraa initialised for platform 'UP' of type 12 Aug 09 08:23:22 frosst2906 libmraa[22992]: gpio13: init: Failed to open 'export' for writing: Permission denied Aug 09 08:23:30 frosst2906 sudo[23073]: bmterra : TTY=pts/3 ; PWD=/sys/class/gpio ; USER=root ; COMMAND=/usr/local/bin/mraa-gpio set 13 out Aug 09 08:23:30 frosst2906 sudo[23073]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000) Aug 09 08:23:30 frosst2906 libmraa[23075]: libmraa version v2.1.0-24-gf0f62c4 initialised by user 'root' with EUID 0 Aug 09 08:23:30 frosst2906 kernel: export_store: invalid GPIO 13 Aug 09 08:23:30 frosst2906 libmraa[23075]: UP Xtreme: Platform failed to find I2C0 controller Aug 09 08:23:30 frosst2906 libmraa[23075]: UP Xtreme: Platform failed to find I2C0 controller Aug 09 08:23:30 frosst2906 libmraa[23075]: UP Xtreme: Platform failed to find I2C1 controller Aug 09 08:23:30 frosst2906 libmraa[23075]: UP Xtreme: Platform failed to find I2C1 controller Aug 09 08:23:30 frosst2906 libmraa[23075]: Adding i2c bus found on i2c-3 on adapter i2c_designware.4 Aug 09 08:23:30 frosst2906 libmraa[23075]: Adding i2c bus found on i2c-5 on adapter i2c_designware.6 Aug 09 08:23:30 frosst2906 libmraa[23075]: Adding i2c bus found on i2c-2 on adapter i2c_designware.3 Aug 09 08:23:30 frosst2906 libmraa[23075]: up: Failed to find pin name I2C2_SDA Aug 09 08:23:30 frosst2906 libmraa[23075]: up: Failed to find pin name I2C2_SCL Aug 09 08:23:30 frosst2906 libmraa[23075]: up boards: kernel pinctrl driver available Aug 09 08:23:30 frosst2906 libmraa[23075]: Checking additional Platform support for LEC-AL iPI Aug 09 08:23:30 frosst2906 libmraa[23075]: gpio: platform doesn't support chardev, falling back to sysfs Aug 09 08:23:30 frosst2906 libmraa[23075]: libmraa initialised for platform 'UP' of type 12 Aug 09 08:23:30 frosst2906 libmraa[23075]: gpio13: init: Failed to write to 'export': Invalid argument Aug 09 08:23:30 frosst2906 sudo[23073]: pam_unix(sudo:session): session closed for user root

    Could you help me out here? Many thanks in advance

  • New Member Posts: 2
    edited August 2024

    @garyw

    Thank you for the instructions on bringing up the GPIO for UP-board.
    I followed your instructions but I do still fall into some issue.

    To start with, this is the output I get when I list out my GPIOs

    when I try to set the pin 13 as output, at first I get a permission error even though the group gpio is added to sudo.


    and then, I try it as root,


    could you throw some light on this?
    Thanks a lot in advance :-)

Welcome!

It looks like you're new here. Sign in or register to get started.
Privacy Policy