"/dev/gpiochip5" - [Errno 16] Opening output line handle: Resource busy

Hi all,

I'm using the Portenta X8 and breakout board.
As I understand I need to use "gpiochip5" but it raises the following error

OE = periphery.GPIO("/dev/gpiochip5",3, "out")
File "/usr/local/lib/python3.9/site-packages/periphery/gpio_cdev1.py", line 140, in init
self._open(path, line, direction, edge, bias, drive, inverted, label)
File "/usr/local/lib/python3.9/site-packages/periphery/gpio_cdev1.py", line 191, in _open
self._reopen(direction, edge, bias, drive, inverted)
File "/usr/local/lib/python3.9/site-packages/periphery/gpio_cdev1.py", line 269, in _reopen
raise GPIOError(e.errno, "Opening output line handle: " + e.strerror)
periphery.gpio.GPIOError: [Errno 16] Opening output line handle: Resource busy

when try with different "gpiochip0-4" I am not getting this error but the GPIOs isn't functioning.

I added the devices on the docker-compose.yml file

devices:
      - '/dev/i2c-0'
      - '/dev/i2c-1'
      - '/dev/i2c-2'
      - '/dev/i2c-3'
      - '/dev/gpiochip0'
      - '/dev/gpiochip1'
      - '/dev/gpiochip2'
      - '/dev/gpiochip3'
      - '/dev/gpiochip4'
      - '/dev/gpiochip5'
      - '/dev/ttymxc1'

this is a part of the code:

OE = periphery.GPIO("/dev/gpiochip5",3, "out")  # GPIO_PF4 = gpio_3 J2_52 163
OE.write(True)
time.sleep(2)
OE.write(False)            
 time.sleep(2)

also tried it like this:

OE = periphery.GPIO(163, "out")      # GPIO_PF4 = gpio_3 J2_52 163

Please help me make the GPIOs working

Thank you!

First, Update your Portenta X8!!!!!
second, It has to be declared before run time and in this format only:

OE = GPIO(163, "out")              # GPIO_PF4 = gpio_3 J2_52 163

### Main program
if __name__ == '__main__':
    print("============================================")
    print("check GPIO")
    print("============================================")
    OE.write(True)
    time.sleep(2)
    OE.write(False)            # GPIO_PF4 = gpio_3 J2_52 163
    time.sleep(2)
    print("_____________________________")

also something with the docker configuration (not sure what), so make sure you have the following:
Dockerfile:

FROM python:3.9-alpine AS Build
USER root
RUN set -ex \
    && apk add --no-cache --virtual .build-dep \
        git build-base python3-dev
RUN set -ex \
    && git clone https://github.com/kpn-iot/senml-python-library \
    && cd senml-python-library \
    && python3 setup.py bdist_wheel \
    && cd ..
RUN set -ex \
    && apk del .build-dep
FROM python:3.9-alpine
COPY --from=Build /senml-python-library/dist/kpn_senml-1.1.1-py3-none-any.whl ./
COPY requirements.txt ./
RUN set -ex \
    && pip3 --disable-pip-version-check --no-cache-dir install \
        -r requirements.txt \
    && rm ./kpn_senml-1.1.1-py3-none-any.whl \
    && rm ./requirements.txt
WORKDIR /app
COPY src/main.py .
ENTRYPOINT [ "python3", "main.py"]