Raspberry Pi 4 Sense HAT support on balenaOS 64bit beta

Hi,
I’ve just installed balenaOS beta for RPi 4 64bit and it worked flawlessly.
I have Sense HAT working on this device and when attached, it prevents local device from booting up. The error is exactly the same as described e.g in the RPi forum thread about Buster OS problems:
Buster won’t boot headless with the Sense Hat attached
On my RPi installation I just change the resolution form headless mode and it solves the problem.
How to approach the problem on the balenaOS? With Sense HAT attached I’m seeing the device trying to boot-up, but the LEDs never go off and device appears to be offline on the dashboard.

Thanks!

balenaOS 2.41.0+rev4

Hi @blazejewicz

This is actually something we are looking into now, as it came to our attention in internal project testing, that the Sense Hat projects do not currently work with a Raspberry Pi 4. We are investigating what is the cause (whether it’s any hardware difference, or the fact that balenaOS on Raspberry Pi 4 is a 64-bit OS). Thanks a lot for the note, and will keep you posted as we test things out!

1 Like

Thanks folks!

Hi @blazejewicz ,

We’ve had a look here and one of our engineers has reported that the setting of hdmi_force_hotplug=1 resolves the same issue for him. You can either do this via the balena Dashboard by going to the device page, selecting Device Configuration and then ‘Add custom variable’ and create RESIN_HOST_CONFIG_hdmi_force_hotplug with the value 1. Alternatively, you can modify the config.txt file in the boot partition of the SD card, and add the hdmi_force_hotplug=1 line to the bottom of it.

Hope this helps!

Best regards,

Heds

It seems to be the case! Thanks for looking into this! Now let’s look to the docker image,

Thanks!

Good to know that it works. Please let us know if you need further support!

Hi,

So I’ve got it working with your help folks and it works. I’m using latest Python 3.7 with the following docker template to trim down the size by installing deps using virtual env on build container, copying to app container and moving only app code into app container:

# See more about dockerfile templates here: https://www.balena.io/docs/learn/develop/dockerfile/
FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-python:3.7.3-stretch-build as builder
# Always set a working directory
WORKDIR /app
# Sets utf-8 encoding for Python
ENV LANG=C.UTF-8
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Make sure we use the virtualenv:
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Use `install_packages` if you need to install dependencies
RUN pip install -U pip && \
    pip install -U wheel && \
    pip install -U numpy && \
    pip install -U pillow
# RTIMU library fix
RUN git clone https://github.com/RPi-Distro/RTIMULib/ RTIMU
WORKDIR /app/RTIMU/Linux/python
RUN python setup.py build && \
    python setup.py install
# reset working directory
WORKDIR /app
# This will copy all files in our root to the working  directory in the container
COPY requirements.txt ./
RUN pip install -U --no-cache-dir -r requirements.txt

# Trimmed down app container
FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-python:3.7.3-stretch-run as app
# Extra python env
ENV LANG=C.UTF-8
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Use `install_packages` if you need to install dependencies
RUN install_packages libjpeg62-turbo-dev
# Make sure we use the virtualenv:
COPY --from=0 /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Always set a working directory
WORKDIR /app
# This will copy all files in our root to the working  directory in the container
COPY . ./
# Enable udevd so that plugged dynamic hardware devices show up in our container.
ENV UDEV=1
# main.py will run when container starts up on the device
CMD ["python", "-u", "src/main.py"]

Not sure if the best Docker handling (still learning), but it works flawlessly!

Thanks for the help!