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

No I2C traffic on P0.08 and P0.09 on nRF91 DK

I have ordered some PCBs which have I2C lines on P0.08 and P0.09 and have been trying to test using the Dev Kit and for some reason, I can't get any traffic out of these pins.

I've tried using P0.18/P0.19 and P0.11/P0.12 with no code changes and it works fine. I see that these P0.08 and P0.09 are connected to switch 1 and 2, I have them switched to NC so I don't think there should be a problem. I also tried editing generated_dts_board_unfixed.h to change the switch pin definitions which didn't make a difference

The lines are always high (Connected to two external pullups).

Below is a slightly modified i2c_scanner example I've used for testing

ncs v1.0.0

/*
 * Copyright (c) 2018 Tavish Naruka <[email protected]>
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <errno.h>
#include <zephyr.h>
#include <misc/printk.h>
#include <device.h>
#include <i2c.h>

#ifdef ARDUINO_I2C_LABEL
#define I2C_DEV ARDUINO_I2C_LABEL
#else
#define I2C_DEV "I2C_2"
#endif

/**
 * @file This app scans I2C bus for any devices present
 */

void main(void)
{
	struct device *i2c_dev;

	printk("Starting i2c scanner...\n");

	i2c_dev = device_get_binding(I2C_DEV);
	if (!i2c_dev) {
		printk("I2C: Device driver not found.\n");
		return;
	}

	for (u8_t i = 4; i <= 0x77; i++) {
		struct i2c_msg msgs[1];
		u8_t dst;

		/* Send the address to read from */
		msgs[0].buf = &dst;
		msgs[0].len = 0U;
		msgs[0].flags = I2C_MSG_WRITE | I2C_MSG_STOP;

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

nrf9160_pca10090ns.overlay

&i2c2 {
    status = "ok";
    sda-pin = <9>;
    scl-pin = <8>;
    clock-frequency = <400000>; 
};

&uart0 {
current-speed = <115200>;
status = "ok";
tx-pin = <14>;
rx-pin = <13>;
cts-pin = <26>;
rts-pin= <27>;
};

prf.conf

CONFIG_PRINTK=y
CONFIG_I2C=y

Related