i2c_burst_write API


Erwan Gouriou
 

Hi all,


I'm having trouble using i2c_burst_write to configure several registers
in one shot in a sensor (using i2c_stm32lx.c driver).

According to API description, it seems to be the adequate use:
" This routine writes multiple bytes to an internal address of an
I2C device synchronously."

Following implementation, it generates 2 messages as follow:
Slave ADdress|Write * SUB-Address (register of the sensor where I'd like to start writing)
Slave ADdress|Write * DATA
It doesn't work for me since sensor is expecting one single message:
SAD|W * SUB * ADD

I've found several examples of sensor supporting the later but not the former.
Though, in Zephyr code, I've found some uses of i2c_burst_write API,
hence I tend to think it should work somehow in some cases.

Hence my questions to you:

Are there actually several ways to address an I2C slave for burst write?
> If yes, I'll just avoid using this API. But it might be worse specifying that
it might not fit all slaves implementations.

Is that due to underlying I2C drivers that do some messages concatenation
magic before sending to slave devices?
> If yes, maybe this is a sign API should be adapted to be more transparent

Any other possibility that I don't have in mind right now?


Thanks
Erwan



 






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