Getting I2C to work with two devices (one with internal, one with external pull-up resistor)

Hi,

i have an Arduino Portenta H7 Lite connected two Xsens MTi-3 IMU's to it. One of the MTi-3's is placed on a Development Kit, which has integrated 2k7 pull-up resistors for I2C communication. The other MTi-3 is placed on a PLCC28 socket adapter and i added the 2k7 resistors manually. The Arduino and the two MTi-3 are connected via breadboard as shown in the following picture (i hope it is clear enough, otherwise sorry i am new to the field of arduino etc.). The yellow lines show the 2k7 resistors.

Now when i first tested the MTi-3 with the Development Kit alone it was working fine (the other was not connected). Also when testing only the MTi-3 on the socket adapter (also the other MTi-3 was not connected to the arduino) it was working fine. But my problem is, when i connect both of them as shown in the picture above, the arduino can't find any I2C slave. I discovered, that when i unplug the 3V3 wire of the socket adapter, i can find the MTi-3 on the DevKit. As soon as i plug in the 3V3 wire of the MTi-3 with extern pull-up resistors again, i can't find any of the two IMU's. I thought maybe it is enough if the DevKit has the resistors and they are connected on the same line on the breadboard. But if i don't use the external 2k7 resistors, the two IMU's also can't be found. Is it impossible to communicate via I2C with two devices, one with and one without internal pull-up resistors? Or what do i need to change?

This may be a small problem, but i searched the internet and couldn't find such a problem or the solution. So thanks in advance and best regards!

Edit: I ensured that the two devices have a different address. And it worked for both of them with each their own address. So i guess the problem is in the setup/wiring.

Do they have the same I2C address ?

No i made sure they have a different address (see my edit :slight_smile: )

Two pairs of pullup resistors should not be necessary.
I know it is not an ideal solution; but you could try with one connected to SPI or serial.

Also had this idea but sadly my SPI and Serial are already used.

Is my wiring (parallel connection of SDA & SCL) correct? If i connect them parallel, for my understanding the pull-up resistors of the DevKit should also effect my other IMU, am i right?

Wire them in parellel and get rid of the external pullups and use the internal pull up of the device for both.

I just tried that, it doesn't work :frowning:

But when i unplug the 3V3 of the MTi-3 w/o internal, the other can be found. So the one without internal is crashing the I2C communication, i have absolute no idea why.

I just discovered, that when i run my detection script for a longer time and not just a few seconds, the one with internal pullups gets detected every once in a while. Very strange. Seems like a little traffic jam on the bus.

I2C scanner

What did the I2C scanner report?

Most of the time it says "No I2C devices found". Randomly and not very often, the one with internal pullups gets detected.

post an image of your project wired up with both devices.

1 Like

i hope the wiring is halfway seeable, it looks chaotic. But the wiring is as in my picture above, just with the difference, that i don't use the resistors.

You know about this and you have adjusted you breadboard accordingly. The wiring images are not all that good at showing much details.

Bread board power rail split

i tried to take better pictures. For my breadboard the power rail is continous





I will check if there is any damage at the wiring.

One more information: Yesterday i discovered one weird thing. When fully wired (both devices connected) the I2C scanner detects/not detects the MTi-3 on the DevKit in a regularity. First it started and didn't detect any device for a while (about 1 minute or so). Then the scanner detected the MTi on the DevKit once. Afterwards he didn't detect it 5 times. After that he detected the DevKit again. Then he didn't detect it two times. This cycle then repeats mostly constant. The cycle: detect, 5 times no detect, detect, 2 times no detect. For my interpretation it seems like there maybe is an internal buffer or capacity that leads to this behaviour.

After measuring electrical continuity i now face a new behaviour:

The I2C scanner detects both devices, but also not everytime. And again we have some kind of regularity. Here is a snippet of the output of the I2C scanner:

