[+ivan +andreas]

On 16/09/2021 10:01, Guillaume Gardet wrote:
Hi,

-----Original Message-----
From: Peter Suetterlin <[email protected]>
Sent: 15 September 2021 17:52
To: [email protected]
Subject: GPIO trouble


   Hi list,

slowly trying to get known with my Pi 4 running Tumbleweed.
I added a fan, and wanted to control it via GPIO.  But I fail to actually 
control the
pins :(

I was trying to follow this description:
https://howchoo.com/g/ote2mjkzzta/control-raspberry-pi-fan-temperature-
python
that uses GIOP17.  So I installed the needed 'gpiozero' python package using 
pip.

Trying the command 'pinout' that is part of it results in an error:

Unable to initialize GPIO Zero. This usually means that you are not running 
pinout
on a Raspberry Pi. If you still wish to run pinout, set the GPIOZERO_PIN_FACTORY
environment variable to 'mock' and retry, or refer to the Remote GPIO section of
the manual* to configure your environment to remotely access your Pi.

So I export GPIOZERO_PIN_FACTORY=mock, then I get a pinout listed, I can run
python, and with  from gpiozero import OutputDevice  fan = OutputDevice(17) I
can use fan.on(), fan.off() or fan.value to set/read the state.
Just the pin doesn't do anything, it always stays low :(

So I wanted to get most basic and tried
  echo 17 > /sys/class/gpio/export
but that gave me only "write error: Invalid argument"

Indeed the directory only lists
   Pi4:~ # ls /sys/class/gpio
   export  gpiochip446  gpiochip454  unexport

which suggests lowest GPIO available is 446!?

What am I missing?

Did you have a look at https://en.opensuse.org/openSUSE:GPIO for standard 
packages to access GPIO instead of downstream, RPi specific, software?

You can use 'gpioinfo gpiochip446' and 'gpioinfo gpiochip454' to get info about 
the gpio available.

You can try to use an offset of 446, so try to set gpio 463 (446 + 17). Not 
sure why there is such an offset, though.
Matthias, any idea?


Unfortunately not. Maybe it would be something worth to investigate as users regularly get confused about that.

I remember that we had that discussion in the past, but can't recall what was the outcome. Andreas do you remember?

Regards,
Matthias

Cheers,
Guillaume

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

Reply via email to