2024-05-19 07:31 AM - last edited on 2024-05-20 02:29 AM by SofLit
Hello everyone,
I'm trying to use MPU6050, HMC5883L and MS5611 all together in a project with an STM32F446RE. The problem is, while every components all work fine alone, when is use MPU6050 and HMC5883L together, it doesn't work. By not working, I'm meaning that the datas collected are all wrong. What's also weird is that : MPU6050 and MS5611 work fine together, same for HMC5883L and MS5611.
So let's focus on MPU6050 and HMC5883L only I guess...
For the connections I just did that :
So in my case, I connect the two sensors to the same SCL and SDA. Which should work, but I suspect that the problem might come from this connection. Indeed, even thought I'm assuming the right addresses are written in the code, could it be possible that troughout I2C, parts of the data are overwritten ? If so, what can I do ?
If you have any other ideas of where the problem could be, feel free to share it ^^
I attached all the code i use.
Thanks for your help !
Solved! Go to Solution.
2024-05-22 05:27 PM - edited 2024-05-22 05:35 PM
The Green is the pull-up / level shifter, the Orange is the "5V/VIN" side 2K2's.
The Red is the 3V3 Regulator
I'd probably lose the orange resistors and the 6-pin IC, and then bridge the SCL/SDA at the pull-up to the respective pads on the ones removed.
2024-05-19 07:49 AM - edited 2024-05-19 07:49 AM
Hi,
just to understand:
>MPU6050 and MS5611 work fine together, same for HMC5883L and MS5611.
>MPU6050 and HMC5883L together, it doesn't work.
You have them all 3 always on the I2C connected and just address / work only with 2 ,
or you physically remove the "other" 3rd from connection and program ?
2024-05-19 07:59 AM
Hi,
I physically remove the other 3rd connection and program.
Also while doing those pairs of sensor the connection is the same, I always connect on the same SDA and SCL.
That is why it is weird. I thought the problem was how I connected everything at first, but since MS5611 is working fine using only MPU with it and same while using only HMC with it, but MPU and HMC together is not working, it seems that this connection is the problem...
2024-05-19 09:09 AM - edited 2024-05-19 09:10 AM
Besides, what Emma the AI, telling...
what happens, if MPU6050 and HMC5883L together on the bus , but you only address one of them ?
2024-05-19 02:13 PM - edited 2024-05-19 02:42 PM
How wired?
Just chips? On modules with regulators and level shifters?
Combo module like GY-86 https://store.open-electronics.org/GY-86
2024-05-20 01:03 AM - edited 2024-05-20 01:06 AM
"what happens, if MPU6050 and HMC5883L together on the bus , but you only address one of them ?"
The problem is still the same. :thinking_face: I tried addressing mpu6050 only and hmc5883l only with the other one still there physically...
"How wired?
Just chips? On modules with regulators and level shifters?
Combo module like GY-86 https://store.open-electronics.org/GY-86"
This is not a combo module, the two sensors are apart, i'm going to show pics of my montage so you can have a better idea : (colors mean the same as the colors in the diagram I sent)
Hope you can see everything fine.
I'm honestly even more confused now.. x)
2024-05-20 01:36 AM
So arguably circuit a lot more complex than diagrammed?
Link to module schematics?
VCC is what here?
Pull up resistors on every board?
2024-05-20 02:36 AM - edited 2024-05-20 02:36 AM
Yep,
You can find the datasheet here for mpu 6050: https://pdf1.alldatasheet.fr/datasheet-pdf/view/517744/ETC1/MPU-6050.html
and here for HMC5883L : https://www.farnell.com/datasheets/1683374.pdf
VCC is yellow, corresponding to 5V.
"Pull up resistors on every board ?"
I don't have any, it might be the problem....
The thing is, it is said that mpu6050 and HMC5883L can work together without the need of pull up resistors.. ://
I'm going to get resistors tomorrow, and test this week, i'll keep you updated.
If you have any other ideas, feel free to share !
2024-05-20 03:10 AM
>I don't have any, it might be the problem....
:)
If you set I2C clock to low speed, maybe 20kHz, the internal pullups could be ok for a test:
set port/pins SCL/SDA with pullup on.
2024-05-20 03:49 AM
Ok, so now I do have better values, they are getting closer to the expected values for the magnetometer. I get for the MPU a sort of "flash" of data every 4 seconds with the correct values then it returns to incorrect values. But it's already much better, and it shows us that the problem must come from there !
Thanks for helping ! I'll keep you updated ! :)