GPIO issue with some pins

lucarossetto
lucarossetto New Member Posts: 4

Hi all,

I have to set some pins of the gpio to use them as output with the mraa library (with python) to use a hat; the pins are:

MRAA no. Function Rpi GPIO Sysfs GPIO mraa device
11 UART_RTS 17 478 UART0
13 GPIO(27) 27 432
15 GPIO(22) 22 431
16 PWM3 23 471 PWM3

Extract from https://github.com/eclipse/mraa/blob/master/docs/up2.md#pin-mapping

I'm using ubuntu 20.04 and kernel 5.4
uname -a:

Linux es 5.4.0-1-generic #0~upboard5-Ubuntu SMP Fri Jan 7 11:53:57 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a:

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

mraa-gpio version:

Version v2.1.0 on Unknown platform

I followed the kernel installation guide (https://github.com/up-board/up-community/wiki/Ubuntu_20.04#install-ubuntu-kernel-540-from-ppa-on-ubuntu-2004) and the mraa guide (https://github.com/eclipse/mraa#installing-on-ubuntu *except for node-mraa for which the installer couldn't find a candidate)

I have also set in bios the pins as gpio (and not pwn3 or uart) and configured this as output:
image
image
image
image

As I wrote before I need to command the 4 gpio pins, but 2 works correctly (pin 11, 16) and two do not (pin 13, 15)
This is the script:

#!/usr/bin/env python

# Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
# Copyright (c) 2018 Linaro Ltd.
#
# SPDX-License-Identifier: MIT
#
# Example Usage: Toggles GPIO 23 and 24 continuously in an alternative pattern

import mraa
import time

# initialise gpio
gpio_1 = mraa.Gpio(432, owner=False, raw = True)

gpio_2 = mraa.Gpio(430, owner=False, raw = True)
# set gpio to output
gpio_1.dir(mraa.DIR_OUT)

# set gpio to input
gpio_2.dir(mraa.DIR_IN)

# toggle gpio
while True:
    gpio_1.write(1)

    time.sleep(1)

    print(gpio_2.read())

    gpio_1.write(0)

    time.sleep(1)

    print(gpio_2.read())

I tried with system command too

echo 432 > /sys/class/gpio/export 
echo out > /sys/class/gpio/gpio432/direction
echo 1 > /sys/class/gpio/gpio432/value 

For pin 11 and 16 all works and I see the output to 3,3V but for pin 13 and 15 the command seems to be written but the output remain to 0V

Someone can help me?

Thanks a lot for your help

Answers

Privacy Policy