Internal pull-up resistors not working
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
rpi.gpio (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Consider the 3 following scripts :
1~~~~~~
#!/bin/python3
from gpiozero import Button
import time
import os
stopButton = Button (17)
while True:
if stopButton.
os.system ("sudo shutdown now -h")
time.sleep (1)
exit (1)
2~~~~~~
#!/bin/python3
import RPi.GPIO as GPIO
import os
import time
from threading import Thread
GPIO.setwarnings (False)
GPIO.setmode (GPIO.BCM)
shutdown_pin = 26
GPIO.setup (shutdown_pin, GPIO.IN, pull_up_
def shutdown_check():
while True:
if pulsetime >=2 and pulsetime <=3:
try:
t1 = Thread (target = shutdown_check)
t1.start ()
except:
t1.stop ()
exit (0)
3~~~~~~
#!/bin/python3
import RPi.GPIO as GPIO
import time
import os
GPIO.setmode (GPIO.BCM)
GPIO.setup (17, GPIO.IN, pull_up_down = GPIO.PUD_UP)
def Shutdown (channel):
print ("Shutting down...")
os.system ("echo $(date) >> shutdown.log")
time.sleep (3)
os.system ("sudo shutdown now -h")
exit (0)
GPIO.add_
while 1:
time.sleep (1)
exit (1)
~~~~~~~
The above scripts are common shutdown scripts that can be found on the web, utilizing an NO pushbutton connected to GPIO 26 and ground (physical 37). None of the above scripts work though, since the internal pull-up resistors don't seem to work, and the GPIOs always read LOW. My setup has been tested twice in Raspberry Pi OS (the resistors worked there, measured with a scope). gpiozero uses rpi.gpio as the pin factory. A different pin was tested too.
UPDATE: The pip3 version of RPi.GPIO (and gpiozero) works fine.
ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: python3-rpi.gpio 0.6.5-1ubuntu3
ProcVersionSign
Uname: Linux 5.4.0-1021-raspi aarch64
ApportVersion: 2.20.11-0ubuntu27.9
Architecture: arm64
CasperMD5CheckR
Date: Wed Oct 14 20:27:59 2020
ImageMediaBuild: 20200731
ProcEnviron:
TERM=alacritty
PATH=(custom, no user)
XDG_RUNTIME_
LANG=C.UTF-8
SHELL=/bin/bash
SourcePackage: rpi.gpio
UpgradeStatus: No upgrade log present (probably fresh install)
summary: |
- RPi.GPIO doesn't detect falling edge (wait_for_edge, add_event_detect) + Internal pull-up resistors not working |
description: | updated |
description: | updated |
Status changed to 'Confirmed' because the bug affects multiple users.