12:49:24.513 -> Scanning ...
12:49:30.088 -> No I2C devices found
12:49:30.088 ->
12:49:35.067 -> Scanning ...
12:49:38.822 -> No I2C devices found
12:49:38.822 ->
12:49:43.799 -> Scanning ...
12:49:49.391 -> No I2C devices found
12:49:49.391 ->
12:49:54.390 -> Scanning ...
12:49:59.953 -> No I2C devices found
12:49:59.953 ->
12:50:04.945 -> Scanning ...
12:50:07.560 -> I2C device found at address 0x6A !
12:50:07.560 -> I2C device found at address 0x6B !
12:50:08.074 -> done
12:50:08.074 ->
12:50:13.039 -> Scanning ...
12:50:18.620 -> No I2C devices found
12:50:18.620 ->
12:50:23.641 -> Scanning ...
12:50:29.178 -> No I2C devices found
12:50:29.178 ->
12:50:34.181 -> Scanning ...
12:50:36.827 -> I2C device found at address 0x6A !
12:50:36.827 -> I2C device found at address 0x6B !
12:50:37.294 -> done
12:50:37.294 ->
12:50:42.313 -> Scanning ...
12:50:47.858 -> No I2C devices found
12:50:47.858 ->
12:50:52.871 -> Scanning ...
12:50:58.406 -> No I2C devices found
12:50:58.406 ->
12:51:03.436 -> Scanning ...
12:51:08.978 -> No I2C devices found
12:51:08.978 ->
12:51:13.968 -> Scanning ...
12:51:17.978 -> No I2C devices found
12:51:17.978 ->
12:51:22.965 -> Scanning ...
12:51:28.511 -> No I2C devices found
12:51:28.511 ->
12:51:33.492 -> Scanning ...
12:51:39.050 -> No I2C devices found
12:51:39.050 ->
12:51:44.083 -> Scanning ...
12:51:46.722 -> I2C device found at address 0x6A !
12:51:46.722 -> I2C device found at address 0x6B !
12:51:47.235 -> done
12:51:47.235 ->
12:51:52.206 -> Scanning ...
12:51:57.786 -> No I2C devices found
12:51:57.786 ->
12:52:02.766 -> Scanning ...
12:52:08.334 -> No I2C devices found
12:52:08.334 ->
12:52:13.316 -> Scanning ...
12:52:16.014 -> I2C device found at address 0x6A !
12:52:16.014 -> I2C device found at address 0x6B !
12:52:16.482 -> done
12:52:16.482 ->
12:52:21.470 -> Scanning ...
12:52:27.052 -> No I2C devices found
12:52:27.052 ->
12:52:32.026 -> Scanning ...
12:52:37.570 -> No I2C devices found
12:52:37.570 ->
12:52:42.602 -> Scanning ...
12:52:48.146 -> No I2C devices found
12:52:48.146 ->
12:52:53.167 -> Scanning ...
12:52:57.122 -> No I2C devices found
12:52:57.122 ->
12:53:02.136 -> Scanning ...
12:53:07.682 -> No I2C devices found
12:53:07.682 ->
12:53:12.664 -> Scanning ...
12:53:18.253 -> No I2C devices found
12:53:18.253 ->
12:53:23.224 -> Scanning ...
12:53:25.878 -> I2C device found at address 0x6A !
12:53:25.878 -> I2C device found at address 0x6B !
12:53:26.344 -> done
12:53:26.344 ->
12:53:31.355 -> Scanning ...
12:53:36.915 -> No I2C devices found
12:53:36.915 ->
12:53:41.937 -> Scanning ...
12:53:47.470 -> No I2C devices found
12:53:47.470 ->
12:53:52.483 -> Scanning ...
12:53:58.057 -> No I2C devices found
12:53:58.057 ->
12:54:03.041 -> Scanning ...
12:54:07.143 -> No I2C devices found
12:54:07.143 ->
12:54:12.128 -> Scanning ...
12:54:17.670 -> No I2C devices found
12:54:17.670 ->
12:54:22.687 -> Scanning ...
12:54:28.229 -> No I2C devices found
12:54:28.229 ->
12:54:33.261 -> Scanning ...
12:54:35.871 -> I2C device found at address 0x6A !
12:54:35.871 -> I2C device found at address 0x6B !
12:54:36.386 -> done
12:54:36.386 ->
12:54:41.357 -> Scanning ...
12:54:46.910 -> No I2C devices found
12:54:46.910 ->
12:54:51.927 -> Scanning ...
12:54:57.468 -> No I2C devices found
12:54:57.468 ->
12:55:02.476 -> Scanning ...
12:55:08.026 -> No I2C devices found
12:55:08.026 ->
12:55:13.067 -> Scanning ...
12:55:17.128 -> No I2C devices found
12:55:17.128 ->
12:55:22.116 -> Scanning ...
12:55:27.707 -> No I2C devices found
12:55:27.707 ->
12:55:32.696 -> Scanning ...
12:55:38.271 -> No I2C devices found
12:55:38.271 ->
12:55:43.258 -> Scanning ...
12:55:45.917 -> I2C device found at address 0x6A !
12:55:45.917 -> I2C device found at address 0x6B !
12:55:46.383 -> done
12:55:46.383 ->
12:55:51.363 -> Scanning ...
12:55:56.920 -> No I2C devices found
12:55:56.920 ->
12:56:01.949 -> Scanning ...
12:56:07.484 -> No I2C devices found
12:56:07.484 ->
12:56:12.473 -> Scanning ...
12:56:15.163 -> I2C device found at address 0x6A !
12:56:15.163 -> I2C device found at address 0x6B !
12:56:15.630 -> done
12:56:15.630 ->
12:56:20.642 -> Scanning ...
12:56:26.192 -> No I2C devices found
12:56:26.192 ->
12:56:31.180 -> Scanning ...
12:56:36.726 -> No I2C devices found
12:56:36.726 ->
12:56:41.737 -> Scanning ...
12:56:47.279 -> No I2C devices found
12:56:47.279 ->
12:56:52.320 -> Scanning ...
12:56:56.283 -> No I2C devices found
12:56:56.283 ->
12:57:01.274 -> Scanning ...
12:57:06.857 -> No I2C devices found
12:57:06.857 ->
12:57:11.842 -> Scanning ...
12:57:17.382 -> No I2C devices found
12:57:17.382 ->
12:57:22.370 -> Scanning ...
12:57:25.024 -> I2C device found at address 0x6A !
12:57:25.024 -> I2C device found at address 0x6B !
12:57:25.535 -> done
12:57:25.535 ->
12:57:30.515 -> Scanning ...
12:57:36.062 -> No I2C devices found
12:57:36.062 ->
12:57:41.081 -> Scanning ...
12:57:46.616 -> No I2C devices found
12:57:46.616 ->
12:57:51.646 -> Scanning ...
12:57:54.297 -> I2C device found at address 0x6A !
12:57:54.297 -> I2C device found at address 0x6B !
12:57:54.762 -> done
12:57:54.762 ->
12:57:59.787 -> Scanning ...
12:58:05.319 -> No I2C devices found
12:58:05.319 ->
12:58:10.302 -> Scanning ...
12:58:15.888 -> No I2C devices found
12:58:15.888 ->
12:58:20.876 -> Scanning ...
12:58:26.421 -> No I2C devices found
12:58:26.421 ->
12:58:31.455 -> Scanning ...
12:58:35.545 -> No I2C devices found
12:58:35.545 ->
12:58:40.520 -> Scanning ...
12:58:46.104 -> No I2C devices found
12:58:46.104 ->
12:58:51.107 -> Scanning ...
12:58:56.655 -> No I2C devices found
12:58:56.655 ->
12:59:01.647 -> Scanning ...
12:59:04.299 -> I2C device found at address 0x6A !
12:59:04.299 -> I2C device found at address 0x6B !
12:59:04.767 -> done
12:59:04.767 ->
12:59:09.765 -> Scanning ...
12:59:15.354 -> No I2C devices found
12:59:15.354 ->
12:59:20.350 -> Scanning ...
12:59:25.870 -> No I2C devices found
12:59:25.870 ->
12:59:30.906 -> Scanning ...
12:59:33.520 -> I2C device found at address 0x6A !
12:59:33.520 -> I2C device found at address 0x6B !
12:59:34.034 -> done

New update for behaviour:
When only MTi-3 on DK connected the scanner detects him every time.
When only MTi-3 on plcc-socket connected with external pull-up resistors after a short time the scanner detects him most of the time in the cycle: detect, 6x no detect, detect 2x no detect
When both connected after a short time the scanner detects them both most of the time in the cycle: detect, 6x no detect, detect 2x no detect

So in conclusion, as long as the MTi-3 on the socket is connected, there is a irregularity in detecting the device(s). But because when both connected, there is also suddenly irregularity for the MTi-3 on the DevKit, it seems to me wiring is defenitely correct and the problem lies within the communication process itself. But i have absoulte no idea why. Because it is now kind of a new problem, i will open a new thread where i will describe this problem.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.