Raspberry Pi PoE+ HAT not initialising

Spent a bit of time digging in, there is a lot of information you can glean from both the AF (2018) and AT (2021) hats, like voltage, current draw, etc. However in Raspbian they are device tree overlays that trigger from other device tree temp zones. Not possible in Ubuntu really. Maybe doable instead with a python script?

rpi-poe-fan@0 {
	cooling-levels = <0x00 0x20 0x40 0x80 0xff>;
	cooling-max-state = <0x04>;
	compatible = "raspberrypi,rpi-poe-fan";
	status = "okay";
	firmware = <0x06>;
	phandle = <0xe3>;
	cooling-min-state = <0x00>;
	#cooling-cells = <0x02>;
};

rpi-poe-power-supply@0 {
	compatible = "raspberrypi,rpi-poe-power-supply";
	status = "okay";
	firmware = <0x06>;
	phandle = <0xe7>;
};

@tu630c that looks helpful. But do you know how to do it? I’m afraid I only found out what a DTB was last week ! :slight_smile:

I should go away and read this maybe https://elinux.org/images/f/f9/Petazzoni-device-tree-dummies_0.pdf

Found a lot of useful information here:
https://www.jeffgeerling.com/blog/2021/review-raspberry-pis-poe-hat-june-2021

Also was able to id the dtoverlay’s with dtc -I fs /proc/device-tree

Finally, these are all readable values being reported by the hats, so should be readable via a script. Notice how Pi foundation has the two functions broken apart. Not sure why yet.
:/proc/device-tree/rpi-poe-fan@0 $ ls
compatible '#cooling-cells' cooling-levels cooling-max-state cooling-min-state firmware name phandle status
:/proc/device-tree/rpi-poe-power-supply@0 $ ls
compatible firmware name phandle status

1 Like

It is not free because I’ve had my gcp account for a long time, and MAAS seems to have issues on a machine with only 1 GB of RAM (micro). But you can get a free account with 300 dollars of credit I think. I’m using it for a proof of concept really.

The AT model fan is being driven by PWM from the onboard Atmel Tiny814, which means it does not appear that it can be simply powered by feeding pwm to a GPIO pin. I may have to reach out to the kind people at the Pi Foundation for a shortcut to a lot of reverse engineering.

I found some useful info today from a friend at work.

There is a DT Overlay file for the PoE Hat here https://github.com/raspberrypi/firmware/blob/master/boot/overlays/rpi-poe-plus.dtbo

The drivers it refers to are in the upstream kernel.
https://github.com/torvalds/linux/blob/master/drivers/pwm/pwm-raspberrypi-poe.c

They got added in March last year so that definitely puts them in the kernel that 22.04 is using, I’d have to check earlier versions.

I got instructions for dynamic Device Table Overlay load at runtime:

sudo su
mount -t configfs none /sys/kernel/config    # if not already mounted
mkdir -p /sys/kernel/config/device-tree/overlays/rpi-poe-plus
cat rpi-poe-plus.dtbo > /sys/kernel/config/device-tree/overlays/rpi-poe-plus/dtbo

BUT this does not work on our MAAS supplied 22.04 because dynamic overlays are disabled in the kernel.

This means that we need to modify the dtb that gets passed to boot.

It is my hope that this can be achieved with Anton’s DTB patching approach. (But I’m still unclear if that is the final DTB we end up with)

If you followed the MaaS tutorial you’re likely to run the generic kernel and not our raspi kernel which has all the additional patches and DTBs to support the Pi and its various HATs. It’s close to the Pi foundation’s kernel.

Just use our raspi kernel instead of trying to clobber things together using the generic kernel.

Where were you yesterday @juergh :joy:

Hi Juergh,

Thanks for your input - I think that would imply we need to build a MAAS image of our own. I’m currently trying to work out how to do that but it seems non trivial.

Perhaps we can take a copy of a MAAS image and modify the kernel only? would that work?

I don’t really know what MaaS is doing and how the system boots once it’s deployed. I’m still surprised that it actually comes up with the generic kernel and image.

OK Thanks. I’ll just give it a go and see.

Which VFAT boot partition is it using? The one on the SD card or?? You might be able to install the raspi kernel after deployment:

$ apt install linux-raspi

did you see https://maas.io/docs/snap/3.1/ui/creating-a-custom-ubuntu-image ?

There is also referenced from there: https://github.com/canonical/packer-maas/tree/master/ubuntu/scripts

have not done this myself, but @alexsander-souza has :slight_smile:

That would have been a nice solution!

It all installed fine. But on reboot …

Surely there is a more elegant solution heh.

So we cant copy the images and replace the kernel because they are signed.

Will have a go @gilesknap at your process to shoehorn raspios into MAAS, but it seems a short term solution. If the stated goal of MAAS is “Deploy any OS image on any hardware” it may be either RaspiOS image support in MAAS or Ubuntu Arm support for the AT PoE hat that is needed.

We’ll never support the generic kernel/image on raspi. We have dedicated kernel and images for that. If you want MaaS support for raspi you need to have raspi images in MaaS. If you can’t get the PoE HAT to work with the raspi kernel/image then that’s a bug that needs fixing anything else is unsupported.

And no, raspi kernels are not signed. The platform doesn’t support secure boot (yet) so there’s no point.

Re signing: If I take a copy of a MAAS image and publish it myself I get the following. But I can’t see where any signature would be.