Hi, I'm trying to connect an external I2C device to the nrf9160DK and read some registers. I'm using NCS v1.9.1.
I have my file nrf9160dk_nrf9160_ns.overlay defined like this
&i2c1 { compatible = "nordic,nrf-twim"; status = "okay"; sda-pin = <30>; scl-pin = <31>; clock-frequency = <I2C_BITRATE_STANDARD>; };
To see if the I2C bus is beeing initialize correctly I created my main function as
#define I2C_DEV DT_LABEL(DT_NODELABEL(i2c1)) void main(void) { const struct device *i2c_dev; uint8_t data[16]; int i, ret; struct i2c_msg msg; i2c_dev = device_get_binding(I2C_DEV); if (!i2c_dev) { printk("I2C: Device driver not found.\n"); return; } uint8_t error = 0u; i2c_configure(i2c_dev, I2C_SPEED_SET(I2C_SPEED_STANDARD)); printk("Value of NRF_TWIM1_NS->PSEL.SCL: %ld \n", NRF_TWIM1_NS->PSEL.SCL); printk("Value of NRF_TWIM1_NS->PSEL.SDA: %ld \n", NRF_TWIM1_NS->PSEL.SDA); printk("Value of NRF_TWIM1_NS->FREQUENCY: %ld \n", NRF_TWIM1_NS->FREQUENCY); printk("26738688 -> 100k\n"); }
In the PSEL.SCL and PSEL.SDA prints I should be seeing 31 & 30, is that correct?
What I am actuallly seeing is:
Value of NRF_TWIM1_NS->PSEL.SCL: 14 Value of NRF_TWIM1_NS->PSEL.SDA: 1 Value of NRF_TWIM1_NS->FREQUENCY: 26738688 26738688 -> 100k
Do I need to add other configuration steps?