Linux driver to interface with a DS2432 (family B3) over 1-wire.
pacman -S linux-headers
apt-get install raspberrypi-kernel-headers
Simple type make
.
insmod
the driver:
insmod ./w1_ds2432.ko
Then when connecting a DS2432 device, a new device will appear in the following
path: /sys/bus/w1/devices/b3-xxxxxxxxxxxx
.
The following list of files will be created:
eeprom
: read/write data on the chipsecret
: 8 bytes, this key will be used when writing to write-protected devicesecret_sync
: 1 byte, force the chip to use this keywrite_protect_secret
: put the secret in write-protected modewrite_protect_pages_03
: put the eeprom in write-protected modeuser_byte
: read the user bytefactory_byte
: read the factory byteeprom_mode_page1
:write_protect_page0
:manufacturer_id
:registration_number
:Reading the EEPROM:
# hexdump -C /sys/bus/w1/devices/b3-xxxxxxxxxxxx/eeprom
Writing to EEPROM:
# cp eeprom.bin /sys/bus/w1/devices/b3-xxxxxxxxxxxx/eeprom
Use the key 00112233445577
to write on the EEPROM:
# echo -e -n "\x00\x11\x22\x33\x44\x55\x66\x77" > /sys/bus/w1/devices/b3-xxxxxxxxxxxx/secret
# cp eeprom.bin /sys/bus/w1/devices/b3-xxxxxxxxxxxx/eeprom
Ask the chip to use the secret aabbccddeeff1122
:
# echo -e -n "\xaa\xbb\xcc\xdd\xee\xff\x11\x22" > /sys/bus/w1/devices/b3-xxxxxxxxxxxx/secret
# echo -n 1 > /sys/bus/w1/devices/b3-xxxxxxxxxxxx/secret_sync
Interacting with the chips can lead to the following errors:
EACCES
: mac is invalid, probablue due to a bad key (permission denied
). Verify secret.EPERM
: mac is valid, but the chip is write-protected
(operation not permitted
).EIO
: unknown error, potentially i/o related (input/output error
). Try to disconnect/reconnect the chip.