I am trying to communicate with the Barometric sensor MS5611, using the I2C protocol. My micro is STM32f3discovery. The address of the sensor is send, but not the command. The code is stucked in the while loop waiting for TXIE bit to be set. The reason why TXIE is not "one", is because the acknowledge bit from the MS5611 is not showing up. Also the I2C status register is setting the NACK (not acknowledge), STOPF (stop flag) bit.
The address of the MS5611 sensor is 11101100. This can be seen in the datasheet on the page 12.In my case the value of CSB is zero.
But the O-scope shows me a different picture. I have try it in both ways, CSB zero in CSB one, but no success.
CSB zero:O-scope picture 1
CSB one: somewhere in my comments :)
...I can't paste a picture or a link because I don't have enough reputation points:-/
I have been thinking in this way: Could be that my timing is off. The reason I am thinking this is because of the stop condition that is at the 9th SCL pulse. At this place the ACK bit should kick in and not the STOP bit.
So, why is the 9th pulse high? and who is giving the 9th pulse, micro or sensor?
Edition number uno: Till now, I have tried to send the read command, with both combinations (11101101 or 11101111), changed to other I2C devices. This controller has two I2C modules (I2C1 and I2C2), changed the pins(from PB6,PB7 to PA9 and PA10). With no success.
On the other hand, I have addressed the mems acellometer sensor on the st board with the same pins(PB6,PB7) and the same code. The only difference was the timing values in I2C timing register and the address. Worked like a charm.
My conclusion, obviously, are that something is wrong with my timing values or with sensor I2C protocol. However I used the example of timing settings in ST reference manual.
So, I have no other alternative that to go in debugger mode and to dig more deeper about the I2C timing values.
I would appreciate any additional information and thanks for the help :)
It looks like you aren't receiving an ack by a stop (freeing the i2c bus) sent by the micro-controller based on the oscilloscope data.
Most likely you are trying to write to an address which does not exist. Also in i2c there is 7 bit addressing and 10 bit however there is no 8 bit addressing. The 8th bit is used to tell the device if it is requesting to read or write. Further the 9th pulse is high because it was held low by the master while sending the last 0 (to signal a write), it can stop pulling that line low until the next clock cycle. The signal to write was sent on the rising clock, it can't change the data at a high clock (start stop signals are those) then when clock lowers again, it now can release it, but normally the slave should pull the data low here to signal "yes I am here" but there isn't a slave there and no the master shouldn't control it here only the device at that address should.
You sent 1110:1100
which has a 0 in the least significant bit and which is a write to address 1110:110. No one answered.