2015-03-20 10:41 AM
Hello,
we are migrating our device from STM32F1 to F4 (415RGT6).Basically wiring is very similar, connected peripherals too.We have one device that communicating over I2C bus, but with same code it is unable to work with new processor.Of course, there are some differences - I2C3 instead of I2C2, etc. It should work, but does not.Initialization code looks like this: http://pastebin.com/5MRFkfbEIt seems that I can get WHOAMI response from I2C device, so connection is working somehow. Then I can write some data to it.But then I am getting:I2C_GetFlagStatus (I2C_MPU6050, I2C_FLAG_BUSY)so it is always BUSY after lets say 1 read and 1 write.My I2C code is able to reset whole I2C and communication but it does not help. Whats more there shouldn't be any BUSY flag.In this state, I2C register SR1 has value 0x44 and SR2 value 0x3.SR1 value means:I2C_FLAG_RXNEI2C_FLAG_BTFflags are present.SR2 has probably:I2C_FLAG_BUSYI2C_FLAG_MSLif I am correct.I use HSE 8Mhz crystal @ 168Mhz core clock, Flash Latency 5.There are Pull Up resistors 4K7 for SDA and SCL.What could be wrong?Thank you very much2015-03-20 02:36 PM
Problem solved!
Issue was caused in reading sequence.It is not 100% same with one used for F1 line.