How to connect other sensor to nrf9160 (i2c and GPIO)

Hi, 

I want to connect LDC2114 to nRF9160. I write the nrf9160dk_nrf9160_ns.overlay and the astri,ldc2114.yaml. I don't know how to set GPIOs in &i2c1 - ldc2114: ldc2114@2a which are the output pins of LDC2114 and input pins of nRF9160.

/ {
	/* Map the devices to the aliases of the application. */ 
	aliases {	
		ldc-sensor = &ldc2114;
	};
	
};

&i2c1 {
    compatible = "nordic,nrf-twim";
    #address-cells = < 0x1 >;
    #size-cells = < 0x0 >;
    reg = < 0x9000 0x1000 >;
    // clock-frequency = < 0x186a0 >;
    clock-frequency = <I2C_BITRATE_STANDARD>;
    interrupts = < 0x9 0x1 >;
    status = "okay";
    pinctrl-0 = < &i2c1_default >;
    pinctrl-1 = < &i2c1_sleep >;
    pinctrl-names = "default", "sleep";
    ldc2114: ldc2114@2a{
        compatible = "astri,ldc2114";   //binding
        status = "okay";
        reg = < 0x2a >;
        label = "LDC2114";
        gpio-controller;
        #gpio-cells = < 0x2 >;
        intb-gpios = < &gpio0 25 0 >; // LDC2114 INTB pin -> nrf9160 INPUT P0.25
        in0-gpios = < &gpio0 24 0 >;  // LDC2114 OUT0 pin -> nrf9160 INPUT P0.24
        in1-gpios = < &gpio0 23 0 >;  // LDC2114 OUT1 pin -> nrf9160 INPUT P0.23
        in2-gpios = < &gpio0 22 0 >;  // LDC2114 OUT2 pin -> nrf9160 INPUT P0.22
        in3-gpios = < &gpio0 21 0 >;  // LDC2114 OUT3 pin -> nrf9160 INPUT P0.21
    };
};

&i2c2 { 
	status = "disabled";
};

&pinctrl {
	i2c1_default: i2c1_default {
		group1 {
			psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
				    <NRF_PSEL(TWIM_SCL, 0, 31)>;
		};
	};

	i2c1_sleep: i2c1_sleep {
		group1 {
			psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
				    <NRF_PSEL(TWIM_SCL, 0, 31)>;
			low-power-enable;
		};
	};
};

# Copyright (c) 2018, Peter Bigot Consulting, LLC
# SPDX-License-Identifier: Apache-2.0

description: Sensor LDC2114

compatible: "astri,ldc2114"

include: [sensor-device.yaml, i2c-device.yaml, gpio-controller.yaml, base.yaml]

properties:
  reg:
    required: true

  #alert-gpios:

  "#gpio-cells":
    const: 2

  intb-gpios:
    type: phandle-array
    description: |
      LDC2114 INTB pin -> nrf9160 INPUT P0.25

  in0-gpios:
    type: phandle-array
    description: |
      LDC2114 OUT0 pin -> nrf9160 INPUT P0.24

  in1-gpios:
    type: phandle-array
    description: |
      LDC2114 OUT1 pin -> nrf9160 INPUT P0.23

  in2-gpios:
    type: phandle-array
    description: |
      LDC2114 OUT2 pin -> nrf9160 INPUT P0.22

  in3-gpios:
    type: phandle-array
    description: |
      LDC2114 OUT3 pin -> nrf9160 INPUT P0.21

gpio-cells:
  - pin
  - flags

Also, What else should I do in order to connect the devices?

Best regards,

Liza

Parents Reply Children
Related