This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SDK 1.6.1 nRF52832 I2C on pin 0.6 an 0.7

Hello,

I am using the pine watch hardware, to do some tests,

I configured through the overlay file, the I2C_1 to use pins 0.6, 0.7 as shown below,

&i2c1 {
 compatible = "nordic,nrf-twi";
 status = "okay";
 label="I2C_1"; 
 sda-pin = <6> ;
 scl-pin = <7>;
};

but on the oscilloscope I only see the data, the clock is absent.

How do I configure I2C_0 or I2C_1 to work correctly with these pins? Thanks

Parents
  • Hello,

    what kind of hardware are you testing this on? Is it a DK or custom board?

  • HI whit DK I see only the data, in custom board (pine watch hardware)  the following code, not found any device, in the bus

    i2c_dev = device_get_binding("I2C_0");
    if (!i2c_dev) {
    printk("Binding failed\n");
    return;
    }
    // RTC_Start();
    i2c_configure(i2c_dev, I2C_SPEED_SET(I2C_SPEED_STANDARD) | I2C_MODE_MASTER);

    printk("The I2C scanner started\n");
    for (uint8_t i = 4; i <= 0x7F; i++) {
    struct i2c_msg msgs[1];
    uint8_t dst = 1;

    msgs[0].buf = &dst;
    msgs[0].len = 1U;
    msgs[0].flags = I2C_MSG_WRITE | I2C_MSG_STOP;

    error = i2c_transfer(i2c_dev, &msgs[0], 1, i);
    // i2c_transfer();
    if (error == 0) {
    printk("\n0x%2x FOUND\n", i);
    }
    else {
    printk("error %d \n", error);
    }

    }
    printk("\nEND Scan I2C");

    in prj.conf

    # Setting for I2C
    CONFIG_I2C=y
    CONFIG_I2C_0=y

    in the overlay file

    &i2c0 {
    compatible = "nordic,nrf-twim";
    status = "okay";
    sda-pin = <6>;
    scl-pin = <7>;
    clock-frequency = <I2C_BITRATE_STANDARD>;
    };

    Thanks 

  • I think you will need to use some other pins than 6 and 7 for SDA and SCL. These pins are already being used according to documentation;

    P0.05, P0.06, P0.07, and P0.08 are by default used by the UART connected to the interface MCU.

Reply Children
No Data
Related