Moode Forum
[PROBLEM] GPIO busy - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: [PROBLEM] GPIO busy (/showthread.php?tid=7161)



GPIO busy - chano22000 - 12-02-2024

Hi,

I was running Moode 8.3.6 without any major issue and did a fresh install of Moode 9.1.5. I now face an error when running a startup script (as the last command in /etc/rc.local) which initializes the handling of an ATX-like Audiophonics Pi power supply board (https://www.audiophonics.fr/en/power-supply-modules/audiophonics-pi-spc-reg-power-management-power-supply-for-raspberry-pi-p-11504.html).

Executing the script manually (through Windows / Putty) gives the following "GPIO busy" error :

Code:
pi@moode:~ $ python /home/pi/spc_moode.py
Traceback (most recent call last):
 File "/home/pi/spc_moode.py", line 27, in <module>
   GPIO.setup(17, GPIO.IN)
 File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 696, in setup
   _check(lgpio.gpio_claim_input(_chip, gpio, {
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/usr/lib/python3/dist-packages/lgpio.py", line 755, in gpio_claim_input
   return _u2i(_lgpio._gpio_claim_input(handle&0xffff, lFlags, gpio))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/usr/lib/python3/dist-packages/lgpio.py", line 458, in _u2i
   raise error(error_text(v))
lgpio.error: 'GPIO busy'


where spc_moode.py and line 27 are :
Code:
#!/usr/bin/python3
# MoOde 7
# All-in-One script for Audiophonics SPC II power management board
# Modded 2020-01-24 by Ph. Deysine
# Shutdown Button handled by overlay to be added in /boot/config.txt :
# dtoverlay=gpio-shutdown,gpio_pin=17,active_low=0,gpio_pull=down
#
# Start the script without parameter to initialise :
# - GPIO outputs 4 (SofthutDown) and 22 (BootOK)
# - GPIO input 17 (Shutdown Button)
# Power LED stops blinking when MoOde is ready
#
# "spc_moode.py reboot" to reboot
#
# "spc_moode.py shutdown" to shutdown


import sys
import os
import time
import RPi.GPIO as GPIO
import subprocess

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
GPIO.setup(17, GPIO.IN)  <----line 27
GPIO.setup(22, GPIO.OUT)

.../...

Does it mean that Moode v9 now takes some exclusive handling of the (input) GPIO ports, or ...?
(GPIO buttons are left as is which means "not selected" in Moode/Configure/Peripherals/Other Peripherals)

Thank you very much for your help as I have limited knowledge of Linux and Raspberry OS apart from some memory of early Unix systems  Confused  !

Best regards.

Philippe


RE: GPIO busy - Tim Curtis - 12-02-2024

Your best bet is to contact Audiophonics since its their script thats failing.