# I2C2 stops working when plugging in any serial device in GPS2 in Cubepilot Cube Orange

**URL:** <https://discuss.cubepilot.org/t/i2c2-stops-working-when-plugging-in-any-serial-device-in-gps2-in-cubepilot-cube-orange/12259>\
**Category:** Cube Autopilot\
**Created:** [23 November 2023 09:21 UTC](https://discuss.cubepilot.org/t/i2c2-stops-working-when-plugging-in-any-serial-device-in-gps2-in-cubepilot-cube-orange/12259 "2023-11-23T09:21:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![agreiner](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/agreiner/32/7274_2.png) [@agreiner](https://discuss.cubepilot.org/u/agreiner)\
**Post date:** [23 November 2023 09:21 UTC](https://discuss.cubepilot.org/t/i2c2-stops-working-when-plugging-in-any-serial-device-in-gps2-in-cubepilot-cube-orange/12259/1 "2023-11-23T09:21:55Z")

</div>

Hello,

I have a Cube Orange with PX4-Autopilot firmware (tested 1.13.3 and 1.14). I am trying to connect a Lightware SF11 rangefinder using the I2C2 port.  
This works fine and the data can be viewed e.g. in QGroundControl. However, as soon as I plug in **anything** into the GPS2 port like a telemetry or GPS device, even the included buzzer, the I2C communication stops working and only reports erros from then on out.

```auto
nsh> lightware_laser_i2c status
INFO [SPI_I2C] Running on I2C Bus 2, Address 0x66
lightware_laser_i2c: read: 32215 events, 9600150us elapsed, 298.00us avg, min 101us max 1909us 16.778us rms
lightware_laser_i2c: com err: 662 events

```

Also, this is the output before and after plugging in the serial device, it seems that the I2C device isn’t even detected anymore:

Before:

```auto
nsh> i2cdetect -b 2
Scanning I2C bus: 2
     0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- 66 -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

```

After:

```auto
nsh> i2cdetect -b 2
Scanning I2C bus: 2
     0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

```

Further findings:

- When I plug in the serial device, in this case SimpleRTK3B, into the TELEM1 port, everything works fine
- When I plug it in the TELEM2 port, the I2C communication stops shortly but the resumes to work
- Using the I2C port in the GPS1 port also works fine and no errors occur when the serial device is plugged into the GPS2 port

Sadly, I can’t use the GPS1 port’s I2C connection because all the serial ports are already occupied (2x telemetry, 1x microRTPS bridge to companion computer, 1x GPS).

I would greaty appreciate any ideas on how to fix or even debug this problem further. If you have any suggestions please let me know, thanks in advance.

Greetings,  
Andy

Attachments:

**QGroundcontrol recording 1** : Rangefinder plugged in and works, then serial device gets connected to GPS2 and only error occur from that point onwards  
 ![px4_default_then_plug_gps2](https://discuss.cubepilot.org/uploads/default/original/2X/b/b778486159d6c182c2ca49d751e02b017e595d00.gif)  
**QGroundcontrol recording 2** : Rangefinder plugged in and works, at **Count: 837** serial device gets plugged into GPS2 =\> so more messages, then it gets unplugged again and at **Count: 866** it gets plugged into TELEM2 =\> it hangs shorty, then we gat a faulty message with **current\_distance: 13000** and the the rangefinder resumes to work correctly  
 ![screen-capture](https://discuss.cubepilot.org/uploads/default/original/2X/d/de84ff4307f32eded50e97205a737df041e96ae4.gif)

---

<div class="post-metadata">

**Author:** ![madhuareti](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/madhuareti/32/8349_2.png) [@madhuareti](https://discuss.cubepilot.org/u/madhuareti)\
**Post date:** [14 October 2024 14:30 UTC](https://discuss.cubepilot.org/t/i2c2-stops-working-when-plugging-in-any-serial-device-in-gps2-in-cubepilot-cube-orange/12259/2 "2024-10-14T14:30:35Z")

</div>

Hello,

I am running into a similar issue, were you able to figure a solution for this? I was able to fix it by disconnecting the SCL and SDA cables on the connector plugging into GPS2

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/julianoes/32/6591_2.png) [@JulianOes](https://discuss.cubepilot.org/u/JulianOes)\
**Post date:** [16 October 2024 19:38 UTC](https://discuss.cubepilot.org/t/i2c2-stops-working-when-plugging-in-any-serial-device-in-gps2-in-cubepilot-cube-orange/12259/3 "2024-10-16T19:38:19Z")

</div>

I’m looking into this. @madhuareti what GPS are you connecting to GPS2? Just so I can try to reproduce it correctly.

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/julianoes/32/6591_2.png) [@JulianOes](https://discuss.cubepilot.org/u/JulianOes)\
**Post date:** [16 October 2024 20:21 UTC](https://discuss.cubepilot.org/t/i2c2-stops-working-when-plugging-in-any-serial-device-in-gps2-in-cubepilot-cube-orange/12259/4 "2024-10-16T20:21:28Z")

</div>

Ok, I think I understand what is going on here.

If we look at the connector pinout of GPS2 (see [docs](https://docs.cubepilot.org/user-guides/autopilot/the-cube-module-overview#the-cube-series-interface-specification)), we see that I2C 2 bus is not only brought out in the I2C connector but also in the GPS 2 connector in pin 4 and 5.

 ![image](https://discuss.cubepilot.org/uploads/default/original/2X/0/0ba03924c6a7227ead28dd1b9a6da89fed8837e1.png)

In the case of @agreiner and @madhuareti what happens is that the device plugged in is interfering with these two I2C bus lines:

- Telemetry: this has port 4 and 5 used as flow control (CTS, RTS), so that is definitely going to interfere.
- Included buzzer: I’m not sure on that one, I’d have to know what is connected there, but if the buzzer uses pin 4 and 5 that would be problematic and not work.
- GPS device: this one should work if the GPS has the pinout mentioned above. If it has something else connected on pin 4 and 5, that will again interfere.

* * *

I have tested this on my bench with an airspeed sensor connected to the I2C port and a GPS with external mag connected to the GPS 2 port. Both, the airspeed sensor and the external mag, work as expected. They both show up on I2C 2. This tells me the pinout is correct and should be working as expected.

```auto
nsh> i2cdetect -b 2
Scanning I2C bus: 2
     0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- 1e --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 -- -- -- -- -- -- -- -- --

```

---

<div class="post-metadata">

**Author:** ![madhuareti](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/madhuareti/32/8349_2.png) [@madhuareti](https://discuss.cubepilot.org/u/madhuareti)\
**Post date:** [17 October 2024 18:43 UTC](https://discuss.cubepilot.org/t/i2c2-stops-working-when-plugging-in-any-serial-device-in-gps2-in-cubepilot-cube-orange/12259/5 "2024-10-17T18:43:54Z")

</div>

I have a Holybro telemetry module connected in that port. So, my issue was fixed by changing the connector itself.
