Re: I2C running on NRF52840


Carles Cufi
 

+Andrzej

 

From: users@... <users@...> On Behalf Of Diana Rivera
Sent: 13 July 2018 15:26
To: users@...
Subject: [Zephyr-users] I2C running on NRF52840

 

Hello everyone!

I am currently working on trying to use I2C to read some Grove sensors using the NRF52840 Preview Development Kit. I'm planning on writing an application based on Zephyr's sample code i2c_fujitsu_fram, as instructed in some other replies I've seen.
I have created a prj.conf file which includes the following:

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y

CONFIG_I2C=y
CONFIG_I2C_NRF5=y
CONFIG_I2C_0=y
CONFIG_I2C_NRF5_0_GPIO_SDA_PIN=26
CONFIG_I2C_NRF5_0_GPIO_SCL_PIN=27
CONFIG_I2C_0_IRQ_PRI=7

However, when I try to compile the code, I get the error:

In function ‘main’:
/home/diana/zephyr/apps/i2c_fujitsu_fram/src/main.c:85:31: error: ‘I2C_DEV’ undeclared (first use in this function)
  i2c_dev = device_get_binding(I2C_DEV);

I've seen this question from someone who seems to have the same problem. But there was no clear solution to the problem.
https://lists.zephyrproject.org/g/users/topic/16761518#677

And I've also tried solving the problem by following the advice in this post:
https://lists.zephyrproject.org/g/users/topic/16761401#364

And replacing:
#define I2C_DEV CONFIG_I2C_0_NAME

By:
#define I2C_DEV CONFIG_GPIO_NRF5_P0_DEV_NAME

Which doesn't make much sense to me, but in any case I get the error shown in the screen shot attached.

Could someone point out what I'm doing wrong, or guide me on the right direction to get I2C running on the NRF52840 board, please?

I've already gone through this post as well, and still can't figure out my problem:
https://lists.zephyrproject.org/g/users/topic/16761404#378

Thank you in advance for your help,
Diana

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