Skip to content

after cleanup voltage still on pin #66

@gek47

Description

@gek47

Set pin pull to to UP and cleanup does set the bias to the correct state but voltage is still on the pin.
I was seeing odd behavior, so I check the pin with a VOM and shows 3.28 volts after cleanup.
If I call setbias(pin, GPIO_DISABLE) before cleanup no voltage.

Test setup is Raspberry PI 4B 4GB, Archlinux Arm aarch64 mainline kernel

$ uname -a
Linux landmine 5.19.8-1-aarch64-ARCH #1 SMP PREEMPT Thu Sep 8 18:20:33 MDT 2022 aarch64 GNU/Linu


import RPi.GPIO as GPIO
import time   

GPIO.setmode(GPIO.BCM)

print(f"PUD_OFF:  {GPIO.PUD_OFF}")
print(f"PUD_UP:   {GPIO.PUD_UP}")
print(f"PUD_DOWN: {GPIO.PUD_DOWN}")


TEST_PIN = 26
GPIO.setup(TEST_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)

time.sleep(2)
print(f"before cleanup getbias: {GPIO.getbias(TEST_PIN)}")

print(f"before cleanup getdirection: {GPIO.getdirection(TEST_PIN)}")

GPIO.cleanup()

time.sleep(2)


time.sleep(2)
print(f"after cleanup getbias: {GPIO.getbias(TEST_PIN)}")

print(f"after cleanup getdirection: {GPIO.getdirection(TEST_PIN)}")


Output:
PUD_OFF:  1
PUD_UP:   3
PUD_DOWN: 4
before cleanup getbias: 3
before cleanup getdirection: 2
after cleanup getbias: 1
after cleanup getdirection: -1

Thanks
GEK

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions