Subject: Re: I2C transactions & STOP condition
To: Tobias Nygren <tnn@NetBSD.org>
From: Nicolas Joly <njoly@pasteur.fr>
List: tech-kern
Date: 07/23/2007 00:34:28
On Sun, Jul 22, 2007 at 11:57:04PM +0200, Tobias Nygren wrote:
> On Sun, 22 Jul 2007 23:31:39 +0200
> Nicolas Joly <njoly@pasteur.fr> wrote:
> >
> > Hi,
> >
> > I recently had a look on i2c devices code, and notices that some devices
> transactions does not ends with a STOP conditions.
> >
> > By example, the adt7463 code should use I2C_OP_{READ,WRITE}_WITH_STOP
> instead of I2C_OP_{READ,WRITE} for adt7463c_receive_1(),
> > adt7463c_send_1() and adt7463c_write_1() functions.
> > If i understand the i2c specifications correctly, all transferts begin
> with a START condition, and terminates with a STOP condition; in
> between, the i2c bus remains busy.
> 
> It is technically allowed to perform multiple consecutive transfers
> without sending a STOP condition, using a technique called "repeated
> start". This works fine as long as there is only one bus master present.

I was aware of that ;-) Only the last one need the STOP condition.

But the adt7463 code only issue a single tranfert in each function,
then the START and STOP conditions are in the same operation.

> > Do the attached patch looks correct ?
> 
> IMO, yes. The code calls iic_release_bus(), and before this the stop
> condition needs to be sent. (b/c none of our i2c controller drivers seem
> to automatically send a stop on release.)

Thanks.

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.