I got bit confusion about the new raspberry pi HAT. Lets say we have a configured HAT with a right EEPROM, when the pi starts how it talks to the HAT ? What tool does it use (is it SMbus ? )? and how it prepare the HAT to be usable ?
1 Answers
In a nutshell a HAT is a rectangular board (65x56mm) that has four mounting holes in the (nicely rounded) corners that align with the mounting holes on the B+, has a 40W GPIO header and supports the special autoconfiguration system that allows automatic GPIO setup and driver setup. The automatic configuration is achieved using 2 dedicated pins (ID_SD and ID_SC) on the 40W B+ GPIO header that are reserved for an I2C EEPROM. The EEPROM holds the board manufacturer information, GPIO setup and a thing called a ‘device tree‘ fragment – basically a description of the attached hardware that allows Linux to automatically load the required drivers
My bold.
See https://www.raspberrypi.org/blog/introducing-raspberry-pi-hats/
So the HAT is queried via I2C on GPIO 0/1 (pins 27/28 on the expansion header) and has the needed device tree information to set up the GPIO. This is all handled by the kernel during boot.

- 71,024
- 5
- 73
- 106
-
Hmm, are these "hats" stackable or one at a time? – Michael Graff Jan 26 '16 at 17:25
-
One at a time. I understand that stackable HATs added too many design problems. You may be able to stack identical HATs. – joan Jan 26 '16 at 17:27
-
One hat at a time. See http://raspberrypi.stackexchange.com/q/39153/19949 – Ghanima Jan 26 '16 at 17:32