usul27
Posts: 23
Joined: Mon Nov 26, 2012 9:54 am

Accessing EEPROM on HAT

Thu Jul 24, 2014 6:39 pm

Hi,

I just tested my prototype for a new HiFiBerry DAC HAT, but have some problems accessing the EEPROM. I was looking for a hardware problem. After some hours of debugging, I noticed that the I2C communication seems to work. The EEPROM correctly sets the ACK bit at the end of the I2C communication. However, the "i2cxxx" commands from command line still fails. I guess, this is somewhere blocked in the Linux kernel. How can I access the EEPROM on the HAT?

Best regards
Daniel

User avatar
Paul Webster
Posts: 832
Joined: Sat Jul 30, 2011 4:49 am
Location: London, UK
Contact: Twitter

Re: Accessing EEPROM on HAT

Thu Jul 24, 2014 7:13 pm

I think api saw a popcorn is checkin this afternoon that included the EEPROM name in it.
So maybe an update will help.

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2468
Joined: Thu Jul 11, 2013 2:37 pm

Re: Accessing EEPROM on HAT

Thu Jul 24, 2014 7:16 pm

I2C0 is enabled by default on GPIO28/29. The sampling for the SDA/SCL lines is done as a logical OR of all pads that have I2C0 enabled as their alt setting, therefore no ACKs will make it back to the host hardware.

One quick hack is to nobble GPIO28 and GPIO29 via the sysfs export interface (as root):
echo 28 > /sys/class/gpio/export
echo 29 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio28/direction
echo in > /sys/class/gpio/gpio29/direction

When GPIOMAN documentation is available then you can instruct the bootloader not to set the alt setting (for test/debug purposes).
Rockets are loud.
https://astro-pi.org

usul27
Posts: 23
Joined: Mon Nov 26, 2012 9:54 am

Re: Accessing EEPROM on HAT

Thu Jul 24, 2014 7:34 pm

Thanks, the workaround helped to get I2C running now. That's enough to go on for the moment. Looking forward to the documentation how to access the HAT EEPROM from the kernel.

Daniel

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2468
Joined: Thu Jul 11, 2013 2:37 pm

Re: Accessing EEPROM on HAT

Fri Jul 25, 2014 8:05 pm

An example script for reading/writing an EEPROM image is available on github:

https://github.com/raspberrypi/hats/tre ... epromutils
Rockets are loud.
https://astro-pi.org

Return to “HATs and other add-ons”