Quantcast
Viewing all articles
Browse latest Browse all 5216

Device Tree • MCP23S17 overly read / write IOs

Hi,
i am using the mcp23s17 overlay like this.
My spi bus where it is connected is 1 and the CS 0. The INTA is connected to GPIO16.

Code:

dtoverlay=mcp23s17:s17-spi1-0-present,s17-spi1-0-int-gpio=16
When i use gpiomon i get the folling output

Code:

gpiomon gpiochip2 3event: FALLING EDGE offset: 3 timestamp: [     895.580064007]event: FALLING EDGE offset: 3 timestamp: [     895.659337875]event: FALLING EDGE offset: 3 timestamp: [     896.010151430]event:  RISING EDGE offset: 3 timestamp: [     896.016530761]
So i take pin 3 to ground.
My question now is, how can i permanently say that the pin is active_low.

Code:

gpioinfo gpiochip2gpiochip2 - 16 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       unused   input  active-high        line   7:      unnamed       unused   input  active-high        line   8:      unnamed       unused   input  active-high        line   9:      unnamed       unused   input  active-high        line  10:      unnamed       unused   input  active-high        line  11:      unnamed       unused   input  active-high        line  12:      unnamed       unused   input  active-high        line  13:      unnamed       unused   input  active-high        line  14:      unnamed       unused   input  active-high        line  15:      unnamed       unused   input  active-high
And how can i use for example java pi4j PIGPIO or LINUX FS

PiGpioDigitalInputProvider.newInstance(piGpio),
PiGpioDigitalOutputProvider.newInstance(piGpio)

to read / write the IOs.
And what is the name of GPIOs?

Code:

grep -d skip . /sys/class/gpio/*/*/sys/class/gpio/gpiochip0/base:0/sys/class/gpio/gpiochip0/label:pinctrl-bcm2711/sys/class/gpio/gpiochip0/ngpio:58/sys/class/gpio/gpiochip488/base:488/sys/class/gpio/gpiochip488/label:mcp23s17.0/sys/class/gpio/gpiochip488/ngpio:16/sys/class/gpio/gpiochip504/base:504/sys/class/gpio/gpiochip504/label:raspberrypi-exp-gpio/sys/class/gpio/gpiochip504/ngpio:8
So the IOs starts on base 488 till 503. But how can i bind them to input listener or output writer?

Thanks for your help.

Statistics: Posted by mistermaek — Thu Feb 29, 2024 12:38 pm



Viewing all articles
Browse latest Browse all 5216

Trending Articles