TWI/I2C no communication with Sensor Devices

Hello,

my first Post here, so i hope i do it correctly.

I have the following Problem with the Configuration and Communication over TWI/I2C.

The Voltage of the TWI/I2C Bus is not 3.3V.

Reference Mesurment with a RPI and ESP32 for the same Sensor Hardware. I can say it's not a hardware fault.


I use as Hardwarebase the nRF52833-DK.

As Development runtime Zephyr with the nRF connect SDK V2.0.0 in Visual Studio Code.

As Test-Project to find the Problem, i use the follwing Code and Settings:

The used Overlay for I2C

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
&i2c0 {
compatible = "nordic,nrf-twim";
status = "okay";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
clock-frequency = <100000>;
/*adxl372@53 {
compatible = "adi,adxl372";
reg = <0x53>;
int1-gpios = <&gpio0 54 GPIO_ACTIVE_HIGH>;
label = "ADXL372";
};*/
/*pca9536@41 {
compatible = "ti,pca9536";
reg = <0x41>;
label = "PCA9536";
};
gyro_adc@40 {
compatible = "i2c-device";
reg = < 0x40 >;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

and run it with this Project Configuration

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_NEWLIB_LIBC=y
CONFIG_CPLUSPLUS=y
CONFIG_STD_CPP17=y
CONFIG_LIB_CPLUSPLUS=y
#CONFIG_RTTI=y
CONFIG_THREAD_ANALYZER=y
CONFIG_DEBUG=y
CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=2048
CONFIG_I2C=y
CONFIG_I2C_NRFX=y
CONFIG_I2C_GPIO=y
CONFIG_NRFX_TWI0=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Source-Code (main.cpp):

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
* Copyright (c) 2015 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <sys/printk.h>
#include <device.h>
#include <devicetree.h>
#include <drivers/gpio.h>
#include <drivers/i2c.h>
#define FRAM_I2C_ADDR 41
#define MY_TWIM DT_NODELABEL(i2c0)
void main(void)
{
const struct device *i2c_dev = DEVICE_DT_GET(DT_NODELABEL(i2c0));
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

NRF-Terminal Output:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Connected via Serial Port with settings COM3 115200 8n1 rtscts:off
*** Booting Zephyr OS build v3.0.99-ncs1 ***
I2C: is ready.
Configure Done
read fault
*** Booting Zephyr OS build v3.0.99-ncs1 ***
I2C: is ready.
Configure Done
read fault
[00:00:09.736,724] <err> i2c_nrfx_twim: Error 0x0BAE0001 occurred for message 0
[00:00:09.736,938] <err> i2c_nrfx_twim: Error 0x0BAE0001 occurred for message 0
[00:00:09.737,121] <err> i2c_nrfx_twim: Error 0x0BAE0001 occurred for message 0
[00:00:09.737,304] <err> i2c_nrfx_twim: Error 0x0BAE0001 occurred for message 0
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


The Project-Copy:

I2C-Test.zip

Thanks for Help

  • Can you show the schematic please? How is the various I2C devices connected and what are the power supply voltages?

  • Schematic:

    PSU_0404_A.pdf

    Used Powersources:

    Batterie 3,7V over Linear-Controller to 3.3 V

    USB-BUS 5,0V over Linear-Controller to 3.3 V

    parasitic voltage over I2C and Pullup's 3V

    I know the capaity at the UB3.3V is to small, an modefied capacity is testet too and the result is the same.

  • Hello,

    Ketil asked if I could have a look at this ticket. 

    Can you please test the attached application:

    It is configured to use the nRF52833 DK and scan through all I2C addresses. So it is not aware of any particular I2C devices/addresses. Only a basic I2C configuration.

    It should print a lot of errors, but if one or more devices are connected via I2C on the pins (SDA pin P0.03 and SCL pin P0.04), then one of the lines should be an <inf> instead of <err>, and it should say FOUND DEVICE at the end of the line:

    If you can run this test, we can find out whether it is a SW or a HW issue.

    Best regards,

    Edvin

  • Forgot to actually attach the application:

    3757.i2c_scanner.zip

    BR,
    Edvin

  • Hello,

    i run the test and a crosscheck that the I2C-Device is still okey.

    The Log from the i2c-scan program:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    Connected via Serial Port with settings COM3 115200 8n1 rtscts:off
    *** Booting Zephyr OS build v3.0.99-ncs1 ***
    *** Booting Zephyr OS build v3.0.99-ncs1 ***
    *** Booting Zephyr OS build v3.0.99-ncs1 ***
    *** Booting Zephyr OS build v3.0.99-ncs1 ***
    *** Booting Zephyr OS build v3.0.99-ncs1 ***
    [00:00:28.661,743] <inf> app: Hello World! nrf52833dk_nrf52833
    [00:00:34.147,644] <err> app: err 0bae0001, addr 00
    [00:00:34.968,170] <err> app: err 0bae0001, addr 01
    [00:00:35.329,162] <err> app: err 0bae0001, addr 02
    [00:00:35.579,132] <err> app: err 0bae0001, addr 03
    [00:00:39.363,128] <err> app: err 0bae0001, addr 04
    [00:00:39.373,229] <err> app: err 0bae0001, addr 05
    [00:00:39.383,361] <err> app: err 0bae0001, addr 06
    [00:00:39.393,493] <err> app: err 0bae0001, addr 07
    [00:00:39.403,625] <err> app: err 0bae0001, addr 08
    [00:00:39.413,757] <err> app: err 0bae0001, addr 09
    [00:00:39.423,889] <err> app: err 0bae0001, addr 0a
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    The conection for this test with external Power over 5V by RPI GPIO (PIN2), GND (Pin 6). SCL and SDA conected like our definition

    Crosscheck with rpi:

    SDA and SCL Connectet on RPI GPIO PIN3,5.

    Best regards,

    Björn

1 2 3