[beagleboard] Re: GPIO JAVA library for Beaglebone Black

2021-06-29 Thread Dennis Lee Bieber
On Tue, 29 Jun 2021 07:02:06 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user Radovan Chovan
 wrote:

>Thanks for all your comments.
>
>Is there any mapping between /sys/class/gpio and schematic diagram of 
>Beaglebone Black board?
>
Does
https://vadl.github.io/beagleboneblack/2016/07/29/setting-up-bbb-gpio
provide any help.

>I want to use pin P9_24 (UART1_TXD) and P9_26 (UART1_RXD).
>https://beagleboard.org/static/beaglebone/BEAGLEBONE_SCHEM_A3.pdf (page 
>11/11)
>
P9_24 equates to GPIO15, but in raw pin numbering appears to be 97. As
I recall, there are 32 GPIOs per "CHIP", so that might be the 4th CHIP
(counting from 0), and the second GPIO (again, counting from 0)

>>> divmod(97, 32)
(3, 1)

P9_26 -> GPIO14, raw 96...

>>> divmod(96, 32)
(3, 0)
>>> 

HOWEVER, 
debian@beaglebone:~$ gpioinfo
gpiochip0 - 32 lines:
line   0:  "MDIO_DATA"   unused   input  active-high

line  12: "UART1_CTSN"  "P9_20"   input  active-high [used]
line  13: "UART1_RTSN"  "P9_19"   input  active-high [used]
line  14:  "UART1_RXD"  "P9_26"   input  active-high [used]
line  15:  "UART1_TXD"  "P9_24"   input  active-high [used]
line  16: "GMII1_TXD3"   unused   input  active-high

indicates that it is CHIP0, and the "line" 14/15 map to the GPIOxx (so for,
say, GPIO45 it becomes chip 1, line 13)

The gpioinfo command is provided by installing the gpiod package.


debian@beaglebone:~$
/opt/source/bb.org-overlays/tools/beaglebone-universal-io/config-pin -i
p9_26
Pin name: P9_26
Function if no cape loaded: gpio
Function if cape loaded: default gpio gpio_pu gpio_pd gpio_input uart can
i2c pru_uart pruin
Function information: gpio0_14 default gpio0_14 gpio0_14 gpio0_14 gpio0_14
uart1_rxd dcan1_tx i2c1_sda pru_uart pru1_in16
Kernel GPIO id: 14
PRU GPIO id: 46
debian@beaglebone:~$
/opt/source/bb.org-overlays/tools/beaglebone-universal-io/config-pin -i
p9_24
Pin name: P9_24
Function if no cape loaded: gpio
Function if cape loaded: default gpio gpio_pu gpio_pd gpio_input uart can
i2c pru_uart pruin
Function information: gpio0_15 default gpio0_15 gpio0_15 gpio0_15 gpio0_15
uart1_txd dcan1_rx i2c1_scl pru_uart pru0_in16
Kernel GPIO id: 15
PRU GPIO id: 47
debian@beaglebone:~$


(Unfortunately, that script doesn't tell one what "default" mode IS for the
pin, but does have more capability than the compiled config-pin that
replaces it)


-- 
Dennis L Bieber

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/vfamdgl62j1dvk417rb59nf514fba0o9ug%404ax.com.


Re: [beagleboard] Re: GPIO JAVA library for Beaglebone Black

2021-06-29 Thread Robert Heller
At Tue, 29 Jun 2021 07:02:06 -0700 (PDT) beagleboard@googlegroups.com wrote:

> 
> Thanks for all your comments.
> 
> Is there any mapping between /sys/class/gpio and schematic diagram of 
> Beaglebone Black board?

No.  /sys/class/gpio just uses the GPIO numbers.  The mapping of GPIO N.M is:

N*32+M

eg GPIO 2.05 is 69

> 
> I want to use pin P9_24 (UART1_TXD) and P9_26 (UART1_RXD).
> https://beagleboard.org/static/beaglebone/BEAGLEBONE_SCHEM_A3.pdf (page 
> 11/11)

If you want to use these pins as UART1, (the default), you can use /dev/ttyS1.

Otherwise you should use config-pin to select the mode:

For GPIO -- #0.15 for P9_24 and #0.14 for P9_26:

config-pin P9_24 gpio
config-pin P9_24 gpio_pu
config-pin P9_24 gpio_pd
config-pin P9_24 gpio_input
config-pin P9_26 gpio
config-pin P9_26 gpio_pu
config-pin P9_26 gpio_pd
config-pin P9_26 gpio_input

For CAN (can1)
config-pin P9_24 can
config-pin P9_26 can

For I2C (i2c1)

config-pin P9_24 i2c
config-pin P9_26 i2c



