I2C on UP2 doesn't work as expected. Fails if using more than one sensor.

I'm trying to hook up 2 i2c sensors to my UP2. HTU21D and MPU6050, both running at 3.3 V. When there's just a single sensor on the bus it works fine. The moment I connect another sensor to the bus, the i2c bus fails. When that happens (usually instantly or in a matter of seconds), the script crashes with the following report:

Traceback (most recent call last): File "main.py", line 161, in <module> main() File "main.py", line 138, in main htu21d_status = htu21d.measure() File "#censored#", line 164, in measure self.htu.sampleData() File "/usr/local/lib/python3.8/dist-packages/upm/pyupm_htu21d.py", line 136, in sampleData return _pyupm_htu21d.HTU21D_sampleData(self) ValueError: UPM Invalid Argument: Unknown error in I2c::readReg()

Also when I check the "dmesg" kernel output, these messages come out:

i2c_designware i2c_designware.1: i2c_dw_handle_tx_abort: lost arbitration
i2c_designware i2c_designware.1: controller timed out

Another important fact is, that when this error occurs, the SDA line is stuck at roughly 0.15-0.20 V. SDA voltage doesn't go back up to 3.3 V when the bus is idle. The only way to make it go back to 3.3 V is to reconnect everything all over again (and of course use only one sensor).
I'm not using external pull-up resistors on the bus, because these modules have already inbuilt pull-ups.


I'm using MRAA/UPM library in Python. OS is Ubuntu 20.04.2 LTS. I installed the latest kernel (5.4.0-1-generic #0~upboard2-Ubuntu). I'm also on the newest BIOS (UPA1AM52). And of course as I mentioned already, I'm using the UP2 board.
Sensors are running at 3.3 V. I'm using I2C pins 3, 5. I2C speed is set to "standard" in the BIOS, so it's the slowest 100 kHz option.


I tried the exact same sensors (with all the same wiring and breadboard) on Arduino and it all worked flawlessly, so the problem will probably be somewhere in UP2.
I also tried to upgrade the BIOS from UPA1AM22 to the newest one. Unfortunately nothing changed.
I'm pretty confident that my code is fine. I'm also sceptical that there's some bug in the MRAA/UPM library that I'm using.

Any help is greatly appreciated. If I forgot to share any important info, I'll provide whatever is needed.

Thank you!


  • DCleri
    DCleri Administrator, AAEON Posts: 1,175 admin

    I assume you are powering the sensors via the VIN pin connected to the 3.3V on the board?
    Are you using only one of the 3.3V pin or 2 separate ones to power the 2 sensors? If not please try this.

  • MeneT3k3l
    MeneT3k3l New Member Posts: 2

    @DCleri said:
    I assume you are powering the sensors via the VIN pin connected to the 3.3V on the board?
    Are you using only one of the 3.3V pin or 2 separate ones to power the 2 sensors? If not please try this.

    I'm doing exactly that. I'm using one 3.3 V pin to power both of those sensors. MPU6050 draws 10 mA tops and HTU21D is really power efficient and it draws 500 uA max (only during a measurement).

    I tried powering MPU6050 with a separate 3.3 V pin. The behaviour was like this:
    HTU21D was working fine, I was getting good readings, no crashes. Then I connected the MPU6050 which was powered by the separate 3.3 V pin. After a few seconds, script crashed and I got the same errors that I described earlier, including the ones from kernel.

    To me this doesn't look like a power issue.

    By the way, do you happen to know the max current that can be provided by a single 3.3 V (or 5 V) pin from UP2? Thanks.

  • DCleri
    DCleri Administrator, AAEON Posts: 1,175 admin

    Thanks for the additional information provided, we don't have the parts at hand but we see how to investigate it further and come back to you.

    For the power pins they can provide max 0.5A each.

  • niharG
    niharG New Member Posts: 7

    I am seeing the same "lost arbitration" error which seems to originate from the kernel driver when running with two I2C peripherals on a single bus (running 5.0 kernel). It is intermittent but usually reproduces within 20 minutes of booting up (my use case is reading/writing at 5ms intervals). A similar issue was reported here: https://forum.up-community.org/discussion/comment/11756

    Is there any path forward to fixing this kenrel driver?

  • DCleri
    DCleri Administrator, AAEON Posts: 1,175 admin

    being on the I2C designware kernel driver, the best way is to report the bug to the respective maintainers: https://www.kernel.org/doc/html/v4.15/admin-guide/reporting-bugs.html

  • niharG
    niharG New Member Posts: 7

    Thanks, with some more testing my issue appears to be caused by one of the I2C slave devices, rather than an issue in the kernel.

Sign In or Register to comment.