0
\$\begingroup\$

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. enter image description here 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.

Thank you.

\$\endgroup\$
  • \$\begingroup\$ What are the status register flags? (in I2C_SR1) \$\endgroup\$ – Peter Smith Apr 8 at 10:56
  • \$\begingroup\$ No flags arises in I2C_SR1.After setting the start bit in I2C_CR1 immediately the busy bit in I2C_SR2 arises. But sometimes it works fine! Is that weird! \$\endgroup\$ – Vimalraj Apr 11 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.