樹莓派 HATs ︰ eepmake 《中》

如果聽聞

RPI does not boot if HAT EEPROM is corrupted #33

I’ve seen a problem with a board where the EEPROM content wasn’t written correctly. With older 3.x kernels the board boots, but not with the latest kernel/firmware. Is there any kernel parameter to ignore the ID PROM contents? This needs to be only temporary to write the correct EEPROM contents.

……

 

,恐怕不敢嘗試了!假使知道

You can disable the EEPROM reading using the config.txt setting force_eeprom_read=0. I’ll take a look at the reading code to see why it doesn’t boot. If you can read the EEPROM contents and upload it somewhere (or email it to me) I can use it as a test case.

 

,玩玩又有何妨耶?

且讓我們仔細看看 eepflash.sh 怎麼讀寫 ID EEPROM 的呢?

# eepflash.sh line 90

modprobe i2c_dev
dtoverlay i2c-gpio i2c_gpio_sda=0 i2c_gpio_scl=1
rc=? if [rc != 0 ]; then
        echo "Loading of i2c-gpio dtoverlay failed. Do an rpi-update (and maybe apexitrc
fi
modprobe at24
rc=? if [rc != 0 ]; then
        echo "Modprobe of at24 failed. Do an rpi-update."
        exit rc fi  if [ ! -d "/sys/class/i2c-adapter/i2c-3/3-0050" ]; then         echo "TYPE 0x50" > /sys/class/i2c-adapter/i2c-3/new_device
fi

if [ "MODE" = "write" ]  then         echo "Writing..."         dd if=FILE of=/sys/class/i2c-adapter/i2c-3/3-0050/eeprom
        rc=? elif [ "MODE" = "read" ]
 then
        echo "Reading..."
        dd if=/sys/class/i2c-adapter/i2c-3/3-0050/eeprom of=FILE         rc=?
fi

 

,原來是用 dd !如是可以假設是以 kernel at24 驅動程式來作的了 !!??由於 HiFiBerry DAC+ 的『寫入』 WR 太過麻煩,

Flash your DAC+ for automatic configuration

Do you need to flash your card?
No. If you have your system configured already, you can just keep it as it is.

What do you need to do to flash your HiFiBerry DAC+?

  1. Download the flash image from here and extract the ZIP file.
  2. Write the file flash-dacplus.img to an empty SD card
  3. Connect a display to your Raspberry Pi and boot from SD card you just wrote to
  4. When the flasher says “Press WRITE button”, press the white button (named “WR”) on your HiFiBerry DAC+. You need to press the button for about 40-60 seconds.
  5. When the data is written to the EEPROM the Raspberry Pi will reboot and play a (loud) test tone.

Is this only available for the DAC+?
We want to test this first with one card. At this time, only the DAC+ Standard and DAC+ Pro are supported.  If everything works fine, we will provide a flash tool for the Digi+ in the near future.

───

 

所以作者選擇

Adafruit Perma-Proto HAT for Pi Mini Kit – With EEPROM

作測試也。相信讀者自可解讀測試結果的吧??!!

pi@raspberrypi:~ cat /proc/version  Linux version 4.4.26-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #915 SMP Thu Oct 20 17:08:44 BST 2016 pi@raspberrypi:~

 

