3

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 ?

Mero
  • 298
  • 5
  • 13

1 Answers1

5

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.

joan
  • 71,024
  • 5
  • 73
  • 106