PDA

View Full Version : I2C Slave: how to generate NAck ?



aa222k
- 16th September 2011, 15:47
As you can see, who can remember (ref. old posts), I'm fighting (and loosing : with I2C.
Now my HW seems to be ok. (if someone wants to know how just ask).
I'm not able to generate a NACK (not using built in functions) so questions:
1) Is true that I have to generate NACK at the last received byte? (source AN734 page 1)
2) How can I do this ?

My project is pic16f88 slave
master send 8byte after sent master want read back 8byte and at the end of 8th byte if no nack from slave master reject data and give error.

Please help me: I'm getting mad with this project...

Toadman
- 16th September 2011, 17:02
HI,

In reading THE I 2C-BUS SPECIFICATION VERSION 2.1 JANUARY 2000, it appears that yes, you need to ACK. That is all I can throw into this.

Toadman

mister_e
- 16th September 2011, 17:22
Datasheet, section 10.3.1 and later will give you the answer

falingtrea
- 16th September 2011, 19:11
Well as I read it, the only time a NACK is sent for valid data is when the Master is requesting a sequential read. The Master sends a NACK on the last read to say he is done. But there is no reason why the Master couldn't ACK the last read and then send a STOP. Also note that the NACK/ACK is sent by the master on a read, not the slave.

aa222k
- 16th September 2011, 20:24
Also note that the NACK/ACK is sent by the master on a read, not the slave.

in an734 page1

After the last data byte, a NACK is sent by the
Slave to the Master to indicate that no more bytes
should be sent. After the NACK pulse, the Master initiates
the STOP condition to free the bus.

mackrackit
- 16th September 2011, 23:58
Have you looked here?
http://www.picbasic.co.uk/forum/content.php?r=69