I have a problem with an I2C communication and want you to ask whether there is a better solution than mine.
I am programming an STM32F103 at the moment. There is one sensor (MPU6050) which is connected via I2C to the STM32. I recognized that if I reset the STM32 a few times, the STM32 gets stuck (or got an timeout error) during the initialization of the I2C. The timeout error was during the wait of the busy flag. So the I2C communication was "occupied". The MPU6050 is the only other I2C device (slave).
In my opinion there is an error, because I was reading a register from the MPU6050 when I reset the STM32. So the MPU6050 never gets the stop condition.
I do not know how to reset the I2C connection, when the bus is "occupied" (by the MPU6050). So my solution would be to do a hardware reset with a transmission gate of the MPU6050. Is there maybe a simpler software solution?
Thanks for the help.