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

BCM2708 I²C driver stops working sometimes #1379

Closed
tyrel opened this issue Mar 28, 2016 · 16 comments
Closed

BCM2708 I²C driver stops working sometimes #1379

tyrel opened this issue Mar 28, 2016 · 16 comments
Labels
Close within 30 days Issue will be closed within 30 days unless requested to stay open

Comments

@tyrel
Copy link

tyrel commented Mar 28, 2016

The I²C driver for the BCM2708 in the Raspbian kernel gets into a state sometimes where it can't send data anymore; every request to write() times out. This can be seen by running i2cdetect -r 1 from i2c-tools; normally it takes a fraction of a second to probe the bus, but it takes nearly two minutes under this situation because each request times out instead of returning almost immediately.

I'm using a Raspberry Pi 2, currently with kernel 4.1.19-v7+, but this issue has also been reported on 4.1.18-v7+ on both Raspberry Pi 2 and Zero here: http://raspberrypi.stackexchange.com/questions/43697/i2cdetect-on-raspberry-pi-kernel-4-1-18-v7-takes-115-seconds

This message appears in dmesg output for each attempt:

[28463.668743] i2c i2c-1: transfer timed out

My current workaround is to do this when I detect the situation:

sudo rmmod i2c_bcm2708
sudo rmmod i2c_dev
sudo modprobe i2c_dev
sudo modprobe i2c_bcm2708

However that is far from ideal, as I don't know I need to do it until I detect a failure, and then I have to try to do some sort of recovery.

@pelwell
Copy link
Contributor

pelwell commented Mar 28, 2016

Can you give any further information about the failure mode:

  • Does it always fail from boot, or does it sometimes work a few times before failing?
  • Does it only occur when you are using certain devices?
  • Anything else you can think of.

@tyrel
Copy link
Author

tyrel commented Apr 4, 2016

More recently I've found that this is happening after I run my own program. I've attempted to create a small sample program that I could use to reproduce the issue and provide to you, but so far I haven't been able to reproduce the issue.

I'm having the exact same problem now with the serial port, so my code is doing something wrong but I haven't been able to figure out what. I'm definitely closing all the file descriptors I have open to these devices.

I will continue working on it and update this issue if I discover the cause, whether it's just me being a dummy or something actually wrong with the kernel or device drivers.

@ssvenn
Copy link

ssvenn commented May 7, 2016

I struggled with this same behavior while setting up a UPS pico from pimodules, In the end it looks like the microcontroller on the UPS board had crashed and were jamming i2c communications. Once I reset the hardware i2cdetect worked normally again. Try disconnecting your i2c peripherals and see if i2cdetect runs at the regular speed! If that fixes it, maybe you have a bad connection or dodgy component in your circuit!

@taylo232
Copy link

Hi,
I am having the identical issues with i2cdetect (slow and not detecting devices - an MCP23017 in this case). I had a working breadboard project running perfectly on my Model B. I transferred it pin for pin to my A+ and had these issues. Running the script from tyrel immediately solved the issues. Raspbian, kernel, raspi-config and firmware updates all the latest on both devices.

@lategoodbye
Copy link
Contributor

@taylo232
Please tell us which pins you are using?

@taylo232
Copy link

taylo232 commented Feb 12, 2017 via email

@pelwell
Copy link
Contributor

pelwell commented Feb 12, 2017

vcgencmd get_throttled will report any undervoltage issues, but 0.85A sounds inadequate.

@JamesH65
Copy link
Contributor

Closing due to lack of activity. Reopen if you feel this issue is still relevant.

@tyrel
Copy link
Author

tyrel commented May 18, 2017

It's still happening so I don't think this should be closed.

@tyrel
Copy link
Author

tyrel commented May 18, 2017

I don't know how to re-open...

@popcornmix
Copy link
Collaborator

There should be a button marked "Reopen and comment" below the comment box.

@tyrel
Copy link
Author

tyrel commented May 18, 2017

Sorry, that option is not there for me. There's only a Comment button, on both desktop and mobile.

@popcornmix
Copy link
Collaborator

Are you sure your power supply is sufficient?
(e.g. by measuring 5V voltage on gpio header when device is under load)

@JamesH65 JamesH65 reopened this May 18, 2017
@JamesH65
Copy link
Contributor

Please update to the latest kernel which may contain a fix for this issue.

This issue will be closed within 30 days unless further interactions are posted. If you wish this issue to remain open, please add a comment. A closed issue may be reopened if requested.

@JamesH65 JamesH65 added the Close within 30 days Issue will be closed within 30 days unless requested to stay open label Jun 28, 2018
@JamesH65
Copy link
Contributor

Closing due to lack of activity. Please request to be reopened if you feel this issue is still relevant.

@tyrel
Copy link
Author

tyrel commented Aug 31, 2018

Sorry, the project I was working on was shelved because I²C was too unreliable due to this persistent issue. I've been unable to test any newer kernels as a result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Close within 30 days Issue will be closed within 30 days unless requested to stay open
Projects
None yet
Development

No branches or pull requests

7 participants