Re: [Zephyr-users] Cannot write with i2c NRF52832 (TWI and TWIM)


vikrant8051 <vikrant8051@...>
 

Hi Rodrigo,
Currently trying to build zephyr/samples/drivers/i2c_fujitsu_fram/ demo eg.
to test i2c for nRF52840_pca10056.

As per your previous email, I added following things in prj.conf

CONFIG_I2C=y
CONFIG_I2C_NRFX=y
CONFIG_I2C_0_NRF_TWI=y
CONFIG_I2C_INIT_PRIORITY=60
CONFIG_I2C_0=y

But still getting following error,

../src/main.c:16:17: error: ‘CONFIG_I2C_0_NAME’ undeclared (first use in this function)
 #define I2C_DEV CONFIG_I2C_0_NAME
                 ^
../src/main.c:84:31: note: in expansion of macro ‘I2C_DEV’
  i2c_dev = device_get_binding(I2C_DEV);
                               ^~~~~~~
../src/main.c:16:17: note: each undeclared identifier is reported only once for each function it appears in
 #define I2C_DEV CONFIG_I2C_0_NAME
                 ^
../src/main.c:84:31: note: in expansion of macro ‘I2C_DEV’
  i2c_dev = device_get_binding(I2C_DEV);
                               ^~~~~~~
[19/141] Building C object zephyr/CMakeFiles/zephyr.dir/lib/mempool/mempool.c.obj
ninja: build stopped: subcommand failed.

Please help me to sort out this issue.

Thank You !!

On Wed, Oct 24, 2018 at 2:01 AM Rodrigo Peixoto <rodrigopex@...> wrote:
Hi,
I am trying to use the i2c on my custom board. I can read data from the devices, but (oddly) I cannot write to any of the 3 devices "attached" to the i2c line. I am using SDA on pin P0.06 and SCL on pin P0.07. Any clue? I have already spent a lot of time trying to fix this and nothing seems to work in this direction. 

Zephyr version: 1.13

i2c configs:
prj file (begin)
...
CONFIG_I2C=y
CONFIG_I2C_NRFX=y
CONFIG_I2C_0_NRF_TWI=y
CONFIG_I2C_INIT_PRIORITY=60
CONFIG_SYS_LOG_I2C_LEVEL=4
CONFIG_I2C_0=y
...
prj file (end)

board.dts (begin)
...
&i2c0 {
status = "ok";
sda-pin = <6>;
scl-pin = <7>;
};
...
board.dts (end)

I am using the commands like: 
error = i2c_burst_read(i2c_dev, ACC_I2C_ADDR, reg, &temp, 1);
error = i2c_burst_read16(i2c_dev, ADE_I2C_ADDR, reg, &buf, 4);

error = i2c_burst_write(i2c_dev, ACC_I2C_ADDR, reg, &setup, 1);
error = i2c_burst_write16(i2c_dev, ADE_I2C_ADDR, reg, &buf, 3);

All the reading commands work and the writing ones do not show an error and seem to make no effect.  


Thank you.
Best regards,
Rodrigo Peixoto
Co-founder and Technical advisor

+55 (82) 98144-8585
http://ayna.tech | Skype: rodrigopex


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