in ~/ncs/zephyr/samples/hello_world/prj.conf
or
in ~/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160ns_defconfig
CONFIG_I2C=y
in my nrf9160dk_nrf9160ns.overlay
/ {
chosen {
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,uart-mcumgr = &uart0;
zephyr,bt-mon-uart = &uart0;
};
};
&uart0 {
current-speed = <115200>;
status = "okay";
tx-pin = <1>;
rx-pin = <0>;
rts-pin = <0xFFFFFFFF>;
cts-pin = <0xFFFFFFFF>;
};
&uart1 {
current-speed = <115200>;
status = "okay";
tx-pin = <26>;
rx-pin = <25>;
rts-pin = <0xFFFFFFFF>;
cts-pin = <0xFFFFFFFF>;
};
&i2c2 {
compatible = "nordic,nrf-twim";
status = "okay";
sda-gpios = < &gpio0 0x0e 0x0 >;
scl-gpios = < &gpio0 0x0f 0x0 >;
clock-frequency = <I2C_BITRATE_STANDARD>;
};
&i2c3 {
compatible = "nordic,nrf-twim";
status = "okay";
sda-gpios = < &gpio0 0x1e 0x0 >;
scl-gpios = < &gpio0 0x1f 0x0 >;
clock-frequency = <I2C_BITRATE_STANDARD>;
};
//////////////////////////////////////
after add
&spi3 {
compatible = "nordic,nrf-spim";
status = "disabled";
sck-pin = <0xFFFFFFFF>;
mosi-pin = <0xFFFFFFFF>;
miso-pin = <0xFFFFFFFF>;
};
project -> configure nrf connect sdk project
check
~/ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160ns/zephyr/.config
#CONFIG_I2C is not set
*CONFIG_I2C set wrong config
////////////////////
and then i delete ~ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160ns/zephyr/.config
project -> configure nrf connect sdk project
check
~/ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160ns/zephyr/.config
CONFIG_I2C=y
*CONFIG_I2C set is correct~