2016-05-11 03:30 AM
The Application Note doesn't seem to consider the case of a Repeated Start Condition.
Are there any special considerations?Although the App Note specifically addresses STM32F10x, I am actually using an STM32F411 - See:/3d14d9c6
Are there any special considerations? #repeated-start #i2c #stm32f4112016-05-12 01:29 AM
I think you only
need
repeated-start when there are multiple masters on your I2C bus. Otherwise a stop followed by a start works fine.I do think something that claims to be I2C should include repeated-start.When I closely studied an stm32 I2C port, I did not find mention of an interrupt on completion of a repeated-start. But that was probably stm32f1xx, and later ones might support it.Hope this helps,Danish2016-05-12 03:13 AM
''I think you only
need
repeated-start when there are multiple masters on your I2C bus. Otherwise a stop followed by a start works fine''No, that's not true.The specific case at hand is the LTC2941: it needs a repeated Start to switch from sending the internal register address to reading the contents of that register.If a stop were sent, it would reset the register address.http://www.linear.com/product/LTC29412016-05-12 05:27 AM
void I2C_start2(I2C_TypeDef* I2Cx, uint8_t address, uint8_t direction){
//while(I2C_GetFlagStatus(I2Cx, I2C_FLAG_BUSY));
I2C_GenerateSTART(I2Cx, ENABLE);
while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_MODE_SELECT));
I2C_Send7bitAddress(I2Cx, address, direction);
if(direction == I2C_Direction_Transmitter){
while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED));
}
else if(direction == I2C_Direction_Receiver){
while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED));
}
}
This is how i do repeat start , and it works, you just don't check if bus is busy, because it will hang in that loop.
if you uncoment that busy check, you get first start condition like in normal I2C Start
2016-05-12 01:19 PM
That's interesting. The data sheet doesn't make it obvious that the ''internal register address pointer'' will be reset on a stop condition. It seems to be written much the same way as many I2C peripherals where stop followed by start can be used in place of repeated-start.
Unless there's something I didn't notice - please could you point to a specific paragraph.Maybe that's one of the ''gotcha's'' that chip designers like to spring on users. - Danish