malakym

  • *
  • 13
[SOLVED] Can't get data from Aux Mag
« on: February 29, 2016, 10:01:03 pm »
SOLVED: possible faulty gps/mag (even though mag works in an Rasberry Pi)


After having problems using the internal MAG in a Revo I bought myself a GPS+Mag unit - a NEO-7M.

I am using the 'next' branch and can see Aux Mag settings.

Once wired up the GPS works fine, so the unit is powered up.

It's wired up as per the left item here https://librepilot.atlassian.net/wiki/download/attachments/12058679/gps_wiring.png I have opened the casing and confirmed the SCL/SDA connections, I've also tried swapping them just incase with no luck.

I have the mag setting set to Aux Only, when I change to internal only I can see data from that sensor but nothing at all once I am set to Aux.

I have powered the unit with the flight battery before plugging USB in - I also use an OPLink groundstation and have tried this on both.


MAG is black, I2C is black, SENSOR is green.

MagState.Source is showing Invalid

I've changed AuxMagSensor.MetaData / Flight Telemetry update to 1000ms and sent it, confirmed its applied by reading the entry back.

I have tested GPS in the Flexi port to confirm the port is working and all seems okay.

I have no way to confirm the magnetometer is working separately, how could I do that? I have many USB>RS232 adaptors and such.

I have read through https://librepilot.atlassian.net/wiki/display/LPDOC/Aux+Mag+Setup+and+Calibration I am confused with the "- Pick a port to use: FlexiPort or I2CPort" line, since the Revo has an I2C port (as far as I know) and there is an option for such. With this I also tried setting AuxMagSettings.Type = Flexi instead of I2C, I have also tried going through the wizard and letting that set it based on selection with no luck either.
« Last Edit: March 05, 2016, 01:16:28 pm by malakym »

hwh

  • *
  • 1018
Re: Can't get data from Aux Mag
« Reply #1 on: February 29, 2016, 10:18:00 pm »
There was another thread about something similar, https://forum.librepilot.org/index.php?topic=679.msg4931#msg4931  maybe your problem is the same setting.

Mateusz

  • *
  • 808
Re: Can't get data from Aux Mag
« Reply #2 on: February 29, 2016, 10:24:49 pm »
I have read through https://librepilot.atlassian.net/wiki/display/LPDOC/Aux+Mag+Setup+and+Calibration I am confused with the "- Pick a port to use: FlexiPort or I2CPort" line, since the Revo has an I2C port (as far as I know) and there is an option for such. With this I also tried setting AuxMagSettings.Type = Flexi instead of I2C, I have also tried going through the wizard and letting that set it based on selection with no luck either.

Revo has no I2C port, it has to be Flexi and you have to connect I2C to flexi port. Also you should use INS31 attitude estimation algorithm not Complementary. Complementary does not use Mag or GPS, hence in that mode it would be black.

f5soh

  • *****
  • 4572
    • LibrePilot
Re: Can't get data from Aux Mag
« Reply #3 on: February 29, 2016, 10:41:35 pm »
Wizard should configure all you need for GPS+i2c
Flexiport as I2C
Auxmag type as Flexi
You should at least get a I2C orange or green, but not grey.

malakym

  • *
  • 13
Re: Can't get data from Aux Mag
« Reply #4 on: February 29, 2016, 11:09:05 pm »
Okay, I got confused with some people saying this does not have I2C but I can select it under the flexiport. I noticed the wizard selected Flexi under AuxMag Type and tried that first, then went with I2C.


So now I have.
Set Flexiport to I2C (I already had this)
Set AuxMag type to Flexi (I had mainly been trying I2C)
Set AuxMag Usage to AuxOnly (I already had this)
Set INS13 (This was off, forgot to change it after starting from scratch)
Set my home location including altitude as it wasn't set.

I2C is now Orange
MAG is now Black

I'm still getting no data under AuxMagSensor, all 0, Status None.


My ATTI and STAB are Red currently as im still waiting for a GPS fix - I realise GPS+MAG is needed for this - but the above data should still be arriving yes?

f5soh

  • *****
  • 4572
    • LibrePilot
Re: Can't get data from Aux Mag
« Reply #5 on: February 29, 2016, 11:14:49 pm »
I2C is now Orange

Seems your mag is not powered, wizard wiring assumes the mag side is powered from GPS side.

You can select the Fusion Algorithm to Comp+Mag or EKFIndoor, more easy for testing indoor.

malakym

  • *
  • 13
Re: Can't get data from Aux Mag
« Reply #6 on: February 29, 2016, 11:24:03 pm »
How would it be powered then? The wiring in the unit has no other power than the GPS side.

Or can this tell that no power is connected on the Flexiport?


I have changed
RevoSettings.FusionAlgorithm to Complementary+Mag

ATTI+STAB are Green.

