Enabling i2c on nucleo_f429zi

David Demelier <markand@...>

Hi there,

Quite new to zephyr and still reading its documentation actively. I've
been able to successfully generate, debug and use GPIO based
applications (following the very well documented blinky and other

Now I'd like to use an i2c device (temperature sensors) that I was able
to successfully use under a standard Linux distribution for testing.
I'm still having lots of confusion regarding the devicetree APIs and
general use of it.

First of all, I've enabled i2c by adding this to my prj.conf:


Then I've followed an example in the tree

#if DT_NODE_HAS_STATUS(DT_ALIAS(i2c_0), okay)
#define I2C_DEV_NAME DT_LABEL(DT_ALIAS(i2c_0))
#elif DT_NODE_HAS_STATUS(DT_ALIAS(i2c_1), okay)
#define I2C_DEV_NAME DT_LABEL(DT_ALIAS(i2c_1))
#elif DT_NODE_HAS_STATUS(DT_ALIAS(i2c_2), okay)
#define I2C_DEV_NAME DT_LABEL(DT_ALIAS(i2c_2))
#error "Please set the correct I2C device"

But to my understanding, to work you need to have i2c_0 in the
devicetree for my board because I reach the `#error` line at compile
time. And accordingly its the devicetree contains an i2c1 node but not
in the root node and I'm still figuring out what does that mean.


&i2c1 {
pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
pinctrl-names = "default";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;

Any help and additional documentation I should read are welcome.



Join users@lists.zephyrproject.org to automatically receive all group messages.