This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi C2000 Gurus,
I have an I2C link set-up between a F28004x device and a host MCU. The host works as the master during normal operation, while the C28x is the slave. The 0049 device is able to receive data in I2C_SLAVE_RECEIVE_MODE, but unable to send any out in I2C_SLAVE_SEND_MODE.
I have attached a scope shot of SDA and SCL lines where the first set of activity corresponds to the host MCU sending 2 bytes of data to the 0049. This is received perfectly every time. The following set of pulses correspond to the master trying to read data sent by the 0049 but there is nothing there.
I am using a FIFO ISR on the C28x to receive data. After reading the received data in the ISR I immediately load 2 bytes of C28x data to be sent on the transmit register. DXR register correctly reflects the data I am supposed to send. But this is not seen on the bus or by the host MCU on a read request. Even if we assume that my read request from the host MCU is coming in too quick (which is clearly not the case as seen in the attached scope shot), my subsequent read requests from the host MCU also return nothing. I am pretty sure I am missing something fairly basic here and would be very grateful if you could point me in the right direction.
An interesting thing to note is that I am able to receive the data on the 0049 just fine even if I configure the I2C to be in the I2C_SLAVE_SEND_MODE throughout the operation. In the following snippet of code taken from my FIFO ISR, I am actually resetting the I2C module as part of the mode switching process. As I mentioned, if I don't switch the mode (no I2C reset) and configure the I2C in I2C_SLAVE_SEND_MODE from initialization, it still gives me the same behavior.
Your help is greatly appreciated.
Thank you!
Hrishi
CH1: SCL, CH2: SDA
Hrishi,
Good to hear from you.
In your ISR, you are disabling / enabling I2C module. This can reset the I2C statemachine. You can directly change the I2C Send mode without doing this.
In Tenor, we have I2C master / slave example, this should help to understand how to configure the I2C slave configuration better.
<C2000Ware>\driverlib\f2838x\examples\c28x\i2c\
Exmaple: i2c_ex5_master_slave_interrupt
Regards,
Manoj
Hi Manoj,
Long time! Thanks for your reply. The disabling/enabling of the I2C module was just one of the things I tried to get this to work. I did change mode without doing this, but got saw the same behavior.
I have been referring to the I2C_ex5_master_slave_interrupt example, specifically example 2. I don't quite understand #308 below and how this would apply to my use case
Thanks,
Hrishi
Hrishi,
This is used by I2CA (Master) to ask I2CB to transmit from I2CB (slave) transmit buffer.
// Example2: I2CA as Master Receiver and I2CB working Slave Transmitter //
// I2CA = Master Receiver
// I2CB = Slave Transmitter
// I2CA generates
// 1) START condition
// 2) I2CB address (Slave address) + Write mode
// 3) Transmit start address of I2CB_TXdata
// 4) I2CA generates repeated START condition + Read mode
// 4) I2CB (slave) transmits contents of I2CB_TXdata
// 5) I2CA received data is stored in I2CA_RXdata array
// 6) Contents of I2CB_TXdata and I2CA_RXdata should match
Do you have I2C waveforms from logic analyzer? Typically, I2C slave transmitter is performed as shown below
START condition + Transmit slave address + Write bit + Transmit address of I2CB_TXdata + Repeated START + Read bit + Slave transmitting data ('N' bytes) + STOP
Regards,
Manoj