GPS is Red (I can get a decent fix in a window but it takes a while initially)
MAG is Black (still not seeing data under AuxMagSensor)

f5soh

  • *****
  • 4572
    • LibrePilot
Re: Can't get data from Aux Mag
« Reply #7 on: February 29, 2016, 11:43:47 pm »
Before looking at Mag, you need a green I2c alarm.

Connect GPS and i2c mag wires to flexiPort set as I2c.
Disconnect all, add external power first and next connect usb.

malakym

  • *
  • 13
Re: Can't get data from Aux Mag
« Reply #8 on: March 01, 2016, 12:11:06 am »
I have GPS connected to Main, and is working. This uses VCC, GND, TX and RX.

I have MAG (in a combined GPS+MAG unit) connected via only SCL and SDA, there is no power lines on the board for this.

I power the revo up first via the flight battery before connecting to it.

f5soh

  • *****
  • 4572
    • LibrePilot
Re: Can't get data from Aux Mag
« Reply #9 on: March 01, 2016, 07:24:25 am »
Double check connections SCL to pin3 and SDA to pin4
Be sure the mag chip is powered.

malakym

  • *
  • 13
Re: Can't get data from Aux Mag
« Reply #10 on: March 01, 2016, 09:38:05 am »
They are the pins I have been using (other than swapping them a few times to try). I opened the casing to check on the PCB to confirm which ones are correct. I've also checked with a multimeter from the GPS+MAG board to behind the connector on the Revo and that is connected okay.

I'm not sure how I can check the mag chip, the GPS side light flashes on on power up but im not sure if there is a light for both or such - any suggestions on how to check?

malakym

  • *
  • 13
Re: Can't get data from Aux Mag
« Reply #11 on: March 02, 2016, 04:51:55 pm »
I've wired the MAG sensor up to a Raspberry PI, and with some basic scripting I can get the data from the sensor fine, so everything in the unit seems to be working okay.

f5soh

  • *****
  • 4572
    • LibrePilot
Re: Can't get data from Aux Mag
« Reply #12 on: March 02, 2016, 05:14:22 pm »
Try to redo config from scratch.
Upgrade&Erase and next, do wizard... just to start with something fresh.
You should at least get a green I2c alarm.

Re: Can't get data from Aux Mag
« Reply #13 on: March 02, 2016, 10:57:58 pm »
I2C being black is worrisome.  Maybe your Flexiport is broken.  For a test you could change to put GPS on Flexi.

...

To get aux mag working it really should be just setting Configuration -> Hardware -> Flexiport to I2C, setting AuxMagSettings.Type=Flexi, setting AuxMagSettings.Usage=AuxOnly, then highlight AuxMagSettings by clicking on it and press the red up arrow (Save) to make it permanent. Reboot the FC.  At that point, you should be able to see mag data in "Data Objects" -> AuxMagSensor.

Once you get I2C health green (mag should be red or orange or green) Then you need to run the mag sensor calibration.

malakym

  • *
  • 13
Re: Can't get data from Aux Mag
« Reply #14 on: March 02, 2016, 11:05:52 pm »
I have I2C as Orange now.
I have tested GPS on Flexi port previously that that works okay.
AuxMagSensor is all 0s and Status = None

I was about to reply to f5soh, this is what that was...

No luck with that, I still get Orange I2C and Black MAG.

This is what I did to be clear...

Upgrade & Erase

Setup Wizard
-Upgrade(/w Erase all settings)
-Board ID - automatic (USB Revolution, OpenPilot Revolution)
-Reboot Controller
-PWM
-Reboot
-Multirotor
-Quadcopter X
-Rapid ESC
-U-Blox Base + Magnetometer (SCL Blue, SDA White)
-Sensor-Calculate
-Connect flight battery
-Disconnect flight battery
-Output calibration
-Initial Tuning - DJI F450
-Save
-Reboot

-Disconnect USB
-Connect flight battery
-Connect USB

Set home location on map (incuding correct altitude)

SENSOR: Green
GPS: Red (waiting for fix)
I2C: Orange
MAG: Black

Set MagSensor.MetaData.Modes.(Update Period) to 1000ms
Set MagState.MetaData.Modes.(Update Period) to 1000ms


MagSensor data is showing results from onboard Mag.

MagStage.Source is Aux
I2CStats.last_error_type is EVENT (other items are 0s)

Settings.AuxMagSettings.Type is Flexi
Settings.AuxMagSettings.Usage is AuxOnly
Flexi port is I2C

Set RevoCalibration.FusionAlgorithm = Complementary+Mag
(I cant change Attitude > Settings > Attitude Estimation Algorithm to INS13 with the above)

Although the PCB is clearly marked SDA and SCL I flipped them just to be sure, although I confirmed them correct earlier today connected to the Pi.