Wrote a python script using SMBus to write to a slave I2C device. The slave is detectable with i2cdetect which results in the following output
debian@beaglebone:~$ i2cdetect -y -r 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: 30 – -- – -- – -- – -- – -- – -- – -- –
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- UU UU UU UU – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --
The slave device would not respond to commands and upon inspecting it with a scope the voltage signal is appearing lower than the high threshold and has a very high time constant it seems.
The slave device has its own internal pull-up resistors of two 4.7k resistors one on each of the buses to the 3V supply on the BBB.
The frequency of the bus is set to 400kHz on i2c-2. The BBB is being powered by USB only.
The following images are of the SCL bus
Could the issue be that the pull up resistors are too high? Does the BBB require more power via an external source?
I use 5.6k resistors. I think what your seeing is a slow scope.
Thanks Wulf, I will attempt to increase the resistor values and get back with results.
You mean decrease the resistor values. Don’t rely on the internal pull up resistors. 4K7 should be OK, but try 3K3 to see if the signals look better.
I only managed to get hold of a couple 1k resistors and wired them up to the 3v3 rail and got improvements. I am going to assume the internal pullups on the I2C device were not enabled.
With the 1k resistors improvement is evident in terms of voltage level for the high signal.
However the rise time still seems to be slow and I2C device is still not responding to commands.
I will try and increase the resistance to 3k3 as advised by John and will report back with results.
It looks like you have some extra capacitance on the bus. There should not be any capacitors bridging the I2C data and clock lines. Some of the third-party universal interface cards have extra capacitance, so take those off.
I have never heard of an I2C part with built in pull-up resistors.
Do to the multi-drop nature of the I2C bus, pull up resistors are almost always external. There are some “weak pull up” resistors you could turn on in the BBB, but are too high in value for most applications.
I suggest you read up on how to select pull up resistors for an I2C bus. Phillips (now NXP) initially developed the bus and has good documentation.
Google: NXP I2C bus documentation
But the short answer is that for a 3.3V bus, resistors in the range of 1.2K to 3.3K should work fine. The value is not critical. You want to pull 1 to 3 mA through the resistor when the bus is low.
Yeah, I agree there is something else going on here. with a 1K resistor, the signals should not have a slow rising time. The rise time doesn’t look like a capacitor, but I agree, that is about the only explanation that would cause the rise time to slow like this. Maybe the I2C part is faulty. Try plugging in another I2C part to see if the problem persists.
Thank you John,
It seems like my scope was loading it quite a bit and is now giving much better readings using x10 probes. The signals bellow are set to 400 kHz using 1kOhm pull-ups
Yeah, that is much better. Not sure you have to use a 1K pullup. See if a 3K3 or a 4K7 does gives you clean signals. BTW, your earth pin on your scope is too long and that is why you are seeing noisy signals. Search google for "scope probe short ground” and look at the images on how to do this.