pi@raspberrypi:~ sudo modprobe i2c_dev pi@raspberrypi:~ sudo dtoverlay i2c-gpio i2c_gpio_sda=0 i2c_gpio_scl=1
pi@raspberrypi:~ sudo modprobe at24  pi@raspberrypi:~ dmesg | tail
[   11.362701] Bluetooth: BNEP filters: protocol multicast
[   11.362718] Bluetooth: BNEP socket layer initialized
[   26.324406] pcm512x 1-004c: No SCLK, using BCLK: -2
[   26.328952] pcm512x 1-004c: No SCLK, using BCLK: -2
[   26.330990] pcm512x 1-004c: No SCLK, using BCLK: -2
[   26.335874] pcm512x 1-004c: No SCLK, using BCLK: -2
[   26.340147] pcm512x 1-004c: No SCLK, using BCLK: -2
[   26.753253] pcm512x 1-004c: No SCLK, using BCLK: -2
[   28.322041] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[ 5362.460586] i2c-gpio i2c@0: using pins 0 (SDA) and 1 (SCL)
pi@raspberrypi:~ </pre>   <pre class="lang:default decode:true">pi@raspberrypi:~ cd hats/eepromutils/
pi@raspberrypi:~/hats/eepromutils dd if=/dev/zero ibs=1k count=4 of=zero.eep 4+0 records in 8+0 records out 4096 bytes (4.1 kB) copied, 0.000937858 s, 4.4 MB/s  pi@raspberrypi:~/hats/eepromutils sudo ./eepflash.sh -w -f=zero.eep -t=24c32
This will attempt to talk to an eeprom at i2c address 0x50. 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
Writing...
8+0 records in
8+0 records out
4096 bytes (4.1 kB) copied, 81.909 s, 0.1 kB/s
Done.
pi@raspberrypi:~/hats/eepromutils </pre>   <pre class="lang:default decode:true"># dmesg [ 5572.324220] device-tree: Duplicate name in base, renamed to "i2c@0#1" [ 5572.324381] ------------[ cut here ]------------ [ 5572.324396] WARNING: CPU: 3 PID: 1264 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x78/0x88() [ 5572.324401] sysfs: cannot create duplicate filename '/devices/platform/i2c@0' [ 5572.324406] Modules linked in: at24 i2c_gpio i2c_algo_bit bnep hci_uart btbcm bluetooth sg hid_multitouch brcmfmac brcmutil snd_soc_pcm512x_i2c snd_soc_pcm512x joydev cfg80211 evdev regmap_i2c rfkill snd_soc_bcm2835_i2s snd_soc_allo_piano_dac snd_soc_core snd_pcm_dmaengine i2c_bcm2708 bcm2835_wdt snd_pcm snd_timer snd bcm2835_gpiomem uio_pdrv_genirq uio i2c_dev fuse ipv6 [ 5572.324481] CPU: 3 PID: 1264 Comm: dtoverlay Not tainted 4.4.26-v7+ #915 [ 5572.324486] Hardware name: BCM2709 [ 5572.324505] [<80018784>] (unwind_backtrace) from [<80014058>] (show_stack+0x20/0x24) [ 5572.324518] [<80014058>] (show_stack) from [<80321364>] (dump_stack+0xd4/0x118) [ 5572.324531] [<80321364>] (dump_stack) from [<800253c4>] (warn_slowpath_common+0x98/0xc8) [ 5572.324542] [<800253c4>] (warn_slowpath_common) from [<80025434>] (warn_slowpath_fmt+0x40/0x48) [ 5572.324552] [<80025434>] (warn_slowpath_fmt) from [<801cd2a8>] (sysfs_warn_dup+0x78/0x88) [ 5572.324562] [<801cd2a8>] (sysfs_warn_dup) from [<801cd3a4>] (sysfs_create_dir_ns+0x94/0xa4) [ 5572.324573] [<801cd3a4>] (sysfs_create_dir_ns) from [<80323e10>] (kobject_add_internal+0xb4/0x30c) [ 5572.324585] [<80323e10>] (kobject_add_internal) from [<80324240>] (kobject_add+0x50/0x94) [ 5572.324596] [<80324240>] (kobject_add) from [<803a6880>] (device_add+0xe8/0x574) [ 5572.324609] [<803a6880>] (device_add) from [<804a454c>] (of_device_add+0x44/0x4c) [ 5572.324622] [<804a454c>] (of_device_add) from [<804a4de8>] (of_platform_device_create_pdata+0x94/0xc8) [ 5572.324633] [<804a4de8>] (of_platform_device_create_pdata) from [<804a4f04>] (of_platform_notify+0xc4/0xfc) [ 5572.324645] [<804a4f04>] (of_platform_notify) from [<800438b4>] (notifier_call_chain+0x54/0x94) [ 5572.324656] [<800438b4>] (notifier_call_chain) from [<80043cec>] (__blocking_notifier_call_chain+0x58/0x70) [ 5572.324667] [<80043cec>] (__blocking_notifier_call_chain) from [<80043d2c>] (blocking_notifier_call_chain+0x28/0x30) [ 5572.324679] [<80043d2c>] (blocking_notifier_call_chain) from [<804a5dd8>] (__of_changeset_entry_notify+0x94/0xf0) [ 5572.324690] [<804a5dd8>] (__of_changeset_entry_notify) from [<804a6728>] (of_changeset_apply+0x68/0xd8) [ 5572.324700] [<804a6728>] (of_changeset_apply) from [<804aa320>] (of_overlay_create+0x264/0x37c) [ 5572.324711] [<804aa320>] (of_overlay_create) from [<804a569c>] (create_overlay+0x58/0xbc) [ 5572.324723] [<804a569c>] (create_overlay) from [<804a5768>] (cfs_overlay_item_dtbo_write+0x68/0xa8) [ 5572.324734] [<804a5768>] (cfs_overlay_item_dtbo_write) from [<801cec64>] (configfs_release_bin_file+0x6c/0xa0) [ 5572.324745] [<801cec64>] (configfs_release_bin_file) from [<8015934c>] (__fput+0x94/0x1e4) [ 5572.324754] [<8015934c>] (__fput) from [<8015950c>] (____fput+0x18/0x1c) [ 5572.324766] [<8015950c>] (____fput) from [<80040b64>] (task_work_run+0xa0/0xd4) [ 5572.324777] [<80040b64>] (task_work_run) from [<80013914>] (do_work_pending+0xcc/0xd0) [ 5572.324789] [<80013914>] (do_work_pending) from [<8000fb68>] (slow_work_pending+0xc/0x20) [ 5572.324795] ---[ end trace b35122a91729970c ]--- [ 5572.324800] ------------[ cut here ]------------ [ 5572.324809] WARNING: CPU: 3 PID: 1264 at lib/kobject.c:240 kobject_add_internal+0x294/0x30c() [ 5572.324814] kobject_add_internal failed for i2c@0 with -EEXIST, don't try to register things with the same name in the same directory. [ 5572.324818] Modules linked in: at24 i2c_gpio i2c_algo_bit bnep hci_uart btbcm bluetooth sg hid_multitouch brcmfmac brcmutil snd_soc_pcm512x_i2c snd_soc_pcm512x joydev cfg80211 evdev regmap_i2c rfkill snd_soc_bcm2835_i2s snd_soc_allo_piano_dac snd_soc_core snd_pcm_dmaengine i2c_bcm2708 bcm2835_wdt snd_pcm snd_timer snd bcm2835_gpiomem uio_pdrv_genirq uio i2c_dev fuse ipv6 [ 5572.324879] CPU: 3 PID: 1264 Comm: dtoverlay Tainted: G        W       4.4.26-v7+ #915 [ 5572.324883] Hardware name: BCM2709 [ 5572.324895] [<80018784>] (unwind_backtrace) from [<80014058>] (show_stack+0x20/0x24) [ 5572.324905] [<80014058>] (show_stack) from [<80321364>] (dump_stack+0xd4/0x118) [ 5572.324915] [<80321364>] (dump_stack) from [<800253c4>] (warn_slowpath_common+0x98/0xc8) [ 5572.324926] [<800253c4>] (warn_slowpath_common) from [<80025434>] (warn_slowpath_fmt+0x40/0x48) [ 5572.324937] [<80025434>] (warn_slowpath_fmt) from [<80323ff0>] (kobject_add_internal+0x294/0x30c) [ 5572.324947] [<80323ff0>] (kobject_add_internal) from [<80324240>] (kobject_add+0x50/0x94) [ 5572.324958] [<80324240>] (kobject_add) from [<803a6880>] (device_add+0xe8/0x574) [ 5572.324968] [<803a6880>] (device_add) from [<804a454c>] (of_device_add+0x44/0x4c) [ 5572.324979] [<804a454c>] (of_device_add) from [<804a4de8>] (of_platform_device_create_pdata+0x94/0xc8) [ 5572.324990] [<804a4de8>] (of_platform_device_create_pdata) from [<804a4f04>] (of_platform_notify+0xc4/0xfc) [ 5572.325001] [<804a4f04>] (of_platform_notify) from [<800438b4>] (notifier_call_chain+0x54/0x94) [ 5572.325011] [<800438b4>] (notifier_call_chain) from [<80043cec>] (__blocking_notifier_call_chain+0x58/0x70) [ 5572.325022] [<80043cec>] (__blocking_notifier_call_chain) from [<80043d2c>] (blocking_notifier_call_chain+0x28/0x30) [ 5572.325033] [<80043d2c>] (blocking_notifier_call_chain) from [<804a5dd8>] (__of_changeset_entry_notify+0x94/0xf0) [ 5572.325043] [<804a5dd8>] (__of_changeset_entry_notify) from [<804a6728>] (of_changeset_apply+0x68/0xd8) [ 5572.325052] [<804a6728>] (of_changeset_apply) from [<804aa320>] (of_overlay_create+0x264/0x37c) [ 5572.325062] [<804aa320>] (of_overlay_create) from [<804a569c>] (create_overlay+0x58/0xbc) [ 5572.325073] [<804a569c>] (create_overlay) from [<804a5768>] (cfs_overlay_item_dtbo_write+0x68/0xa8) [ 5572.325083] [<804a5768>] (cfs_overlay_item_dtbo_write) from [<801cec64>] (configfs_release_bin_file+0x6c/0xa0) [ 5572.325092] [<801cec64>] (configfs_release_bin_file) from [<8015934c>] (__fput+0x94/0x1e4) [ 5572.325100] [<8015934c>] (__fput) from [<8015950c>] (____fput+0x18/0x1c) [ 5572.325110] [<8015950c>] (____fput) from [<80040b64>] (task_work_run+0xa0/0xd4) [ 5572.325120] [<80040b64>] (task_work_run) from [<80013914>] (do_work_pending+0xcc/0xd0) [ 5572.325131] [<80013914>] (do_work_pending) from [<8000fb68>] (slow_work_pending+0xc/0x20) [ 5572.325136] ---[ end trace b35122a91729970d ]--- [ 5572.325144] of_platform_notify: failed to create for '//i2c@0' [ 5572.325149] __of_changeset_entry_notify: notifier error @//i2c@0 [ 5572.391499] at24 3-0050: 4096 byte 24c32 EEPROM, writable, 1 bytes/write [ 5572.391549] i2c i2c-3: new_device: Instantiated device 24c32 at 0x50 pi@raspberrypi:~/hats/eepromutils

 

pi@raspberrypi:~/hats/eepromutils sudo ./eepflash.sh -r -f=invalid.eep -t=24c32 This will attempt to talk to an eeprom at i2c address 0x50. 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 Reading... 8+0 records in 8+0 records out 4096 bytes (4.1 kB) copied, 0.243574 s, 16.8 kB/s Done.  pi@raspberrypi:~/hats/eepromutils hexdump invalid.eep 
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0001000
pi@raspberrypi:~/hats/eepromutils $