This article is also available in the following other languages / Dieser Beitrag ist auch in folgenden anderen Sprachen verfügbar: Deutsch

ClusterHAT: Solving power issues with Pi Zeros when rebooting Pi 4

2020-09-18 - christian - linux, raspberry pi

The ClusterHAT allows to connect up to four Rasperry Pi Zero to a Raspberr Pi with a integrated USB Hub. The Pi Zeros are capable to communicate via USB Ethernet Gadget. So it is possible to connect the devices via Ethernet.

With a Raspberry Pi 3, it was possible to reboot the Pi 3, without loosing power on the Pi Zeros. After switching to a Raspberry Pi 4, this didn’t worked anymore. The Zeros lost power and crash.

This article describes a workaround for the ClusterHAT v2.3 with a Raspberry Pi 4 and the latest Raspbian (Debian Buster).


Part 1: Power management settings in firmware

Fist issue is the changed behaviour of the power management in the Raspberry Pi firmware. To save power, some features will now powered off. Depending on the firmware version, two options need to be changed.

# so it should look like
root@clusterberry:~# vcgencmd bootloader_config | grep -P "(WAKE_ON_GPIO|POWER_OFF_ON_HALT)"

See the configuration documentation

If the settings are not correct, this causes a power interruption on the 3.3V pin which is powering the I2C expander on the ClusterHAT. This will reset the I2C expander and power off the Pi Zeros. The 5V can be affected as well.

To change the configuration, it must be extracted from the current firmware and flashed again afterwards.

# extract the configuration from the
# eeprom image into a text file
rpi-eeprom-config /lib/firmware/raspberrypi/bootloader/critical/pieeprom-2020-04-16.bin > bootconf.txt
# set WAKE_ON_GPIO=1
vim bootconf.txt
# create a new eeprom image for the new configuration
rpi-eeprom-config --out pieeprom-2020-04-16-bb.bin --config bootconf.txt /lib/firmware/raspberrypi/bootloader/critical/pieeprom-2020-04-16.bin
# flash the image
rpi-eeprom-update -d -f pieeprom-2020-04-16-bb.bin
# reboot
sudo reboot
# check if the config is applied
vcgencmd bootloader_config

More infos about firmware updates

Part 1.5: 3.3V power still interrupted

Because of a another issue, the 3.3V pin still resets when a HAT is connected to the Raspberry Pi 4. The workaround described in the linked GitHub issue is a kernel flag.

The option sdhci.debug_quirks2=4 must be appended to the end of the line in /boot/cmdline.txt:

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=9dc0f4ed-02 rootfstype=ext4 elevator=deadline rootwait sdhci.debug_quirks2=4

The sdhci.debug_quirks2=4 disables ‘1.8V’ mode for SD card, so that makes UHS SD cards to be used at lower speeds, but this config also prevents power being cut off on the GPIO’s 3.3V supply, avoiding the reboot issue.

See here and here.

Part 2: Unstable 5V power supply

Next issue is a unstable 5V power. In some cases it interrups, in other cases not. So it would be a good idea to build a own power supply for the HAT.

Per default the HAT is powered via 5V GPIO. This can be changed to USB with the PWR jumper. The connection between RPi and PWR must be cutted, the connection between USB and PWR must be established with a soldering iron.

Clusterberry Power

Now it is possible to power the HAT through USB. With a custom USB cable, this is still possible with one single official Raspberry Pi USB power supply.

Clusterberry Power Cable

The cable serves power to the HAT and to the Pi 4 through the normal USB ports and also connects the HAT via USB to the Pi 4 (data lines only), so that the integrated USB Hub still works.

Clusterberry Power Supply

Now any component of the cluster can be rebooted without affection the other ones.

But attention: You must use a “dumb” power supply as in this setup only the power lines are connected. So no smart negotiation or something like that possible! It works quite good with the official power supply from the Raspberry Pi Foundation.

ClusterHAT v2.4 fixes this issue

This post says, that the newer Version 2.4 fixes this issue. So no workarounds required if this version is used. BG by Carl Lender (CC BY 2.0)
fa7dff93 2020-10-25 21:40