Re: ack/nack in write operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 14 Jul 2011 17:52:25 +0200, Michele Da Rold wrote:
> Hello everybody,
> I'm new to i2c development some don't kill me if my questions are stupid!!
> 
> I'm using bitbanging i2c driver for an AT91 devices,
> the AT91 is master and I have a slave that reply, during a write, with a 
> NAK after last byte.
> The i2c specification permit this solution but i2c linux driver no.

Can you please quote the part of the I2C specification which you think
says this? I read it differently (page 10 of I2C 2.1 specification,
section 7.2: Acknowledge):

"Usually, a receiver which has been addressed is obliged to
generate an acknowledge after each byte has been
received, except when the message starts with a CBUS
address."

"If a master-receiver is involved in a transfer, it must signal
the end of data to the slave-transmitter by not generating
an acknowledge on the last byte that was clocked out of
the slave. The slave-transmitter must release the data line
to allow the master to generate a STOP or repeated
START condition."

So, a master-receiver must nack the last byte, but a slave-receiver must
not. So your slave device is misbehaving - or you are actually trying
to write more bytes to it than it can handle.

> (i have see the possibility to set the I2C_M_IGNORE_NAK but ignore all 
> NAK and isn't right!)

This should indeed be avoided unless you really have to use it.

> There is a solution or I have to modify the code?

First ensure that you are sending the right number of bytes to the
device, with the correct sequence. If you think you're really doing the
right think, get in touch with the vendor of the slave device and ask
them why their device misbehaves.

-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux