Other Parts Discussed in Thread: C2000WARE, TMS320F28379D,
Hi All,
Using the i2c_ex1_loopback example code, I'm not seeing how to receive data over I2C.
In loopback mode, the code operates as advertised. When I take it out of loopback mode, I don't see how it's getting data from the I2C receive buffer. I don't know if data is getting into the buffer.
Sending commands is not problem. I'm connected to a display, and all commands I send it are responding as expected, except for values that should be returning over I2C.
I'm getting the FIFO receive interrupts, so I thought I was getting data from the I2C bus, but all it ever presents is 0x00.
I know the display is working properly, because I have some Arduino example code that it's working with.
Here are my changes to the receive part of the ISR to grab a single byte of data:
// // I2C A Transmit & Receive FIFO ISR. // __interrupt void i2cFIFOISR(void) { uint16_t i; // // If receive FIFO interrupt flag is set, read data // if((I2C_getInterruptStatus(I2CA_BASE) & I2C_INT_RXFF) != 0) { uint16_t bytes_Received; bytes_Received = I2C_getRxFIFOStatus(I2CA_BASE); for(i = 0; i < 1; i++) { rData[i] = I2C_getData(I2CA_BASE); if(rData[i] != 0) { bytes_Received = bytes_Received + 1; bytes_Received = bytes_Received - 1; } DEVICE_DELAY_US(10); } // // Clear interrupt flag // I2C_clearInterruptStatus(I2CA_BASE, I2C_INT_RXFF); Example_PassCount++; }
What I see coming in is a copy of what I'm sending out. The DLB bit is cleared, so I don't think the I2CDRR register is getting the outgoing data loaded internally. Here's the register setup:
I suspect I'm not getting the registers setup properly. Let me know what you'd like to see, and I'll gladly oblige.
Can you please point me in the right direction?
Thanks,
robin