Skip to content


How to program the Pi Crust HAT ID EEPROM

How to program the Pi Crust HAT ID EEPROM

In this guide we are going to show you how to program the on-board EEPROM chip that is included with the Pi Crust Proto HAT. The ID EEPROM was introduced to the Raspberry Pi HAT specification and tells the Pi how the GPIOs need to be set up and what hardware is on the board. This allows the add-on board to be automatically identified and set up by the Pi software at boot time, including loading all the necessary drivers.

What you need

All you need for this project is a Pi Crust Proto HAT and a Raspberry Pi. You will also need to make sure you have internet access too, so you can download the software tools.

Getting Started

Step 1 – First you will need to activate the i2c0 pins by adding the overlay to /boot/config.txt file:


Reboot the Raspberry Pi for the overlay to be loaded.

Step 2 – Download the EEPROM utility and the device tree compiler.

git clone
sudo apt-get install device-tree-compiler

You’ll have now installed dtc compiler and have a hat directory. Go inside, and open eepromutils directory and compile the eepmake file.

cd hats/eepromutils
sudo make

Step 3 – Modify eeprom_settings.txt to create your own version of a HAT board. You don’t have to modify the UUID, as it will be auto-generated.

sudo nano eeprom_settings.txt

Step 4 – Create an eep file, based on you eeprom_settings.txt file. Basically, an eep file is a binary version of this file, which is ready to flash on EEPROM.

sudo ./eepmake eeprom_settings.txt myhat.eep

You can now write it on the Pi Crust HAT EEPROM. If you have followed the design guide, you have a 24c32 memory (4k). But your myhat.eep file is smaller. As you don’t know the state of your EEPROM, you may have conflict, as your myhat.eep could be misread. To avoid that, we shall start by cleaning the EEPROM.

Step 5 – Use this dd command to generate a 4k file, padded with zero. If you have another EEPROM size, just change count value according to your real EEPROM size.

sudo dd if=/dev/zero ibs=1k count=4 of=blank.eep

To be sure, you can review this binary, using hexdump.

hexdump blank.eep

Step 6 – Next, you can now upload it to your EEPROM:

sudo ./ -w -f=blank.eep -t=24c32

Answer yes and wait. The write protect is disabled by the small ground trace and once programmed can be cut and the write protect soldered closed.

Step 7 – Then, you can upload your own myhat.eep.

sudo ./ -w -f=myhat.eep -t=24c32

Now you can reboot your Raspberry Pi.

Step 8 – To check if your HAT is recognised, just go to /proc/device-tree/. If you see a hat directory, the Raspberry Pi is able to detect your HAT.

cd /proc/device-tree/hat/
more vendor
more product

Device Tree Overlay

Coming Soon!


Previous article PiJuice Maker Kit Case – 3D Print a High Quality Camera adaptor
Next article How to compile the LoRa gateway software for the LoRa gateway HAT