EKF error

Hi, i just built my first quadcopter using a pixhawk clone (Hk pilot 32) and a external mounted compass/gps module. When flying the quadcopter, a low tone to high tone will play from the buzzer indicating a EKF failure. I will hear the warning every 30 seconds to every minute.

youtube.com/watch?v=BdMTtwmWbjo -Example of the noise

I usually fly in altitude hold mode using simple mode but after flying for a bit and hearing the EKF warning the orientation will change, the quadcopter’s forward direction will change. If i try to fly in position hold, the quad copter will start circling around the main spot i started the position hold mode. The circles will get bigger and bigger. Switching to stabilize mode then back to altitude hold mode will completely mess up the orientation. If i look at the radar on my transmitter (compass heading). It will be facing a completely different direction than the quad.

My quad has already crashed once because of this error and I lost a motor. Please help

What version of the ArduCopter firmware are you using?
Please provide a tlog and/or a dataflash log to help troubleshoot your issue.

I am using arducopter 3.2.1
Here is the dataflash log, I had about [attachment=0]51.BIN[/attachment]2 EKF failures.

Here is an Auto Analysis of your dataflash log:
Size (kb) 1105.517578125
No of lines 15098
Duration 0:01:08
Vehicletype ArduCopter
Firmware Version V3.2.1
Firmware Hash 36b405fb
Hardware Type
Free Mem 0
Skipped Lines 0

Test: Autotune = UNKNOWN - No ATUN log data
Test: Balance/Twist = GOOD -
Test: Brownout = GOOD -
Test: Compass = FAIL - FAIL: Large compass offset params (X:277.00, Y:421.00, Z:98.00)
FAIL: Large compass offset in MAG data (X:277.00, Y:421.00, Z:98.00)
Large change in mag_field (445.24%)
Min mag field length (115.81) < recommended (120.00)
Max mag field length (631.46) > recommended (550.00)

Test: Dupe Log Data = GOOD -
Test: Empty = GOOD -
Test: Event/Failsafe = GOOD -
Test: GPS = WARN - Min satellites: 7, Max HDop: 3.4
Test: IMU Mismatch = GOOD - (Mismatch: 0.37, WARN: 0.75, FAIL: 1.50)
Test: Parameters = GOOD -
Test: PM = WARN - 1 slow loop lines found, max 6.03% on line 1023
Test: Pitch/Roll = GOOD -
Test: Thrust = GOOD -
Test: VCC = GOOD -

Your IMUs are good to go, but your HDOP is very marginal and your compass performance is a mess and that may be causing the EKF issue.

Thanks! I’ll try to find a way to to fix it

I was also wondering if you would know what might be causing the compass errors, i do have the wires leading to the motors in a loop. Could it be magnetic interference or be caused by vibrations?