Problems in beaglebone black GPIO configration

HI ,I have a beaglebone black board and I want to control P9_15(GPIO48) outputing high or low levels by Johnny5 . I am a new user of beaglebone black board and Node-RED, there are some problems in configuring gpio out node of Johnny5. My current flow is simple as follows:

[{"id":"f5e61d75.93bc1","type":"tab","label":"Flow1","disabled":false,"info":""},{"id":"5aada02c.0fd5","type":"inject","z":"f5e61d75.93bc1","name":"ON","topic":"x","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":180,"wires":[["4a75b5cb.32488c"]]},{"id":"4a75b5cb.32488c","type":"gpio out","z":"f5e61d75.93bc1","name":"P9-15","state":"OUTPUT","pin":"48","i2cDelay":"0","i2cAddress":"","i2cRegister":"","outputs":0,"board":"cc553fd0.3e82a","x":510,"y":200,"wires":[]},{"id":"6551b710.a6e528","type":"inject","z":"f5e61d75.93bc1","name":"OFF","topic":"x","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":240,"wires":[["4a75b5cb.32488c"]]},{"id":"cc553fd0.3e82a","type":"ioplugin","z":"","name":"","username":"","password":"","boardType":"beaglebone-io","serialportName":"","connectionType":"local","mqttServer":"","pubTopic":"","subTopic":"","tcpHost":"","tcpPort":"","sparkId":"","sparkToken":"","beanId":"","impId":"","uuid":"","token":"","sendUuid":"","samplingInterval":"100"}]

I don’t sure how to configure gpio out node of Johnny5. When I edit gpio out node of Johnny5, there have some Properties need to be configured including Pin parameter. At first, I thought the Pin parameter should be filled with the 48 (number format). But after deployment, I clickd on the inject ON node and found an error message in the system as follows: msg : error."TypeError: Cannot read property 'index' of undefined".


So, I changed the Pin parameter to P9_15 and GPIO_48 (symbol format). But after deployment, the following error message appeared when clicking on inject ON node: msg : error "Error: EACCES: permission denied, open '/sys/devices/platform/ocp/ocp:P9_15_pinmux/state'".


I think this problem should not be caused by inject ON node. it should be caused by a GPIO configuration error.but I don’t know how to correct. I hope someone can help me solve this problem, because if I can't control GPIO, then I can't control external devices. Here I express my gratitude in advance to those who can help me.

Hi @lpj669 ,

Two things to check, first let's make sure you have the latest pre-packaged version of bb-node-red-installer for the beagleboard. As back in September we update this package to utilze the 'gpio' group for i/o permission..

debian@bbb-pwr01-ser09:~$ dpkg --list | grep bb-node
ii  bb-node-red-installer                  1.2.9-0rcnee0~buster+20210205              armhf        Node-RED installer for beagleboard.org

Finally, let's double check that u-boot isn't blocking anything:

sudo /opt/scripts/tools/version.sh

Regards,

Hi

my user (debian) seem to be in groups
debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c cloud9ide xenomai weston-launch tisdk docker iio spi admin remoteproc eqep pwm gpio

but I get an error I think we saw before

"Error: ENOENT: no such file or directory, open 
'/sys/devices/platform/ocp/ocp:P8_11_pinmux/state'"

and indeed none of the pins are mentioned in that directory
the only ones there are

drwxrwxr-x 3 root gpio    0 Feb  7 11:27 ocp:cape-universal
drwxr-xr-x 6 root root    0 Jan  1  2000 ocp:l4_wkup@44c00000
drwxrwxr-x 3 root gpio    0 Feb  7 11:27 ocp:P9_19_pinmux
drwxrwxr-x 3 root gpio    0 Feb  7 11:27 ocp:P9_20_pinmux

Hi @dceejay , node-red does not run as a normal user, instead:

debian@bbb-pwr01-ser09:~$ cat /lib/systemd/system/nodered.service | grep 'User\|Group'
User=node-red
Group=node-red
debian@bbb-pwr01-ser09:~$ cat /etc/group | grep gpio
gpio:x:999:debian,node-red

cape universal isn't.enabled, please also run:

sudo /opt/scripts/tools/version.sh

Regards,

sudo /opt/scripts/tools/version.sh
[sudo] password for debian: 
git:/opt/scripts/:[b39ec679648a6be8f25f48bd1c9784c1fc5a0c46]
eeprom:[A335BNLT0A5A1813BBBK5069]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2017.09-00002-g0f3f1c7907]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot.dts]
UBOOT: Loaded Overlay:[AM335X-20-00A0]
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-HDMI-TDA998x-00A0]
kernel:[4.19.94-ti-r42]
nodejs:[v10.23.1]
/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.20201221.0-0~buster+20201221]
pkg:[bb-wl18xx-firmware]:[1.20200813.1-0~buster+20200813]
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 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[   46.706778] remoteproc remoteproc0: wkup_m3 is available
[   46.891722] remoteproc remoteproc0: powering up wkup_m3
[   46.891760] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[   46.892058] remoteproc remoteproc0: remote processor wkup_m3 is now up
[   51.663327] remoteproc remoteproc1: 4a334000.pru is available
[   51.695711] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[   51.663327] remoteproc remoteproc1: 4a334000.pru is available
[   51.667193] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[   51.695711] remoteproc remoteproc2: 4a338000.pru is available
[   51.695871] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[    0.852700] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[    0.854363] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

Hi I have upgraded Node-RED and Node.js using the built-in upgrade tool:

sudo apt update
sudo apt upgrade nodejs bb-node-red-installer

I got some informations as follows:

root@beaglebone:/# dpkg --list | grep bb-node
ii  bb-node-red-installer                     1.2.9-0rcnee0~buster+20210205                  armhf        Node-RED installer for beagleboard.org
root@beaglebone:/# sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[b39ec679648a6be8f25f48bd1c9784c1fc5a0c46]
eeprom:[A335BNLT00C00719BBBK0F0C]
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-HDMI-TDA998x-00A0]
kernel:[4.19.94-ti-r42]
nodejs:[v10.23.1]
/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.20201221.0-0~buster+20201221]
pkg:[bb-wl18xx-firmware]:[1.20200813.1-0~buster+20200813]
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 coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[   66.543539] remoteproc remoteproc0: wkup_m3 is available
[   66.636059] remoteproc remoteproc0: powering up wkup_m3
[   66.636088] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[   66.636342] remoteproc remoteproc0: remote processor wkup_m3 is now up
[   69.375670] remoteproc remoteproc1: 4a334000.pru is available
[   69.385572] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[   69.375670] remoteproc remoteproc1: 4a334000.pru is available
[   69.375833] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[   69.385572] remoteproc remoteproc2: 4a338000.pru is available
[   69.385755] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[    0.949774] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[    0.962987] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

the GPIO of beaglebone can be controled well and the LED can be on and off.


but I found that the*. node-red* directory seems to have changed. It doesn't seem to be in the root directory.isn't it?

So the base application and (application specific version of node) are under "/opt/node-red/" which get's overwritten on every install/upgrade.

The user home for node-red, is under /var/lib/node-red/ where your .config and .node-red directories are stored.

The node-red application runs as: user/group: node-red/node-red

Previously, node-red was installed under /usr/local/lib/node_modules/, but i had to disconnect it from the default version of node in Debian. (we have other userspace node applications that haven't been updated for later node versions..)

Regards,

Having an old verison of u-boot in the eMMC makes this a fun thing to debug.. Get them both to v2019.04 and then you won't have to remember to hold down the 'user' boot to make sure the microSD boots..

Regards,

Ah. How do I do that ? Thanks

Remove the microSD, all the eMMC ot bootup..

Then run:

debian@beaglebone:~$ cd /opt/scripts/tools/developers/
debian@beaglebone:/opt/scripts/tools/developers$ git pull
debian@beaglebone:/opt/scripts/tools/developers$ sudo ./update_bootloader.sh
debian@beaglebone:/opt/scripts/tools/developers$ sudo reboot

Next, stick microSD back in, let it boot up, then run:

debian@beaglebone:~$ cd /opt/scripts/tools/developers/
debian@beaglebone:/opt/scripts/tools/developers$ git pull
debian@beaglebone:/opt/scripts/tools/developers$ sudo ./update_bootloader.sh
debian@beaglebone:/opt/scripts/tools/developers$ sudo reboot

both will the be the latest..

Regards,

Hi,

If I boot without sd card I just get 4 blue LED - and can't login. (I don't have a screen so can't see what's happening) . If I boot with sd card I can run script above.
I then ran a full upgrade to get latest bb-nodered-installer and rebooted - and finally the pins all seem to have appeared. Phew. Thanks

Thank everyone very much for your help

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.