Need help on I2C burst write APIs


dhguja@gmail.com
 

Hello,
       I am using Zephyr 1.11 version and nRF52840 dev kit. I am trying to use I2C driver to communicate with a I2C device. 

My scenario is as below,

1) When i try to use i2c_burst_write API to send more than 1 byte, data is not issued to device after first byte.

2) i2c_burst_read API is working as expected. 

3) I went through the API definition code and found that burst write is split into two separate I2C transactions.

msg[0].buf = &start_addr;
msg[0].len = 1;
msg[0].flags = I2C_MSG_WRITE;

msg[1].buf = buf;
msg[1].len = num_bytes;
msg[1].flags = I2C_MSG_WRITE | I2C_MSG_STOP;

This separates the I2C interactions as 2 Tx msgs during burst write and data is not written beyond 1 byte.

I have attached the expected I2C burst write mode from my slave device data sheet. But when i analysed transactions using logic analyzer i saw transactions split into two I2C writes.

4) I also noticed that i2c_reg_read_byte uses i2c_burst_read underneath with 1 byte. But i2c_reg_write_byte uses i2c_write with combined address and data buffer. 

Not sure whether this behavior is expected or someone noticed this?

I can also use i2c_write directly to write more than 1 bytes with my device. But just curious if i am missing something while using those burst mode APIs.

Regards,
Dhananjay G J


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