Broken i2c device shows in /sys/bus/i2c but not i2cdetect - Page 1
Forum section: electronics / general

author: Lomax
author_rank: Frequent Contributor
timestamp: September 07, 2024, 05:57:53 am
content: I think I may have broken the i2c bus on myMonarco hat; I've tested it with three different Raspberry Pis and three different Pi OS images and always get the same symptoms: the hat's i2c devices (an MCP7941 RTC at 0x6F and a DS2482 1-Wire interface at 0x18) show up in /sys/bus/i2c, but i2cdetect and i2cget cannot find them:Code:$ ls /sys/bus/i2c/devices/1-0018 1-006f i2c-1 i2c-2$ cat /sys/bus/i2c/devices/*/nameds2482mcp7941xbcm2835 (i2c@7e804000)bcm2835 (i2c@7e805000)$ i2cdetect -y 10 1 2 3 4 5 6 7 8 9 a b c d e f00: -- -- -- -- -- -- -- --10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --70: -- -- -- -- -- -- -- --$ i2cget -y 1 0x18 0x0fError: Read failed$ i2cget -y 1 0x6f 0x0fError: Read failedI'm curious how it can be that the devices are present in /sys/bus/i2c but cannot be talked to, what sort of failure mode could cause this?

author: RoGeorge
author_rank: Super Contributor
timestamp: September 07, 2024, 09:21:00 am
content: Don't have a Monarco, but I know there were some major changes in the Linux kernel about 1-2 generations of Pi OS ago (regarding the drivers).You say you tried 3 OS images but you didn't say the version. Before anything else, try with the old OS version that you know for sure your hat used to work.If the old version of the OS works, but newer OS version don't work, then the proper way to fix is to get new drivers for that hat. Otherwise you must stay with the OS version for which the hat was developed and still has drivers. Or check with the hat seller if they offer any updated drivers for the current kernel.(Don't try to downgrade only the kernel while keeping the rest of the Pi OS to the most recent versions. In theory this should work for Linux, but in practice I did that and got later into all kinds of bugs and troubles specific to the Pi OS distributions of Debian.)

author: Lomax
author_rank: Frequent Contributor
timestamp: September 07, 2024, 11:23:39 am
content: I can't remember the kernel versions but the images where from 2019 and 2022. The third image I tried was the latest official OS image from the manufacturer of the hat, for running their Rexygen real time control block software (this has 64-bit kernel 6.6), which has explicit support for the Monarco hat. I don't think I have any other suitable images to test with. There are no "drivers" for the Monarco hat; it uses the standard Pi I2C, UART and SPI interfaces - though there are libraries for interacting with it from C and Node.JS (and Node-RED). The I2C devices hang off the Pi's I2C-1 bus and should be accessible without any additional software, though you'll need OWFS to make practical use of the 1-Wire interface and an RTC kernel module to use the RTC. But it should be possible to talk to them without any of that, as long as I2C is enabled in the boot config (the hat will do this automagically) and i2c-dev is loaded.I assume from your reply that you agree the behaviour I'm seeing is odd?

author: RoGeorge
author_rank: Super Contributor
timestamp: September 07, 2024, 12:04:53 pm
content: The GPIO access mode has been changed when the RPi kernel stepped from kernel v5.x to v6.x.I think the kernel version in RP OS went from v5 to v6 sometime during the lifespan of Debian 11 (Bullseye), last year. Debian 12 Bookworm should be with kernel v6.x. Since your board doesn't work with neither 2019, nor with the current 2024 Raspberry OS versions, then it must be something else, but I don't know what exactly could it be, sorry.

author: Lomax
author_rank: Frequent Contributor
timestamp: September 08, 2024, 06:00:47 pm
content: I sampled the I2C lines while talking to a TSL2561 lux meter, and the two I2C devices on the Monarco hat. Only the TSL2561 responded.Esta muerto :'(