I am working on interfacing ADXL345 accelerometer with STM32F103 blue pill board through I2C communication. I have written the code in Keil software by surfing the internet which works fine sometimes, verified using logic analyzer. The problem is that sometimes the BUSY bit is set after starting communication. I do not know why this arises. After searching related to this problem I found that the I2C clock must be enabled before configuring GPIO to alternate functions. But the problem is not solved, I am stuck with this Busy bit.
Any ideas are welcome.