gpiod for pull-up and pull-down

Hi I’m starting with BBB and trying to config pins with python and gpiod, I can modify de direction but the bias has no change, I tried LINE_REQ_FLAG_BIAS_DISABLE, LINE_REQ_FLAG_BIAS_PULL_DOWN, LINE_REQ_FLAG_BIAS_PULL_UP.

uname -a Linux BeagleBone 5.10.168-ti-r72 #1bullseye SMP PREEMPT Sat Sep 30 03:37:21 UTC 2023 armv7l GNU/Linux

import gpiod
import time

chip=gpiod.Chip('gpiochip0')
pin = chip.get_line(30)
pin.request(consumer='foobar', type=gpiod.LINE_REQ_DIR_IN, flags=gpiod.LINE_REQ_FLAG_BIAS_PULL_DOWN)

while True:
          time.sleep(1)

Connect a 4.7k ohm resistor to the pin and the +3.3v bus.

$ sudo gpiodetect
[sudo] password for fred: 
gpiochip0 [30200000.gpio] (32 lines)
gpiochip1 [30210000.gpio] (32 lines)
gpiochip2 [30220000.gpio] (32 lines)
gpiochip3 [30230000.gpio] (32 lines)
gpiochip4 [30240000.gpio] (32 lines)
gpiochip5 [2-0020] (8 lines)

find your pin and note the line and gpiochip

$sudo gpioinfo gpiochip1
gpiochip1 - 32 lines:
	line   0:      unnamed       unused   input  active-high 
	line   1:      unnamed       unused   input  active-high 
	line   2:      unnamed       unused   input  active-high 
	line   3:      unnamed       unused   input  active-high 
	line   4:      unnamed       unused   input  active-high 
	line   5:      unnamed       unused   input  active-high 
	line   6:      unnamed        "scl"  output  active-high [used open-drain]
	line   7:      unnamed        "sda"   input  active-high [used]
	line   8:      unnamed       unused  output  active-high 
	line   9:      unnamed       unused  output  active-high 
	line  10:      unnamed       unused   input  active-high 
	line  11:      unnamed       unused   input  active-high 
	line  12:      unnamed   "VSD_VSEL"  output  active-high [used]
	line  13:      unnamed       unused   input  active-high 

Now, manually toggle the pin using this with your line number and gpiochip<n>

$sudo gpioset gpiochip1 <line number here>=1
$sudo gpioset gpiochip1 <line number here>=0

If you do not see any change you will have to modify the device tree.

When I execute the python file, I can see with gpioinfo the effect

debian@BeagleBone:~$ gpioinfo gpiochip0 | grep 30
        line  30: "P9_11 [uart4_rxd]" "foobar" input active-high [used pull-down]

but I measure 3.3V on the pin and show-pins utility shows

debian@BeagleBone:~$ show-pins | grep P9.11
P9.11                             28 fast rx  up  7 gpio 0.30 << hi  foobar (pinmux_P9_11_gpio_pu_pin)

if I use debian@BeagleBone:~$ config-pin P9_11 gpio_pd it works and I can see the change with show-pins command