Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i2c failing to initialize and detect devices #6057

Open
EdgarSouSousa opened this issue Mar 21, 2024 · 10 comments
Open

i2c failing to initialize and detect devices #6057

EdgarSouSousa opened this issue Mar 21, 2024 · 10 comments

Comments

@EdgarSouSousa
Copy link

Describe the bug

The i2c bus fails to detect and communicate with connected i2c devices. Dmesg output:
[ 1.878285] i2c_dev: i2c /dev entries driver
[ 2.368416] brcmstb-i2c 107d508200.i2c: @97500hz registered in interrupt mode
[ 2.380348] brcmstb-i2c 107d508280.i2c: @97500hz registered in interrupt mode
[ 63.352260] i2c_designware 1f00074000.i2c: i2c_dw_handle_tx_abort: lost arbitration
[ 63.352340] i2c_designware 1f00074000.i2c: i2c_dw_handle_tx_abort: lost arbitration
[ 63.352408] i2c_designware 1f00074000.i2c: i2c_dw_handle_tx_abort: lost arbitration
[ 63.352476] i2c_designware 1f00074000.i2c: i2c_dw_handle_tx_abort: lost arbitration
[ 63.352564] i2c_designware 1f00074000.i2c: i2c_dw_handle_tx_abort: lost arbitration
[ 63.352627] i2c_designware 1f00074000.i2c: i2c_dw_handle_tx_abort: lost arbitration
[ 63.352703] i2c_designware 1f00074000.i2c: i2c_dw_handle_tx_abort: lost arbitration

Steps to reproduce the behaviour

Enable the i2c interface using raspi-config
Connect any i2c device
run sudo i2cdetect -y 1
sudo dmesg | grep i2c

Device (s)

Raspberry Pi 5

System

Raspberry Pi reference 2024-03-15

2024/02/16 15:28:41
Copyright (c) 2012 Broadcom
version 4c845bd3 (release) (embedded)

Linux raspberrypi-722 6.6.21-v8-16k+ #1 SMP PREEMPT Mon Mar 18 17:00:44 UTC 2024 aarch64 GNU/Linux

Logs

No response

Additional context

I have already flashed a new image , installed most recent firmware and tried with multiple i2c devices

@pelwell
Copy link
Contributor

pelwell commented Mar 21, 2024

Likely duplicate of #6056.

  1. Which devices are attached?
  2. Have you set the I2C clock rate?
  3. When it fails, what does pinctrl 2-3 show?

@EdgarSouSousa
Copy link
Author

EdgarSouSousa commented Mar 21, 2024

  1. Currently attached a VEML7700 sensor
  2. I have not , I simply enabled the i2c using raspi-config
  3. 2: a3 pu | hi // GPIO2 = SDA1 3: a3 pu | hi // GPIO3 = SCL1

Thank you for your speedy response

@pelwell
Copy link
Contributor

pelwell commented Mar 21, 2024

Is that a self-built kernel? If so, what was the head-of-tree? If not, where did it come from?

@EdgarSouSousa
Copy link
Author

It is not a self built kernel, I updated the kernel when facing the issues using 'sudo apt full-upgrade'.

Thank you.

@popcornmix
Copy link
Collaborator

Linux raspberrypi-722 6.6.21-v8-16k+ https://github.com/raspberrypi/linux/issues/1 SMP PREEMPT Mon Mar 18 17:00:44 UTC 2024 aarch64 GNU/Linux

It is not a self built kernel, I updated the kernel when facing the issues using 'sudo apt full-upgrade'.

from RPiOS bookworm?

That doesn't seem right. The latest apt version is 6.6.20 (2024-03-07)

@pelwell
Copy link
Contributor

pelwell commented Mar 21, 2024

Thanks - I was just coming to the same conclusion

@EdgarSouSousa
Copy link
Author

I apologize for my mistake, I forgot i tried to upgrade the kernel previously to posting this issue, as seen in #6056 (comment).

The issue was first encountered in the latest apt version and persisted to the version present in pull 6050.

@pelwell
Copy link
Contributor

pelwell commented Mar 25, 2024

A VEML7700 arrived in the post today and it is showing this behaviour. I can make it fail on vanilla 6.1 kernels, so I don't think it is a new issue. There seem to be situations where it is behaving in a non-compliant fashion, but the failure should not kill the I2C bus in the way it does.

pelwell added a commit to pelwell/linux that referenced this issue Mar 26, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700, which seems to cause it to issue an ACK
too early, and the controller to complain about losing arbitration.
There is a suspicion that this may be a more widespread problem, but at
least this patch prevents the bus from locking up.

See: raspberrypi#6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pelwell added a commit to pelwell/linux that referenced this issue Mar 26, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: raspberrypi#6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pelwell added a commit to pelwell/linux that referenced this issue Mar 26, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: raspberrypi#6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
@pelwell
Copy link
Contributor

pelwell commented Mar 26, 2024

PR #6071 is a fix/workaround for the bus lockup. It's still not clear to me what your system is doing to provoke the problem - is it really just i2cdetect -y 1?

@EdgarSouSousa
Copy link
Author

Originally the issue was found after attempting to read from the i2c slave, and after failure I ran i2c detect. After reboot the issues persists, when just running i2cdetect -y 1. At a later date I will attempt with the new workaround and with a fresh RaspberryPi5.

Thank you.

pelwell added a commit that referenced this issue Mar 27, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pelwell added a commit that referenced this issue Apr 5, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pelwell added a commit that referenced this issue Apr 5, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pelwell added a commit that referenced this issue Apr 5, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix pushed a commit that referenced this issue Apr 5, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix pushed a commit that referenced this issue Apr 5, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix pushed a commit that referenced this issue Apr 8, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix pushed a commit that referenced this issue Apr 11, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix pushed a commit that referenced this issue Apr 16, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix pushed a commit that referenced this issue Apr 16, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix pushed a commit that referenced this issue Apr 18, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix pushed a commit that referenced this issue Apr 23, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix pushed a commit that referenced this issue Apr 29, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix pushed a commit that referenced this issue Apr 29, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix pushed a commit that referenced this issue May 2, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix pushed a commit that referenced this issue May 13, 2024
Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: #6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants