I’ve been reading up on I2C and have looked at the hardware I2C example in the wiki. It looks simple enough and the driver does a nice job of relieving the developer of knowing the nitty gritty timing details for the I2C protocol.
However, I am trying to interface with an I2C pressure sensor, and am having trouble getting it to communicate. I’ve attached the communication diagram.
What doesn’t make sense to me is that it seems like it’s non-standard or something. The driver code implies that we’ll send some number of bytes to the slave, and the slave will respond with a certain number of bytes. I just need to create the I2CTransactions of an appropriate size, and then send Execute them via the I2CDevice object.
The diagram implies that the R/W bit just has to be set for the sensor to respond with 2 bytes of data. The only way I can see doing this is to send over one byte, where the first 7 bits are the sensor’s ID, and the last bit is set to 1. The device’s default ID is 0x78, so I tried to send 0x79. Actually, I’ve run a loop where I sent 0-255, and each time I got a timeout error. So perhaps there is data coming back but it’s not formatted properly?
I’ll put the SCL and SDA lines on my logic analyzer, and maybe I’ll see something worth following up with another post. If anyone could offer me some opinions or suggestions for troubleshooting this, I’d really appreciate it!
UPDATE: I decided to scope out the clock signal directly from the Fez Panda II (I disconnected the sensor completely), and have attached the waveform. It’s all over the place! Is this normal with I2C? I also dropped my speed down to 100kHz, which is the minimum recommended speed for my sensor.