Chris Magnussen

Wierd I2C stop sequence (MCF52235)

Discussion created by Chris Magnussen on Mar 27, 2008
Latest reply on Mar 27, 2008 by Chris Magnussen
Howdy,
 
Got a problem and I'm pretty new to this so hopefully I'm just making a stupid mistake.
 
 
I'm using i2c between my MCF52235 and another chip and the freescale is the master.
 
 
The chip I'm working with has what I think is a strange sequence as far as the freescale being able to read from it.
 
The first byte I'm sending the chip is the address obviously, and the read bit is set.  I'm getting an ack back.
 
Here's the problem.  If the first byte I read from the chip is the number of bytes I'm going to be receiving in total.  If I get all zero's (meaning zero bytes), I'm supposed to NAK and kill the session.  If I get anything else, I'm supposed to ACK and the chip will keep sending until I get to the last byte, and then I NAK to kill it.
 
However, how am I supposed to read that first byte and then immediatly either NAK or ACK depending on the value.  I thought I'm supposed to tell the MCF52235 that it is to NAK and ACK before I do the final read.  I can't really do that if the first byte I read determines that.
 
Any ideas?
 
Thanks,
cmag


Message Edited by cmag on 2008-03-27 12:13 AM

Message Edited by cmag on 2008-03-27 12:15 AM

Outcomes