inav icon indicating copy to clipboard operation
inav copied to clipboard

magnetometer are detected but no oscillation found when tuning. (beerotor F4 & radiolink se100) problem of QMC5883?

Open chan2328 opened this issue 9 years ago • 87 comments

FC: beerotor F4, identifier: INAV, version: 1.7.3 Running firmware released on: Sep 9 2017 10:49:35 Board: BRF4, version: 0 GPS: Radiolink SE100 (ublox M8030 with DA 5883 compass)

I can make sure that the wiring between FC and GPS is correct, and the GPS automatically detected and works fine, but the magnetometer 5883 are recognized by inav only it does not work. please see below pic. i have tried several things to do such as;

  1. decreasing the i2c speed from 400khz to 200khz or 100khz.
  2. connecting the vcc from 5V to 3.3V.
  3. connect magnetometer with vcc, scl, sda, GND only.

the results are the same, no oscillation found by mag. this is a trick when i turn the compass vertically, the oscillation will change from -0 to 0 only, and then the magnetometer will be lost. the SCL and SDA of FC are measured as 3.3V and the internal barometer works fine. i just brought them last week, is it a issue of inav, FC or mag?

mag 1 2

chan2328 avatar Oct 09 '17 13:10 chan2328

bootlog

Time Evt Description Parameters 2: 0 CONFIG_LOADED 2: 1 SYSTEM_INIT_DONE 502: 19 TIMER_CHANNEL_MAPPED (1, 1, 0, 2) 502: 19 TIMER_CHANNEL_MAPPED (2, 2, 0, 2) 502: 19 TIMER_CHANNEL_MAPPED (3, 3, 0, 2) 502: 19 TIMER_CHANNEL_MAPPED (4, 4, 0, 2) 502: 19 TIMER_CHANNEL_MAPPED (5, 5, 0, 2) 502: 19 TIMER_CHANNEL_MAPPED (6, 6, 0, 2) 502: 19 TIMER_CHANNEL_MAPPED (7, 7, 0, 2) 502: 19 TIMER_CHANNEL_MAPPED (8, 8, 0, 2) 502: 2 PWM_INIT_DONE 502: 3 EXTRA_BOOT_DELAY 1188: 9 GYRO_DETECTION (7, 0, 0, 0) 1779: 10 ACC_DETECTION (8, 0, 0, 0) 1800: 11 BARO_DETECTION (4, 0, 0, 0) 1800: 20 PITOT_DETECTION (0, 0, 0, 0) 1800: 12 MAG_DETECTION (2, 0, 0, 0) 3461: 4 SENSOR_INIT_DONE 5170: 8 SYSTEM_READY

status

System Uptime: 725 seconds Voltage: 0 * 0.1V (3S battery - OK) CPU Clock=168MHz, GYRO=MPU6500, ACC=MPU6500, BARO=BMP280, MAG=HMC5883 Sensor status: GYRO=OK, ACC=OK, MAG=OK, BARO=OK, RANGEFINDER=NONE, GPS=NONE SD card: Startup failed Stack size: 2048, Stack address: 0x10010000 I2C Errors: 0, config size: 3318, max available config: 131072 ADC channel usage: BATTERY : configured = ADC 1, used = none RSSI : configured = ADC 3, used = none CURRENT : configured = ADC 2, used = none AIRSPEED : configured = none, used = none System load: 0, cycle time: 2004, PID rate: 499, RX rate: 49, System rate: 9

chan2328 avatar Oct 09 '17 14:10 chan2328

i guess, that DA 5883 is QMC5883 compass. in INAV configurator UI there is no option for QMC5883. but found in CLI command.
when i set FAKE magnetometer in UI, CLI show as below. mag_hardware = QMC5883 Allowed values: NONE, AUTO, HMC5883, AK8975, GPSMAG, MAG3110, AK8963, IST8310, QMC5883, FAKE

when i set FAKE in CLI. UI show "blank" in magnetometer.

unfortunately, it does not work also.

chan2328 avatar Oct 10 '17 04:10 chan2328

Hi! I think that I've the same problem with the same product (Radiolink SE100) and Omnibus F4 pro (V3). I have two units of this product, the first worked without problem, but after two hours of use, something went wrong and the unit was dead. I bought another, and the board is slightly different, now is like yours, and the MAG does not work too. Did you find a solution for your problem?

