Hello,
I want to control a CODEC via I2C.
I implemented the software following the DevAcademy below.
I2C Driver – Nordic Developer Academy (nordicsemi.com)
But I get the following build error:
C:\ncs\v2.3.0\zephyr\include\zephyr\device.h:83:41: error: '__device_dts_ord_134' undeclared here (not in a function); did you mean '__device_dts_ord_13'?
I implemented the source code as follows.
1) prj.conf
CONFIG_I2C=y
2) nrf5340dk_nrf5340_cpuapp.overlay
&i2c2 { mycodec: mycodec@1a{ compatible = "i2c-device"; reg = < 0x1a >; label = "MYCODEC"; status = "okay"; sda-pin = < 0x23 >; scl-pin = < 0x22 >; }; };
3) main.c
#include <zephyr/drivers/i2c.h> #define I2C2_NODE DT_NODELABEL(mycodec) static const struct i2c_dt_spec dev_i2c = I2C_DT_SPEC_GET(I2C2_NODE); void main(void) { if (!device_is_ready(dev_i2c.bus)) { printk("I2C bus %s is not ready!\n\r",dev_i2c.bus->name); } while(1); }
How do I resolve this build error?
Hardware: nRF5340 (custom board)
Software: NCS v2.3.0
IDE: VS Code v1.77.1
Regards,
Gotoda