MPU6050 I2C communication stops with STM32F411 (out of sync?)
So I'm trying to configure communication with the MPU6050 from the STM32 Black Pill module using the driver from anasvag575, I reconfigured the driver to LL library because the driver used the standard library and I don't want it to become a mess later.
The problem I'm facing now is that it seems like the thing stopped working when it after calling LL_I2C_TransmitData8 and it just stuck waiting for the ADDR bit to be set but that never happened. The logic shows that it generated the start correctly but the address is very inconsistent when I test it by resetting it


Sometimes it generated the correct address, sometimes SCL goes high at the same time as SDA. I've tried changing the I2C speed configuration but sometimes it makes worse where SCL can't even transfer a bit.
I've tried different libraries but obviously none of them really worked, some got stuck waiting for the start bit flag instead.
static inline void i2c_write_data(I2C_TypeDef *i2c_handle, uint8_t address, uint8_t *data, uint8_t num_of_data)
{
uint8_t i;
LL_I2C_Enable(i2c_handle);
LL_I2C_GenerateStartCondition(i2c_handle);
while (LL_I2C_IsActiveFlag_SB(i2c_handle) == 0);
LL_I2C_TransmitData8(i2c_handle, address);
while (LL_I2C_IsActiveFlag_ADDR(i2c_handle) == 0);
LL_I2C_ClearFlag_ADDR(i2c_handle);
for(i = 0; i < num_of_data; i++){
while(LL_I2C_IsActiveFlag_TXE(i2c_handle) == 0);
LL_I2C_TransmitData8(i2c_handle, data[i]);
}
while(LL_I2C_IsActiveFlag_BTF(i2c_handle) == 0);
LL_I2C_GenerateStopCondition(i2c_handle);
LL_I2C_Disable(i2c_handle);
}