> 
> Dátum: Å¡tvrtok 24. júna 2021, Ä as: 18:11:14 UTC+2, odosielateľ: Dennis 
> Bieber
> 
> > On Thu, 24 Jun 2021 07:17:59 -0400 (EDT), in
> > gmane.comp.hardware.beagleboard.user Robert Heller
> >  wrote:
> >
> > >At Thu, 24 Jun 2021 03:47:49 -0700 (PDT) beagleboard-/
> > jypxa39uh5...@public.gmane.org wrote:
> > >
> > >> 
> > >> I have complex Java application where using GPIO is only part of it.
> > >
> > >OK, probably the "easiest" (and Linux-only) way to add GPIO access is use 
> > the 
> > >sysfs interface.
> > >
> > At least until the Linux developers remove it... My understanding is
> > that sysfs is currently "deprecated", the replacement being libgpiod -- a
> > "character" device driver.
> >
> > Unfortunately, for libgpiod, JAVA probably needs an interface library
> > to be created -- quick search finds
> > https://github.com/mattjlewis/diozero (though there are some mentions of
> > sysfs in the commentary, but perusing
> >
> > https://github.com/mattjlewis/diozero/blob/main/system-utils-native/src/main/c/com_diozero_internal_provider_builtin_gpio_NativeGpioDevice.c
> > appears to be the libgpiod chip devices).
> >
> > There is also this one https://github.com/sgjava/java-periphery
> >
> >
> > -- 
> > Dennis L Bieber
> >
> >
> 

-- 
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software-- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
hel...@deepsoft.com   -- Webhosting Services
  

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/20210629143630.C4591220CD0%40sharky4.deepsoft.com.


Re: [beagleboard] Re: GPIO JAVA library for Beaglebone Black

2021-06-29 Thread Robert Nelson
On Tue, Jun 29, 2021 at 9:02 AM Radovan Chovan  wrote:
>
> Thanks for all your comments.
>
> Is there any mapping between /sys/class/gpio and schematic diagram of 
> Beaglebone Black board?
>
> I want to use pin P9_24 (UART1_TXD) and P9_26 (UART1_RXD).
> https://beagleboard.org/static/beaglebone/BEAGLEBONE_SCHEM_A3.pdf (page 11/11)


Derek has this detail on these pdf's

https://github.com/derekmolloy/boneDeviceTree/tree/master/docs

https://github.com/derekmolloy/boneDeviceTree/blob/master/docs/BeagleboneBlackP9HeaderTable.pdf

Regards,

-- 
Robert Nelson
https://rcn-ee.com/

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CAOCHtYi9moXCmnGQJgxUpJZEdgXezBSG%3DpSfZd6N%3DZ-CVyK1WA%40mail.gmail.com.


[beagleboard] Re: GPIO JAVA library for Beaglebone Black

2021-06-29 Thread Radovan Chovan
Thanks for all your comments.

Is there any mapping between /sys/class/gpio and schematic diagram of 
Beaglebone Black board?

I want to use pin P9_24 (UART1_TXD) and P9_26 (UART1_RXD).
https://beagleboard.org/static/beaglebone/BEAGLEBONE_SCHEM_A3.pdf (page 
11/11)

Dátum: štvrtok 24. júna 2021, čas: 18:11:14 UTC+2, odosielateľ: Dennis 
Bieber

> On Thu, 24 Jun 2021 07:17:59 -0400 (EDT), in
> gmane.comp.hardware.beagleboard.user Robert Heller
>  wrote:
>
> >At Thu, 24 Jun 2021 03:47:49 -0700 (PDT) beagleboard-/
> jypxa39uh5...@public.gmane.org wrote:
> >
> >> 
> >> I have complex Java application where using GPIO is only part of it.
> >
> >OK, probably the "easiest" (and Linux-only) way to add GPIO access is use 
> the 
> >sysfs interface.
> >
> At least until the Linux developers remove it... My understanding is
> that sysfs is currently "deprecated", the replacement being libgpiod -- a
> "character" device driver.
>
> Unfortunately, for libgpiod, JAVA probably needs an interface library
> to be created -- quick search finds
> https://github.com/mattjlewis/diozero (though there are some mentions of
> sysfs in the commentary, but perusing
>
> https://github.com/mattjlewis/diozero/blob/main/system-utils-native/src/main/c/com_diozero_internal_provider_builtin_gpio_NativeGpioDevice.c
> appears to be the libgpiod chip devices).
>
> There is also this one https://github.com/sgjava/java-periphery
>
>
> -- 
> Dennis L Bieber
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/35d9167b-14d0-4aca-997f-769d5297330bn%40googlegroups.com.