mag i2c issue
hi i'm using f3 seriously dodo FC with ublox m8n gps/mag ,firmware version 1.6.1 everything works properly at first but after a couple minutes i get i2c errors over 20000 and cpu load over 900% the thing is its not consistent sometime it happens after 2 minutes other times after over 8 or 10 minutes and when this happens the FC freezes .
if i remove the mag wires (SDA and SCL) everything is fine so i know it is something to do with the magnetometer but its not a hardware problem i think.
mag hardware is HMC5883 please help.
this is a cli status example
status
System Uptime: 1182 seconds Voltage: 0 * 0.1V (3S battery - OK) CPU Clock=72MHz, GYRO=MPU6050, ACC=MPU6050.n, BARO=BMP280, MAG=HMC5883 Sensor status: GYRO=OK, ACC=OK, MAG=FAILING, BARO=OK, SONAR=NONE, GPS=UNAVAILABLE Stack size: 2048, Stack address: 0x10002000 I2C Errors: 24058, config size: 2514, max available config: 4096 System load: 860, cycle time: 20195, PID rate: 49, RX rate: 4, System rate: 0
Hi, Looks like a hardware issue to me - with either magnetometer chip itself, the I2C wiring or i2c pull-up resistors. If it were firmware bus handling code - most likely it would be failing right from the start.
My experience with one of HMC5883 is quite opposite - I have problems with detecting the chip after HW reboot in cold conditions, but once it passes that point it works like a charm. See discussion here: https://github.com/iNavFlight/inav/issues/727
Anyway, I think that your case should have been detected as failing hardware instead of overloading the system and eventually freezing...
Noise on I2C bus can cause chip to hang and pull either SCL or SDA to low level indefinitely. This kills entire bus and CPU can't do anything about it. Basically, it's not the sensor failure, it's bus failure and it should be dealt with in hardware.
Also has issues with my Mag. Im using Omnibus F3 and Ublox M8N with Compass. At first the Mag works, After a few minutes the icon on Inav turns red. I2c errors also started to increment. I tried separating the wires of the compass SDA and SCL from 5V and GNd, but still the problem persists. I've read from others that the GPS should be powered with 3.3V and not by 5V?. Can anyone confirm this?
@digitalentity @krzysztofmatula i found out in inav master in this path C:\Users\hp 15\Desktop\inav\inav-master\src\main\target\RMDO\target.h these two lines //#define USE_MAG_DATA_READY_SIGNAL //#define ENSURE_MAG_DATA_READY_IS_HIGH as you can see they commented out i think they have to do with i2c bus handling but i don't know how to apply this modification to the configurator is there any way you can show me how to do it if you know how thanks
@diode121 i've tried switching from 5v to 3.3v still same problem but i noticed that this action delayed the problem i don't know the seller said its 5v but it still worked on 3,3v
@SKYRIM101 try powering the mag and GPS from 3.3V and also adding additional 1K pull-up resistors to 3.3V near the mag sensor. I2C issues are usually related to incorrectly chosen pull-up resistors.
@digitalentity Can you please show me on how to properly add a pullup resistor?... Also did some research on ublox m8n, it says it already has built in pull-up resistor
I have similar problem with SPracing F3. 2 crashes after upgrading from 1.4 to 1.6.1. Many i2c errors after several minutes in air.
Here is video from my DVR https://www.youtube.com/watch?v=x_qQcbrJyzs&feature=youtu.be. Look in the end(but some config is viewable when I configured PIDS by OSD). OSD was redraw only after crash with big delay.
Just re-opened my ublox m8n with built in mag. Sensor show as m883 instead of l883. Can this be the culprit?
@digitalentity it worked! thank you sir i just added the additional 1 k pull up resistors and the errors are gone i can confidently say that this issue has been solved
@SKYRIM101 can you show me on how you did it?
@diode121 i just soldered 1 k resisitor to SDA and another one to SCL and soldered the other end of both resistors to the 3.3v that supplies the module it worked for me can you post your result

I havent tried putting any pull up yet since im not sure if my sensor is correct. I uploaded an image, @SKYRIM101 could you please take a look at it. Is that the right place on where to put 1k resistors on the gps module. I put a red mark on it.
@diode121 i didn't solder it inside the module because it will not close properly
so i did the soldering on the wiring before the flight controller
this is basically what i did sorry i couldn't take a photo of the connection its pretty messy
and yes these are the correct pins for the resistors
@SKYRIM101 Thank you very much. This is very helpful. I'll try to do this. Need to get some sleep first, it is now past midnight in my country..:) Thanks @SKYRIM101 @digitalentity
Good to know that you managed to sort it out!
I had the same problem with my mag. Added 1k pull-ups and seems that I now error free. Thank you @skyrim101
Adding pullups solved it for me too, both iNav and BetaFlight 3.2. Thanks for the tip. FC was Omnibus F4 SD. Remapped UART3 to I2C.
