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

and run it with this Project Configuration

Source-Code (main.cpp):

NRF-Terminal Output:


The Project-Copy:

I2C-Test.zip

Thanks for Help

Parents
  • 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 Björn,

    So when you are able to write to the device on addr. 0x41, does the voltage look correct on the oscilloscope?

    BR,
    Edvin

  • Hallo Edvin,

    now i get the oscilloscope measurment and now the voltages looks good.

    Programcode write:

    osciloscope

    programcode read:

    osciloscope

    The Read Value of the register 3 of the PCA9536, that is used for write/read, has the value: 255 (0xFF, 0xb1111 1111). This is correct or a not configured PCA9536.

    I have a still question, what is the reason that the manual configured twim work and the automated configuration over the I2C-API don't work.

  • Hello,

    I am not sure exactly why it doesn't work, but it suggests that there are some issues in the configuration that you were using. 

    In your snippets from your original post:

    I see that you are setting the addresses and labels, but what does "i2c-device" refer to? It is not something that is part of NCS by default, I think. Something that may cause the voltage to drop like that is if the devices are configured with wrong pull resistors. Did you set pull-down somewhere in the "i2C-device" settings?

    BR,

    Edvin

  • Hello Edvin,

    The compatile "i2c-device" is a generic-description this is usesd in every I2C-Driver, in the most cases at the second or third layer of the driver.

    I can't see any option in the pin-control section of the Overlay-file for I2C to set the resistors. at the UART i see the option to pull up the PIN (Section copy from the sample Project):

    Best regards Björn

  • Hello Björn,

    Sorry for not being able to pin point exactly what is causing the voltage drop right away, but I see that most cases where the NCS SDK (including Zephyr) uses:

    it actually says:

    It is at least worth a shot. 

    So the measurements with the voltage drop, is that done with a DK or a custom board?

    What happens if you detach whatever is connected to the I2C bus. What voltage does the pin have then?

    Is there some way for me to reproduce what you are seeing on a DK without any external HW?

    BR,
    Edvin

Reply
  • Hello Björn,

    Sorry for not being able to pin point exactly what is causing the voltage drop right away, but I see that most cases where the NCS SDK (including Zephyr) uses:

    it actually says:

    It is at least worth a shot. 

    So the measurements with the voltage drop, is that done with a DK or a custom board?

    What happens if you detach whatever is connected to the I2C bus. What voltage does the pin have then?

    Is there some way for me to reproduce what you are seeing on a DK without any external HW?

    BR,
    Edvin

Children
  • Hello Edvin,

    all measurments are currently done with a DK Board, the custom Boards are in production.

    To the Driver compatible, i check the yaml-Drivers Files and see it in the first version. Only at specific Drivers the vnd shows the shortname of the producer. For a Basic-Driver-Componentlike I2C, i don't found anything in the "vnd, driver" notaition.

    I will tomorrow check the DK Board with out a device.

    Best Regards,

    Björn

  • Hallo Edvin,

    i have check the DK-Board, without any external Device and have the same Problem, but the Project-Partner has checed in this Time the differences between Zephyr-I2C-API and Nordic-TWIM-API. The Zephyr-API disable at the end of a transmission the TWI-Interface.This Produce by undefined Powerlevel of the Interface-Pins the Undefined Voltage-Level.

    So we test the DTS - PINCTL - Parameter "bias-pull-up" to solve the undefined Powerlevel for the Interface.

    Afterthis we can now find all Device at the Bus.The I2C-Devices at the Bus are, so it looks for me, Bus-Power sensitive. They need a defined Bus-Volatage-Level to work correctly.

    Best Regards

    Björn