Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4151

HATs and other add-ons • Re: Why is there no M.2 HAT+ overlay?

$
0
0
If you have a Pi M.2 HAT+ and if you really want to see for yourself what the EEPROM contains and whether it specifies a DT overlay, you can just dump and decode the contents yourself:
..
Are you calling my a liar?
..
3. eepflash.sh --read --device=0 --address=0x50 -t=24c32 -f hat_eeprom_dump.eep (note address might instead be 0x51; not sure if they're specifying it as a stackable HAT)
..
read the HAT+ spec as well as the M.2 HAT spec (it's even written on the schematic): the I2C address needs (!) to be 0x51

Code:

pi@raspberrypi:~ $ sudo i2cdetect -y 1     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f00:                         -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- 
Note:
ID_SC/ID_SA were connected to ic2_arm on the DUT (CM4, used only for reading the EEPROM).
I'm using a custom overlay for I2C access:

Code:

// Simple EEPROM overlay// // at24compatible-eeprom-overlay.dts#include <dt-bindings/gpio/gpio.h>#include <dt-bindings/pinctrl/bcm2835.h>/dts-v1/;/plugin/;/ {compatible = "brcm,bcm2711";fragment@0 {target = <&gpio>;__overlay__ {e2prom_pins: e2prom_pins {                                brcm,pins = <4>;                                brcm,function = <1>; /* out */};};};  fragment@1 {target = <&i2c1>;__overlay__ {  pinctrl-names = "default";  pinctrl-0 = <&i2c1_pins>;  status = "okay";    at24@51 {compatible = "atmel,24c32","at24";#address-cells = <1>;#size-cells = <0>;label = "dummye2prom";address-width = <16>;num-addresses = <1>;reg = <0x51>;pagesize = <32>;size = <4096>;wp-gpios = <&gpio 4 0>;  };};};};
Hence in my config.txt I need to have

Code:

dtparam=i2c_arm=ondtoverlay=at24compatible-eeprom
Small check what is there on the bus

Code:

pi@raspberrypi:~ $ ls /sys/bus/i2c/devices/1-0051driver  dummye2prom5  eeprom  modalias  name  of_node  power  subsystem  supplier:platform:fe200000.gpio  supplier:regulator:regulator.0  ueventpi@raspberrypi:~ $ sudo i2cdetect -y 1     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f00:                         -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --                         pi@raspberrypi:~ $ i2cdetect -li2c-1i2c       bcm2835 (i2c@7e804000)          I2C adapteri2c-20i2c       fef04500.i2c                    I2C adapteri2c-21i2c       fef09500.i2c                    I2C adapterpi@raspberrypi:~ $ ls /sys/bus/i2c/driversat24  dummy  stmpe-i2cpi@raspberrypi:~ $ ls /sys/bus/i2c/devices/1-0051driver  dummye2prom5  eeprom  modalias  name  of_node  power  subsystem  supplier:platform:fe200000.gpio  supplier:regulator:regulator.0  uevent
Trying to run the script from 'HAT EEPROM tools' fails as it tries to access a device on address a file '1-000x51' which ins't there for sure - correct would be '1-0051'

Code:

pi@raspberrypi:~ $ sudo eepflash.sh --read --device=1 --address=0x51 -t=24c32 -f hat_eeprom_dump.eepThis will attempt to talk to an eeprom at i2c address 0x0x51. Make sure there is an eeprom at this address.This script comes with ABSOLUTELY no warranty. Continue only if you know what you are doing.Do you wish to continue? (yes/no): yes/usr/local/bin/eepflash.sh: 161: echo: echo: I/O errorReading...dd: failed to open '/sys/class/i2c-adapter/i2c-1/1-000x51/eeprom': No such file or directoryClosing EEPROM Device./usr/local/bin/eepflash.sh: 189: echo: echo: I/O errorError doing I/O operation.
eepromtools.jpg
reading it in a different way

Code:

pi@raspberrypi:~ $ sudo dd if=/sys/class/i2c-dev/i2c-1/device/1-0051/eeprom bs=1 count=4096 | hexdump -C00000000  52 2d 50 69 02 00 01 00  46 00 00 00 01 00 00 00  |R-Pi....F.......|00000010  32 00 00 00 9c 6e 67 e6  4e 3c 6f 8e 79 47 e0 a8  |2....ng.N<o.yG..|00000020  01 d0 3a 83 00 00 03 00  0c 0e 52 61 73 70 62 65  |..:.......Raspbe|00000030  72 72 79 20 50 69 4d 2e  32 20 48 41 54 2b 20 4d  |rry PiM.2 HAT+ M|00000040  20 4b 65 79 90 1a ff ff  ff ff ff ff ff ff ff ff  | Key............|00000050  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|*00000fe0  30 30 30 30 31 31 32 34  30 30 31 30 31 34 31 34  |0000112400101414|00000ff0  00 ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|4096+0 records in4096+0 records out4096 bytes (4.1 kB, 4.0 KiB) copied, 2.1727 s, 1.9 kB/s00001000pi@raspberrypi:~ $ sudo dd if=/sys/class/i2c-dev/i2c-1/device/1-0051/eeprom bs=1 count=4096 | hexdump -C > hateeprom.eep4096+0 records in4096+0 records out4096 bytes (4.1 kB, 4.0 KiB) copied, 2.13714 s, 1.9 kB/s
eedump gives me a format signature mismatch

Code:

pi@raspberrypi:~ $ eepdump hateeprom.eep hat_eeprom_dump.txtWARNING: Format signature mismatchUnexpected EOF or error occurred
So what are your suggestions on how to proceed?

Statistics: Posted by aBUGSworstnightmare — Sun May 26, 2024 7:41 am



Viewing all articles
Browse latest Browse all 4151

Trending Articles