- Need help on I2C burst write APIs
Re: Need help on I2C burst write APIs
toggle quoted messageShow quoted text
From: users@... <users@...>
On Behalf Of dhguja@...
Sent: 14 June 2018 18:22
Subject: [Zephyr-users] Need help on I2C burst write APIs
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.buf = &start_addr;
msg.len = 1;
msg.flags = I2C_MSG_WRITE;
msg.buf = buf;
msg.len = num_bytes;
msg.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.
Dhananjay G J
Join firstname.lastname@example.org to automatically receive all group messages.