Re: I2C running on NRF52840


Andrzej G??bek
 

Hi Diana,

 

The config you provided is fine and you don’t need any other modifications to build the i2c_fujitsu_fram sample for the nrf52840_pca10056 board. You haven’t specified on which commit from the Zephyr repository you based your work on, so I tried with commit f58d9ca (i.e. release 1.12.0), and the sample built fine. I modified only the “prj.conf” file in this sample and used exactly the settings that you specified.

Can you try the same and see if it works for you?

 

Best regards,

Andrzej

 

From: Cufi, Carles
Sent: Friday, July 13, 2018 6:36 PM
To: Diana Rivera <drv3007@...>; users@...; Głąbek, Andrzej <Andrzej.Glabek@...>
Subject: RE: [Zephyr-users] I2C running on NRF52840

 

+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.