Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Problem: GPIO Handler Issue
#1
Hi Guys,
This is my first time using this software and my first time on the forum so please forgive any silly mistakes. I am running 6.7.1 on a pi 3 b+.
I am not able to get the gpio pins to carry out the instructions set in the configuration. I have set multiple pins with the instruction:
 "sudo, poweroff"
This does not seem to work, regardless of if I bring this pin to 3.3V or Gnd. I have been able to SSH in to the board and use all commands from there however. Is there anything I have overlooked or has anyone got any experience with this problem before?
Thanks,
    Ciarán
Reply
#2
Try without sudo
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
Hi Tim, 
Cheers for such a quick reply, I put this question up late at night hoping for an answer maybe by end of work the next day but ye are lightning fast.
I tried removing sudo with no effect. I've also tried other commands such as mpc play etc and these don't seem to be workings when I connect my pin to Gnd or 3.3v.
Would there be anything in the settings which might default to off which would make moode ignore gpio pins entirely or do you have any other suggestions on what might fix this issue
Reply
#4
Very odd. Maybe some sort of hardware issue.

You could try to run the button handler manually and see of it prints any error messages.

1. Turn it off in System Config
2. Run the command below

Code:
sudo /var/www/command/gpio-buttons.py
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#5
(09-10-2020, 11:26 AM)Tim Curtis Wrote: Very odd. Maybe some sort of hardware issue.

You could try to run the button handler manually and see of it prints any error messages.

1. Turn it off in System Config
2. Run the command below

Code:
sudo /var/www/command/gpio-buttons.py
I was afraid of this being a hardware issue, my gpio pins are working, as I am able to connect 5 and 6 to wake the board so I am hopeful that it isnt the case. I will try running the handler manually this evening and report back.
Reply
#6
If you want to check if the hardware is still functioning, you can use the command tool gpio.
Needs admins rights so call it with sudo in front of it.

It the hardware is ok but the scripts gives problems, you can also use an overlay for it, by adding adding a line like to /boot/config:
dtoverlay=gpio-shutdown,gpio_pin=22,active_low=0,gpio_pull=off

Exact settings depend on you system button wiring.

Check /boot/overlays/README for more documentation about the overlays, contains some neat tricks ;-)
Reply
#7
Okay so I tried the suggestions above.
For Tim's suggestion of running buttons.py I got back:
"2020-09-10 18:36:37 sw_1: pin=7, enabled=1, bounce_time=1000, CMD=poweroff"  but still no response from my button. The console was then in a loop so I had to ctrl-c out.
As regards bitlabs suggestion I checked out the gpios with a gpio readall before and after pressing the button. This brought the voltage on my chosen pin 7 from 1v to 0v.
I then customised the line of code for config.txt  tosuit my situation but to no effect unfortunately although I am fuzzy as to what the last param should be set to.

I have now set gpio_pull=up which has fixed my issue and I now have a working power button
Still wondering what was wrong with the gpio handler, but I am able to work around it.
Thanks guys
Reply
#8
Below is from the ( i ) in GPIO Config

NOTE: Use a comma to delimit arguments in the CMD field. Example: mpc,load,My Playlist
SAVE: Update the button configuration and restart GPIO button handler.

GPIO Pins

- The GPIO button handler configures pins as input / pull-up.
- The pins are 3V3. Pins GPIO2 and GPIO3 have fixed pull-up resistors.
- At power on the pins are set to input mode, pins 0-8 are pull-ups to 3V3, pins 9-27 are pull-downs to 0V.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: