• Stars
    star
    658
  • Rank 68,509 (Top 2 %)
  • Language
    C
  • License
    BSD 3-Clause "New...
  • Created over 10 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ADD-ON BOARDS AND HATs

NOTE All references to GPIO numbers within this document are referring to the BCM283x GPIOs (NOT pin numbers on the Pi GPIO header).

Introduction

The Raspberry Pi boards with 40W GPIO headers (Model B+ and onwards) and have been designed specifically with add-on boards in mind. These boards support 'HATs' (Hardware Attached on Top). A HAT is an add-on board that conforms to the HAT specifications. HATs are not backward compatible with original Raspberry Pi 1 models A and B.

In October 2018 Raspberry Pi introduced the Micro-HAT (uHAT) specification. uHATs must follow all of the standard electrical HAT rules as laid our for normal HATs, but they have a smaller mechanical form factor as specified here

There are obviously a lot of add-on boards designed for the original model A and B boards (which interface to the original 26 way GPIO header). The first 26 pins of the 40W GPIO header are identical to those of the original models, so most existing boards will still work.

The biggest change with HAT add-on boards versus older boards designed for models A and B is that the 40W header has 2 special pins (ID_SC and ID_SD) that are reserved exclusively for attaching an 'ID EEPROM'. The ID EEPROM contains data that identifies the board, 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.

While we cannot force anyone to follow our minimum requirements or HAT specification, doing so will make users lives easier, safer, and will make us more likely to recommend a product. Likewise if one of the minimum requirements is ignored we are unlikely to look on a product very favourably.

So why are we bothering with all this? Basically we want to ensure consistency and compatibility with future add-on boards, and to allow a much better end-user experience, especially for the less technically aware users.

Finally if you have any questions please head over to the forums to ask them.

New HATs / add-on boards basic requirements

If you are designing a new add-on board that takes advantage of the pins on the 40W GPIO header other than the original 26 then you must follow the basic requirements:

  1. The ID_SC and ID_SD pins must only be used for attaching a compatible ID EEPROM. Do not use ID_SC and ID_SD pins for anything except connecting an ID EEPROM, if unused these pins must be left unconnected
  2. If back-powering via the 5V GPIO header pins you must make sure that it is safe to do so even if the Pi 5V supply is also connected. Adding an ideal 'safety' diode as per the relevant section of the design guide is the recommended way to do this.
  3. The board must protect against old firmware accidentally driving GPIO 6, 14 or 16 at boot time if any of those pins are also driven by the board itself.

Note that for new designs that only use the original 26 way GPIO header pins it is still recommended to follow requirement 2. if the board supports back-powering a Pi.

HAT requirements

A board can only be called a HAT if:

  1. It conforms to the basic add-on board requirements
  2. It has a valid ID EEPROM (including vendor info, GPIO map and valid device tree information).
  3. It has a full size 40W GPIO connector.
  4. It follows the HAT mechanical specification
  5. It uses a GPIO connector that spaces the HAT at least 8mm from the Pi (i.e. uses spacers 8mm or larger - also see note on PoE header below)
  6. If back powering via the GPIO connector the HAT must be able to supply a minimum of 1.3A continuously to the Pi (but ability to supply 2A continuously recommended).

Of course users are free to put an ID EEPROM on boards that don't otherwise conform to the remainder of the specifications - in fact we strongly encourage this; we just want things called HATs to be a known and well-specified entity to make life easier for customers, particularly the less technical ones.

NOTE that the Pi3B+ introduced a new 4-pin PoE header near the top-right corner mounting hole. Newly designed HATs that do not provide a connector for this header must avoid fouling it.

Design Resources

Before designing any new add-on board (HAT compliant or not) please read the design guide carefully.

For what to flash into the ID EEPROM see the ID EEPROM data format spec.

There are tools and documentation on how to flash ID EEPROMs here.

FAQ

Q: I want to keep shipping an existing board / ship a new board that only connects to the original 26W GPIO pins.

This is OK. You can't call it a HAT. If the board will back-power the Pi we recommend adding the safety diode as per requirement 2. of the basic add-on board requirements.

Q: I want to ship a board that attaches to the 40W GPIO header and covers ID_SD and ID_SC but does not include an EEPROM.

This is OK as long as it meets the basic requirements. You can't call it a HAT.

Q: I want to ship a board that has an ID EEPROM but does not conform to the remaining HAT specs.

This is OK as long as it also meets the basic requirements. You can't call it a HAT but you can say it supports GPIO autoconfiguration if the EEPROM contains valid vendor, GPIO map and DT blob information.

Q: I want to ship a HAT but the software for creating the EEPROM and/or DT blob isn't ready yet.

We expect all HATs to have a correctly programmed EEPROM, but bugs can happen, therefore make sure the EEPROM is user flashable. You will need to add some ability for a user to un-write-protect the EEPROM to (re-)flash it themselves as suggested in the design guide. Please provide instructions on your website / product packaging for how to reflash the board when any new image becomes available.

Q: I'm using the HAT mechanical spec but don't want to / can't add the cutout / slot for the display / camera flex.

This is OK and the board still conforms to the HAT specification. Some HATs will not be able to support the slot/cutout based on where the connectors and components must be placed (but it is recommended to support them if at all possible).

Q: I want to create a board that connects to the 'RUN' or 'PEN' header pin(s).

No problem but you can't call it a HAT. HATs are designed to be easy to use. Using the RUN pin requires a user to solder a header onto the Pi hence this is not something we wish to include in the HAT spec.

More Repositories

1

linux

Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/
C
11,056
star
2

documentation

The official documentation for Raspberry Pi computers and microcontrollers
Python
5,178
star
3

firmware

This repository contains pre-compiled binaries of the current Raspberry Pi kernel and modules, userspace libraries, and bootloader/GPU firmware.
5,133
star
4

pico-sdk

C
3,536
star
5

pico-examples

C
2,763
star
6

noobs

NOOBS (New Out Of Box Software) - An easy Operating System install manager for the Raspberry Pi
Makefile
2,210
star
7

userland

Source code for ARM side libraries for interfacing to Raspberry Pi GPU.
C
2,040
star
8

tools

C
1,876
star
9

rpi-imager

The home of Raspberry Pi Imager, a user-friendly tool for creating bootable media for Raspberry Pi devices.
C
1,668
star
10

rpi-eeprom

Installation scripts and binaries for the Raspberry Pi 4 and Raspberry Pi 5 bootloader EEPROMs
Shell
1,257
star
11

pico-micropython-examples

Examples to accompany the "Raspberry Pi Pico Python SDK" book.
Python
948
star
12

usbboot

Raspberry Pi USB booting code, moved from tools repository
C
897
star
13

picamera2

New libcamera based python library
Python
852
star
14

debugprobe

C
730
star
15

pico-tflmicro

Pico TensorFlow Lite Port
C++
619
star
16

picotool

C++
549
star
17

Raspberry-Pi-OS-64bit

Repository for containing issues on the 64 bit operating system (as distinct from the 32 bit one)
466
star
18

pico-extras

C
459
star
19

pico-playground

C
434
star
20

quake3

C
390
star
21

rpicam-apps

C++
383
star
22

maynard

Desktop environment for Wayland
C
336
star
23

piserver

Raspberry Pi Server wizard to serve Raspbian to network booting Pis
C++
311
star
24

pico-project-generator

Tool to automatically generate a Pico C SDK Project
Python
294
star
25

pico-bootrom-rp2040

C
271
star
26

raspiraw

Example app directly receiving raw data from CSI2 sensors
C
257
star
27

pico-setup-windows

PowerShell
252
star
28

libcamera

C++
211
star
29

utils

A collection of scripts and simple applications
C
148
star
30

openocd

C
141
star
31

windows-drivers

Windows IOT drivers
C
120
star
32

pico-bootrom-rp2350

C
120
star
33

cmprovision

Provisioning system for CM4 products
PHP
97
star
34

pico-setup

Shell
92
star
35

scratch

Scratch releases
79
star
36

usbbootgui

GUI for booting a Raspberry Pi device like Pi Zero or compute module as a device
M4
77
star
37

rp2350_hacking_challenge

CMake
70
star
38

tinyusb

C
67
star
39

rpi-sense

Sense HAT firmware and driver
Assembly
66
star
40

usb-pid

Raspberry Pi Pico PID allocations
63
star
41

gpioexpander

Buildroot based ethernet gadget which gives a host access to PIGPIO to control GPIO pins
Makefile
62
star
42

pico-vscode

The official VS Code extension for Raspberry Pi Pico development. It includes several features to simplify project creation and deployment.
TypeScript
62
star
43

target_fs

Shell
39
star
44

weston

The Weston Wayland Compositor
C
37
star
45

scriptexecutor

Simple buildroot based system for executing a remote script for manufacture programming
Shell
36
star
46

pico-host-sdl

C
27
star
47

pico-feedback

24
star
48

raspberrypi.github.io

Raspberry Pi GitHub organisations
HTML
20
star
49

pytrack

Python
17
star
50

Pi-Codec

Tools for the IQaudIO Pi-Codec / CodecZero sound cards
16
star
51

skygate

Python
15
star
52

style-guide

14
star
53

bookworm-feedback

13
star
54

CMSIS-RP2xxx-DFP

C
13
star
55

armulet

C++
8
star
56

pylibcamera

Meson
8
star
57

libpisp

C++
7
star
58

pico-sdk-tools

Shell
5
star
59

rpi-sb-provisioner

A minimal-input automatic secure boot provisioning system for Raspberry Pi devices.
Shell
5
star
60

pykms

Meson
2
star
61

FreeRTOS-Kernel

C
1
star
62

sweet-b

C
1
star