Hi,
            I am working on implementation of I2C driver for both MPC8540(A) & 
MPC8560(B) in Master Mode scenarios. The problem I am facing is given below

If I read any buffer part via I2C bus from A to B continuously,the driver is 
working fine. However during this processing ,if B tries to read any buffer 
register from A the bus will goes into low state (both SCL and SDA are low).The 
error that it was showing are mainly NO ACK  and Remote IO errors. After this I 
suspect that it may be the problem form slave receive function that I 
implemented. The reference Manual says that you have to set I2CCR[TXAK] bit 
after slave receive finishes. But how does slave knows wether this will last 
byte of transaction.Only Master have this knowledge. The slave implementation 
is as follows:-

#ifdef CONFIG_MPC_I2C_SLAVE

                        // lost arbitration?
                        if ((priv->read(&priv->regs->i2csr) & MPC_I2CSR_MAL))
                        {

                                    priv->write(&priv->regs->i2csr, 0, 
MPC_I2CSR_MAL);
                                    if ((priv->read(&priv->regs->i2csr) & 
MPC_I2CSR_MAAS))
                                    {
                                                mpc_slave_address_match(priv);
                                    }
                        }
                        else
                        {
                                    if ((priv->read(&priv->regs->i2csr) & 
MPC_I2CSR_MAAS))
                                    {
                                                mpc_slave_address_match(priv);
                                    }
                                    else if ((priv->read(&priv->regs->i2ccr) & 
MPC_I2CCR_MTX))
                                    {
                                                mpc_slave_tx(priv);
                                    }
                                    else
                                    {
                                                mpc_slave_rx(priv);
                                    }
                        }
#endif
            }

static inline void mpc_slave_rx(struct mpc_i2c_private *priv)
{
            buffer = priv->read(&priv->regs->i2cdr);

            -------------Some Montavista Event Broker Part-----------

}

Since I am new in I2C functionality, Please point out any mistake I was doing.

This message and any attachment therewith is privileged, confidential and 
proprietary in nature and the property of the originator. It is intended solely 
and exclusively for use by the individual to whom it is addressed. It should 
not be circulated or used for any purpose other than for what is stated. If you 
have received this message erroneously, please notify the originator 
immediately. If you are not the intended recipient, you are notified that you 
are strictly prohibited from using, copying, altering, or disclosing the 
contents of this message and are called upon to delete the same from your 
system. Any contradictory action by you may invite penal consequences. Vihaan 
Networks Limited accepts no responsibility for loss or damage arising from the 
use of the information transmitted by this email including but not limited to 
damage from virus."
_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

Reply via email to