BBGW GPIO not found

I’m compiling my own balenaOS however when I try to access the GPIO pins on my BB Green Wireless using johnny-five in nodejs I am getting errors that that the GPIO pin does not exist.

ERROR >> Error: ENOENT: no such file or directory, open ‘/sys/devices/platform/ocp/ocp:P8_09_pinmux/state’

Using image from BB website same code works. I’ve also tried to remove any customisations I made in the OS but does not seem to have helped.

I kind of solved this by including the pins in a custom overlay, however I’m now stuck as the container does not seem to have access to the GPIO pin even tough it’s running in privileged mode.

Hi

Can you share your dockerfile?

Another way to give access to hardware is through the devices keyword as mentioned in the Interact with hardware docs - can you try this?

If that works, but the privileged mode approach doesn’t work - that would give us useful debug info.

adding device keywords did not help.

this is the dockerfile for one of the containers:

FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-node:10

COPY empty_file tmp*/qemu-arm-stati[c] /usr/bin/

RUN install_packages avahi-utils libavahi-compat-libdnssd-dev curl git build-essential dialog libnss-mdns python xsltproc 

RUN mkdir -p /root/demo-app
WORKDIR /root/demo-app

COPY . .
RUN npm install
RUN npm run build

RUN mkdir -p /root/.demo-app
COPY v360.svg /root/.demo-app/logo.svg

EXPOSE 3000
ENV IS_IN_DOCKER true
ENV demo-app_DISABLE_SERVER_UPDATES true
ENV demo-app_NODE_CONFIG_DIR /data/
ENV UDEV=on


COPY scripts/start.sh .
CMD ["bash", "start.sh"]
ENTRYPOINT /root/demo-app/bin/demo-app-server --securityenabled

this is my docker-template:

version: '2.1'
networks: {}
volumes:
  resin-data: {}
services:
  demo-app:
    container_name: demo-app
    build: ./demo-app-server-node
    restart: always
    network_mode: host
    volumes:
      - 'resin-data:/data'
    privileged: true
    labels:
      io.balena.features.dbus: '1'
      io.balena.features.balena-api: '1'
      io.balena.features.supervisor-api: '1'
      io.balena.features.sysfs: '1'
    ports:
      - "80:3000"
    devices:
      - "/dev:/dev"
    cap_add:
      - NET_ADMIN
      - SYS_RAWIO
    environment:
      DBUS_SYSTEM_BUS_ADDRESS: "unix:path=/host/run/dbus/system_bus_socket"
  wifi-connect:
    build: ./wifi-connect
    network_mode: "host"
    privileged: true
    labels:
      io.balena.features.dbus: '1'
    devices:
      - "/dev/i2c-1:/dev/i2c-1"
    cap_add:
      - NET_ADMIN
      - SYS_RAWIO
    environment:
      DBUS_SYSTEM_BUS_ADDRESS: "unix:path=/host/run/dbus/system_bus_socket"

I’ve now noticed that I am getting this error in console of the OS when connected via serial debug.
[47194.041533] bone-pinmux-helper ocp:P8_19_pinmux: Failed to find state gpio

Hey there!

I’ve now noticed that I am getting this error in console of the OS when connected via serial debug.
[47194.041533] bone-pinmux-helper ocp:P8_19_pinmux: Failed to find state gpio

When do you see this message please? Is it when booting or when your nodejs script tries to access the GPIO pin

  • Can you please paste the output of /mnt/boot/uEnv.txt?
    I’m suspecting this is an issue with the overlay file. Can you please provide some more details about your custom overlay?

  • Can you paste the output of
    ls -l /sys/devices/platform/ocp/ and
    ls -l /sys/devices/platform/ocp/ocp\:P8_09_pinmux/

Thanks

This happens every time the nodejs tries to access the pin

/mnt/boot/uEnv.txt:

enable_uboot_overlays=1

uboot_overlay_addr0=/boot/overlays/My-Custom-Overlay-00A0.dtbo
uboot_overlay_addr1=/boot/overlays/BB-CAN0-00A0.dtbo
uboot_overlay_addr2=/boot/overlays/BB-CAN1-00A0.dtbo
uboot_overlay_addr3=/boot/overlays/BB-ADC-00A0.dtbo #added later to try and solve the issue

uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo  #added later to try and solve the issue

enable_uboot_cape_universal=1

disable_uboot_overlay_video=1

cmdline=coherent_pool=1M quiet  #added later to try and solve the issue
root@e66614e:~# ls -l /sys/devices/platform/ocp/
total 0
drwxr-xr-x 3 root root    0 Jan  1  2000 40300000.ocmcram
drwxr-xr-x 7 root root    0 Jan  1  2000 44c00000.interconnect
drwxr-xr-x 9 root root    0 Jan  1  2000 47400000.usb
drwxr-xr-x 4 root root    0 Jan  1  2000 478102fc.target-module
drwxr-xr-x 4 root root    0 Jan  1  2000 47c00000.interconnect
drwxr-xr-x 7 root root    0 Jan  1  2000 48000000.interconnect
drwxr-xr-x 4 root root    0 Jan  1  2000 49000000.edma
drwxr-xr-x 3 root root    0 Jan  1  2000 49800000.tptc
drwxr-xr-x 3 root root    0 Jan  1  2000 49900000.tptc
drwxr-xr-x 3 root root    0 Jan  1  2000 49a00000.tptc
drwxr-xr-x 4 root root    0 Jan  1  2000 4a000000.interconnect
drwxr-xr-x 4 root root    0 Jan  1  2000 4b144400.interconnect
drwxr-xr-x 3 root root    0 Jan  1  2000 4c000000.emif
drwxr-xr-x 3 root root    0 Jan  1  2000 53100000.sham
drwxr-xr-x 3 root root    0 Jan  1  2000 53500000.aes
-rw-r--r-- 1 root root 4096 Apr  2 16:00 driver_override
-r--r--r-- 1 root root 4096 Apr  2 15:51 modalias
drwxr-xr-x 3 root root    0 Jan  1  2000 ocp:P8_09_pinmux
drwxr-xr-x 3 root root    0 Jan  1  2000 ocp:P8_19_pinmux
drwxr-xr-x 3 root root    0 Jan  1  2000 ocp:cape-universal
drwxr-xr-x 4 root root    0 Jan  1  2000 ocp:target-module@56000000
lrwxrwxrwx 1 root root    0 Apr  2 16:00 of_node -> ../../../firmware/devicetree/base/ocp
drwxr-xr-x 2 root root    0 Apr  2 16:00 power
lrwxrwxrwx 1 root root    0 Jan  1  2000 subsystem -> ../../../bus/platform
-rw-r--r-- 1 root root 4096 Jan  1  2000 uevent
root@e66614e:~# ls -l /sys/devices/platform/ocp/ocp\:P8_09_pinmux/
total 0
lrwxrwxrwx 1 root root    0 Apr  2 16:01 driver -> ../../../../bus/platform/drivers/bone-pinmux-helper
-rw-r--r-- 1 root root 4096 Apr  2 16:01 driver_override
-r--r--r-- 1 root root 4096 Apr  2 16:01 modalias
lrwxrwxrwx 1 root root    0 Apr  2 16:01 of_node -> ../../../../firmware/devicetree/base/ocp/P8_09_pinmux
drwxr-xr-x 2 root root    0 Apr  2 16:01 power
-rw-r--r-- 1 root root 4096 Apr  2 15:56 state
lrwxrwxrwx 1 root root    0 Jan  1  2000 subsystem -> ../../../../bus/platform
-rw-r--r-- 1 root root 4096 Jan  1  2000 uevent

The overly basically initialised the RTC chip, now I’ve also added the parts to declare P8_09 and P8_19 My-Custom-Overlay-00A0.dts.log (3.0 KB)

@jkridner Just curious, have you ever seen this situation before, by chance?

I’ve now updated to balenaOS 2.73.1+rev2 but still the issue remains :exploding_head:

Hi Claude,

You mentioned that the official BeagleBone image works in this case, can you also share the contents of the /boot/uEnv.txt from that distro? If this is an overlay issue, seeing how it’s configured in that image may help us.