McGiverGim avatar Nov 13 '17 13:11 McGiverGim

@chan2328 if it helps, I finally make it working (using Betaflight, but I'm pretty sure that in iNav the solution will be the same). The chip is detected like HMC5883 and the only thing I needed to change in the code is the use of the gain. In the: https://github.com/iNavFlight/inav/blob/912d131556302cf6ea67d59308e43dfe65ca8026/src/main/drivers/compass/compass_hmc5883l.c#L185-L187 Remove the magGain from here. The calculation of it is zero, and it will work. A better solution will be to modify the calculation of the gain, but this is outside of my knowledge.

McGiverGim avatar Nov 14 '17 07:11 McGiverGim

Would be great if this problem is fixed. It's a great GPS and if we can make use of the compass it would be superb.

ghost avatar Nov 24 '17 17:11 ghost

The easiest way is, if magGain is zero in some of the axis, then magGain = 1 for all axis. With this I think it will work.

McGiverGim avatar Nov 24 '17 17:11 McGiverGim

Thanks for your reply mate. How can I compile your code into a build for my Omnibus F4 v2? Thanks a bunch!

ghost avatar Nov 24 '17 17:11 ghost

If it's only for you, simply remove the magGain from the above lines, ending like this:

 magDev->magADCRaw[X] = (int16_t)(buf[0] << 8 | buf[1]) ; 
 magDev->magADCRaw[Z] = (int16_t)(buf[2] << 8 | buf[3]) ; 
 magDev->magADCRaw[Y] = (int16_t)(buf[4] << 8 | buf[5]) ; 

And build it.

McGiverGim avatar Nov 24 '17 17:11 McGiverGim

Hi all. I recently received Radiolink SE100 unit from Banggood and I have the same problem as above - mag is detected as HMC5883 in Inav but outputs are 0 and calibration not possible. (However model still moves in Inav configurator if I rotate SE100 or put a magnet near it, only not accurately) I have contacted Radiolink and they told me that black boards - like mine or in the picture from the first post  (they show blue boards without RF shield in their adds) are their latest units: "Dear Sir your SE100 GPS is the newest version ,becuase the chip HMC5883 stoppde production recently, we have to change the chip.
the newest SE100 GPS can not use with F3 flight controller, can use with APM and PIX flight controller."

So they cobbled up something from the QMC5883 chip to mimic HMC5883 chip and this "creation" works as neither of those.

Now I removed gain calculation and mag output is no longer 0, though I wonder if accuracy or something else is not affected this way?

Other than that GPS works very well in this unit and they also released a smaller version (TS100 mini) which claims to have QMC5883 mag. I wonder if they screwed this one up as well.

Arvycka avatar Nov 24 '17 19:11 Arvycka

@Arvycka would you be willing to help me create a build that fixes this issue? I don't have the knowledge to create a build. Thank you

ghost avatar Nov 24 '17 19:11 ghost

Which target?

Arvycka avatar Nov 24 '17 19:11 Arvycka

OmnibusF4PRO

ghost avatar Nov 24 '17 19:11 ghost

Building. Can I upload it here?

Arvycka avatar Nov 24 '17 19:11 Arvycka

https://drive.google.com/file/d/1mtcN4J8CPb8gDNTWP2XShEhXYqcABBjE/view?usp=drivesdk

Arvycka avatar Nov 24 '17 19:11 Arvycka

@Arvycka thank you so much!!

ghost avatar Nov 24 '17 19:11 ghost

I also ordered Radiolink TS100 mini (before I found this thread). It's much smaller and lighter. I will report the results once I receive and test it.

Arvycka avatar Nov 24 '17 19:11 Arvycka

Very interested in your results with the mini. The SE100 works perfect, if the mini is similar, will be great for our minis.

McGiverGim avatar Nov 24 '17 19:11 McGiverGim

That would be great. It is €13 euro's right? I've tested your build but I seem to have problems with my barometer now.

ghost avatar Nov 24 '17 19:11 ghost

Yes, thes Radiolink units have very attractive prices. Hm...I have not changed anything else. My onboard BMP 280 baro works fine on Omnibus F3. This was my second build to be honest :-)

Arvycka avatar Nov 24 '17 20:11 Arvycka

Strange... my board has a BMP280 as well

ghost avatar Nov 24 '17 20:11 ghost