UART4 on BBB with JAVA

Hi,

I would like to continue in discussion from https://groups.google.com/g/beagleboard/c/W29ZKdqQPng ( GPIO JAVA library for Beaglebone Black). I haven’t found this topic on new forum.

I am using Debian 10.3 with kernel 4.19.94-ti-r42 in Beaglebone Black with touchscreen GEN4-4DCAPE-70CT-CLB.

I would like to use GPIO pins P9_11 (UART4_RXD) and P9_13 (UART4_TXD) for serial communication.

I set these pins as uart via “config-pin”:

config-pin -q P9.11 && config-pin -q P9.13

Current mode for P9_11 is: uart
Current mode for P9_13 is: uart

(I set remembering of these modes after reboot: adafruit-beaglebone-io-python/run_config-pin_during_startup.md at master · adafruit/adafruit-beaglebone-io-python · GitHub )


I added uboot_overlay_addr2 to /boot/uEnv.txt for sure, but I don’t think it affects anything.
###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1

UART 4

uboot_overlay_addr2=/lib/firmware/BB-UART4-00A0.dtbo


I tried to use this JAVA example with RXTX library:

https://www.programmersought.com/article/80244401638/

final SerialPort serialPort = openSerialPort("/dev/ttyS4",9600);

But I didn’t receive anything.

What I miss?

Hello,

I am using the UART2 onboard the BBBW. I am receiving no error but getting no feedback or output as of now. I will keep this thread in mind for when promoting my findings.

Seth

After “java rxtx testing” I got this error for config-pin:

root@beaglebone:~# config-pin -q P9.11
ERROR: open() for /sys/devices/platform/ocp/ocp:P9_11_pinmux/state failed, No such file or directory
root@beaglebone:~# config-pin -q P9.13
ERROR: open() for /sys/devices/platform/ocp/ocp:P9_13_pinmux/state failed, No such file or directory

Please run and report the output of:

sudo /opt/scripts/tools/version.sh

Hello,

Here is the javac and java -version I have on my BBBW now: “11.0.11”.

Now, I would like this version: jdk1.8.0_291

So, I thought it was as simple as this:

sftp or scp the .tar file to the BBBW, then tar -xvf .tar file, and finally adding the PATH. I have tried numerous, different ways all of which are two years old (out dated).

Seth

P.S. version.sh


git:/opt/scripts/:[80d937707b4c91677fbacc2be59d6000c7bad008]
eeprom:[A335BNLTBWA51650BBWG2883]
model:[TI_AM335x_BeagleBone_Black_Wireless]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot SPL 2019.04-00002-g07d5700e21 (Mar 06 2020 - 11:24:55 -0600)]:[location                                                                                                            : dd MBR]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0]
UBOOT: Loaded Overlay:[BB-BBBW-WL1835-00A0]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0]
UBOOT: Loaded Overlay:[BB-HDMI-TDA998x-00A0]
kernel:[4.19.94-ti-r64]
nodejs:[v10.24.0]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20210416.0-0~buster+20210416]
pkg:[bb-customizations]:[1.20210708.0-0~buster+20210708]
pkg:[bb-usb-gadgets]:[1.20200504.0-0~buster+20200504]
pkg:[bb-wl18xx-firmware]:[1.20210520.0-0~buster+20210520]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.5-git20200715.0-0~buster+20200716]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm                                                                                                             eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_poo                                                                                                            l=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[   66.106443] remoteproc remoteproc0: wkup_m3 is available
[   66.435891] remoteproc remoteproc0: powering up wkup_m3
[   66.435926] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[   66.436214] remoteproc remoteproc0: remote processor wkup_m3 is now up
[   69.023765] remoteproc remoteproc1: 4a334000.pru is available
[   69.026102] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[   69.023765] remoteproc remoteproc1: 4a334000.pru is available
[   69.023934] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[   69.026102] remoteproc remoteproc2: 4a338000.pru is available
[   69.026280] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[    0.954900] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[    0.968574] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

Are there any surefire ways anyone knows about to get jdk8 on the BBBW?

    root@beaglebone:~# sudo /opt/scripts/tools/version.sh

git:/opt/scripts/:[b39ec679648a6be8f25f48bd1c9784c1fc5a0c46]
eeprom:[A335BNLT000C2104BBBG0383]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0]
UBOOT: Loaded Overlay:[BB-BONE-4D7C-01-00A1]
UBOOT: Loaded Overlay:[BB-UART4-00A0]
kernel:[4.19.94-ti-r42]
nodejs:[v10.15.2]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr2=/lib/firmware/BB-UART4-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>] 
pkg:[bb-cape-overlays]:[4.14.20210416.0-0~buster+20210416]
pkg:[bb-wl18xx-firmware]:[1.20210520.0-0~buster+20210520]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.5-git20200715.0-0~buster+20200716]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait uboot_detected_capes=BB-BONE-4D7C-01, coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[   66.961679] remoteproc remoteproc0: wkup_m3 is available
[   67.407861] remoteproc remoteproc0: powering up wkup_m3
[   67.407894] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[   67.408168] remoteproc remoteproc0: remote processor wkup_m3 is now up
[   69.602307] remoteproc remoteproc1: 4a334000.pru is available
[   69.611025] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[   69.602307] remoteproc remoteproc1: 4a334000.pru is available
[   69.602462] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[   69.611025] remoteproc remoteproc2: 4a338000.pru is available
[   69.611215] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[    1.203165] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[    1.216891] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

With this enabled, you already have it configured as a uart on P9.11/P9.13, why are you running config-pin?

Regards,

Good Luck.

Regards,

1 Like

I comment out line #uboot_overlay_addr2=/lib/firmware/BB-UART4-00A0.dtbo. Error “ERROR: open() for /sys/devices/platform/ocp/ocp:P9_11_pinmux/state failed, No such file or directory” disappears and this file exists in /sys/devices/platform/ocp.
But nothing new with funcionality in java. I doesn’t receive anything.

For info:
java version “1.8.0_211”
Java™ SE Embedded Runtime Environment (build 1.8.0_211-b12)

It’s your personal choice weather to use BB-UART4-00A0.dtbo or config-pin, i recommend to use a specific overlay.

I don’t use Java…

Regards,

Hello @RobertCNelson ,

Thank you for this idea. I will test soon.

Seth

It finally works. I received data. I had mirrored connection between gpio pins on GEN4-4DCAPE-70CT-CLB board all the time.

Hello @RobertCNelson ,

It works!

Seth