Dear Jean,
Am 18.07.23 um 09:05 schrieb Jean Delvare:
On Fri, 14 Jul 2023 12:57:33 +0200, Paul Menzel wrote:
I updated the CPLD firmware to version 1.09 now, and to verify tried
your commands, but get an error:
# i2cdump -f -y 0 0x40
No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 88 01 ff 07 0f cc cc cc cc cc cc cc cc cc cc cc ??.?????????????
10: ff 03 3f cc 01 cc cc cc cc cc cc cc cc cc cc cc .???????????????
20: ff cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc .???????????????
30: 03 00 00 00 cc cc cc cc cc cc cc cc cc cc cc cc ?...????????????
40: cc cc cc 0e cc cc cc cc cc cc cc cc cc cc cc cc ????????????????
50: 0d 4a 03 00 7f cc cc cc cc cc cc cc cc cc cc cc ?J?.????????????
60: 01 71 1e cc cc cc cc cc cc cc cc cc cc cc cc cc ?q??????????????
70: 7f 7f 7f 7f 7f cc cc cc cc cc cc cc cc cc cc cc ????????????????
80: 6a 69 69 69 68 cc cc cc cc cc cc cc cc cc cc cc jiiih???????????
90: 02 00 71 71 cc cc cc cc cc cc cc cc cc cc cc cc ?.qq????????????
a0: 00 00 00 00 00 00 f0 01 00 00 00 c0 cc cc cc cc ......??...?????
b0: 00 00 00 00 00 00 00 00 00 00 00 00 cc cc cc cc ............????
c0: 0f fe ff ff ff 3f 00 00 00 00 00 00 cc cc cc cc ??...?......????
d0: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ????????????????
e0: 00 71 cc cc cc cc cc cc cc cc cc cc cc cc cc 00 .q?????????????.
f0: 41 53 35 31 31 34 00 00 00 00 00 00 41 57 53 09 AS5114......AWS?
# i2cget 0 0x40 0x01 b
Error: Could not set address to 0x40: Device or resource busy
# i2cget 0 0x40 0xff b
Error: Could not set address to 0x40: Device or resource busy
Do you know, why i2cdump is able to read the date, but i2cget is not?
You already have a kernel driver bound to address 0x40, so you aren't
supposed to access it from user-space. You bypassed this check with
option -f you passed to i2cdump, but you did not pass option -f to
i2cget, which is why the former succeeded while the latter failed.
So either pass -f to i2cget, or unload the kernel driver
(arm64_accton_as4224_cpld) before reading the value from user-space.
Whichever option is safer depends on what happens when the system runs
without that driver. In theory it's better to unload the driver,
however depending on how the driver is implemented and whether reading
these values has any side effect on the hardware side, forcing the read
may be fine.
Thank you again for the detailed and spot-on answer. Passing `-f` it
worked (without any side-effects for now):
# dpkg -l i2c-tools | grep ^ii
ii i2c-tools 3.1.2-3 arm64 heterogeneous set of
I2C tools for Linux
root@ec-as5114-48x-03:~# i2cget -f 0 0x40 0x01 b
WARNING! This program can confuse your I2C bus, cause data loss and
worse!
I will read from device file /dev/i2c-0, chip address 0x40, data
address
0x01, using read byte data.
Continue? [Y/n] Y
0x01
root@ec-as5114-48x-03:~# i2cget -f 0 0x40 0xff b
WARNING! This program can confuse your I2C bus, cause data loss and
worse!
I will read from device file /dev/i2c-0, chip address 0x40, data
address
0xff, using read byte data.
Continue? [Y/n]
0x09
Kind regards,
Paul