Page 1 of 1

Arduino IDE does not recognize MPU6050 initialized by Wire.h

Posted: Sun Dec 15, 2024 12:51 pm
by narendra.desilva
Hi
I am trying to read MPU6050 using STM32duino. I got the MPU SCL, SDA connected to PB6 and PB7 of my STM32F407VG DiyMore Black Board.

STM32F407VGT6_diymore-pins2.jpg
STM32F407VGT6_diymore-pins2.jpg (10.35 KiB) Viewed 685 times

First I tried to scan the address using the I2C scanner in the Examples under Wire.

It does not detect MPU6050. There is no problem with my MPU6050 breakout as it communicates well with Arduino Uno. Can somebody help me to get this issue settled.


Regards

Re: Arduino IDE does not recognize MPU6050 initialized by Wire.h

Posted: Sun Dec 15, 2024 1:25 pm
by fpiSTM
Add pull up resistors on each I2C lines.

Re: Arduino IDE does not recognize MPU6050 initialized by Wire.h

Posted: Sun Dec 15, 2024 1:43 pm
by GonzoG
If you're using DIYMORE f407VGT variant, it won't work on PB6 and PB7 as default I2C pins are PB8, PB9. Same for F407Vx variant.
in variants\STM32F4xx\F407V(E-G)T_F417V(E-G)T\variant_DIYMORE_F407VGT.h

Code: Select all

// I2C Definitions
#ifndef PIN_WIRE_SDA
  #define PIN_WIRE_SDA          PB9
#endif
#ifndef PIN_WIRE_SCL
  #define PIN_WIRE_SCL          PB8
#endif

Re: Arduino IDE does not recognize MPU6050 initialized by Wire.h

Posted: Mon Dec 16, 2024 2:42 am
by narendra.desilva
Gonzog and all

The transfer of the connections to PB8 and PB9 sorted out the matter. Thanks a lot again. It is really great to have support of this level. The pinout I of the diyMore board am using is as attached.
DIY-More-STM32F407VGT6_3.jpg
DIY-More-STM32F407VGT6_3.jpg (93.82 KiB) Viewed 632 times
I am not sure whether this document is not correct. Please share the correct one if you have it.

Thanks again for the prompt help.

Regards