Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dataslayermedia/714ec5a9601249d9ee754919dea49c7e to your computer and use it in GitHub Desktop.
Save dataslayermedia/714ec5a9601249d9ee754919dea49c7e to your computer and use it in GitHub Desktop.
Install Coral AI PCIe Edge TPU on Raspberry Pi 5
#!/bin/bash
cd /
sudo apt update
echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install libedgetpu1-std
sudo apt install -y devscripts debhelper
sudo apt install dkms
sudo apt-get install dh-dkms
# Clone the Gasket driver repository
sudo git clone https://github.com/google/gasket-driver.git
# Change directory to the cloned repository
cd gasket-driver
# Build the Gasket driver package
sudo debuild -us -uc -tc -b
# Go back to the parent directory
cd ..
# Install the built Gasket driver package
sudo dpkg -i gasket-dkms_1.0-18_all.deb
sudo sh -c "echo 'SUBSYSTEM==\"apex\", MODE=\"0660\", GROUP=\"apex\"' >> /etc/udev/rules.d/65-apex.rules"
sudo groupadd apex
sudo adduser $USER apex
# Update the boot configuration for Raspberry Pi
echo "kernel=kernel8.img" | sudo tee -a /boot/firmware/config.txt
# Back up the Device Tree Blob (DTB)
sudo cp /boot/firmware/bcm2712-rpi-5-b.dtb /boot/firmware/bcm2712-rpi-5-b.dtb.bak
# Decompile the DTB into a DTS file
sudo dtc -I dtb -O dts /boot/firmware/bcm2712-rpi-5-b.dtb -o ~/test.dts
# Modify the Device Tree Source (DTS)
sudo sed -i '/pcie@110000 {/,/};/{/msi-parent = <[^>]*>;/{s/msi-parent = <[^>]*>;/msi-parent = <0x67>;/}}' ~/test.dts
# Recompile the DTS back into a DTB
sudo dtc -I dts -O dtb ~/test.dts -o ~/test.dtb
# Replace the old DTB with the new one
sudo mv ~/test.dtb /boot/firmware/bcm2712-rpi-5-b.dtb
sudo reboot now
@vasimv
Copy link

vasimv commented Apr 22, 2025

@MappyMatty I've noticed the same issue after the kernel upgrade to 6.12.x. I have attempted the following:

But then kept getting Couldn't reinit interrupts: -524 all the time, so after few hours I decided to run the model interference on CPU until the solution is found 🤷‍♂️

Got same problem on latest raspberrypi os with latest kernel. But when i've downgraded the kernel to 6.6.74+rpt-rpi-v8 - got it working, thought have to reload apex driver and rescan bus.

@MappyMatty
Copy link

I still have apex 0001.03.00.0: Couldn’t initialize interrupts: -524. I’m using a Pineboards HatDrive! AI with an NVMe drive as well as the Coral. Are others using this same board or other PCIe boards? Could this issue relate to the PCIe switch on the board? Struggling with this and close to giving up and exploring Hailo as an alternative…

@vasimv
Copy link

vasimv commented Apr 23, 2025

I still have apex 0001.03.00.0: Couldn’t initialize interrupts: -524. I’m using a Pineboards HatDrive! AI with an NVMe drive as well as the Coral. Are others using this same board or other PCIe boards? Could this issue relate to the PCIe switch on the board? Struggling with this and close to giving up and exploring Hailo as an alternative…

Well, i was getting same messages (couldn't initialize interrupts: -28 without applying dtoverlay=pineboards-hat-ai and -524 when applied) on 6.12 kernel. But when downgraded kernel to 6.6.74+rpt-rpi-v8 - these errors gone. Only problem is that i have rmmod apex/remove pci-e device/rescan pci/load apex mod after boot to get coral working. I have 52pi PCIe hat M02.

@PedroViniciusMelo
Copy link

PedroViniciusMelo commented Apr 23, 2025

I'm using a hat with two m2 slots from another brand but facing the same problem. Downgrading the kernel to a previous version worked just fine, I'll keep using it for now and never update if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment