iNavFlight / inav

INAV: Navigation-enabled flight control software
https://inavflight.github.io
GNU General Public License v3.0
3.07k stars 1.46k forks source link

No external mag detection on NAZE32 Rev6 7DOF #594

Closed jstremmler closed 7 years ago

jstremmler commented 7 years ago

When I install iNav 1.2.0 stable on a Naze Rev6 7DOF, ( e.g. this one: https://www.aliexpress.com/item/New-Arrival-REV6-NAZE32-7DF-Flight-Controller-For-RC-Multirotors-Baseflight-Configurator/32596170179.html?spm=2114.01010208.3.1.23mz9A&ws_ab_test=searchweb201556_0,searchweb201602_1_10065_10068_112_10069_110_111_10017_109_108_10060_10061_10062_10057_10056_10055_10037_10054_301_10033_10059_10032_10058_10073_10070_10052_10053_10050_10051,searchweb201603_3&btsid=a1c262fc-710c-4580-8969-2101bcbb86b0 ) which has a barometer BMP 280 but no magnetometer installed an external magnetometer sitting in my GPS is no longer recognized.

Is there any reason why the external mag is not shown anymore?

My own compiled NAZE.hex file (RC4) from 08.28.2016 shows my external magnetometer HMC5883 correctly.....

jflyper commented 7 years ago

497 !?

anbello commented 7 years ago

@jflyper now I have the pullups correctly done to 3V3, the pullups resistors are 4K62 and across SDA/SCL and 3V3 I measured 2K72

anbello commented 7 years ago

@jflyper ... and with this setup I have the internal mag (HMC5883) always detected

Ralf-W commented 7 years ago

@jflyper - Yes, I think, with #497 you found the key to close this issue! With my setup, "set mag_hardware = 0" does work (Naze Rev 6 with onboard Baro BMP280 plus Beitian BN880 GPS with HMC5883). With "set mag_hardware = 6", my compass is no longer recognized! With "set mag_hardware = 2", my compass is recognized again! Also, with "set mag_hardware = 0", my compass is recognized again!

jflyper commented 7 years ago

@anbello Cool, and thanks for reporting!

jflyper commented 7 years ago

@Snowboard-Nut Thanks for the re-measurement.

VCC > SCL = 5.78@20k scale VCC > SDA = 5.77@20k scale

This makes much more sense. It looks like pull-up for your MAG is around 15K.

VCC > SCL = .76@20k scale VCC > SDA = .76@20k scale

I still believe this is too strong, but since you have a working example, I will just shut up ;)

jflyper commented 7 years ago

@Ralf-W

With my setup, "set mag_hardware = 0" does work (Naze Rev 6 with onboard Baro BMP280 plus Beitian BN880 GPS with HMC5883). With "set mag_hardware = 6", my compass is no longer recognized! With "set mag_hardware = 2", my compass is recognized again! Also, with "set mag_hardware = 0", my compass is recognized again!

I think this is what has been intended with the PR, isn't it?

Snowboard-Nut commented 7 years ago

@jflyper

497 !?

Experimented with MAG_HARDWARE settings in multiple combinations before even posting on here. Sad to say it does not help my issue at all. I've been bouncing all over from 1.2rc2, 1.2rc3, 1.2release and the same problem is repeatable every time and clearly started with rc3 upwards.

jflyper commented 7 years ago

@Snowboard-Nut This is a hex for NAZE target at 00c9155, corresponding to #497. I really don't think this is the one, but we can at least semi-bisect the RC2~RC3 range.

http://pastebin.com/PsZhX0fB

Snowboard-Nut commented 7 years ago

Works fine. I performed several hard Resets and it continued to work. bmp280 and hmc5883 working 00c9155 baro4 mag0

Advise if you need other builds tested.

jflyper commented 7 years ago

@Snowboard-Nut

Bisecting ...

inav_1.2.0_NAZE_de24cd0.hex

@Everybody else

Sorry for cluttering.

Snowboard-Nut commented 7 years ago

Working fine. Once again I did several hard Resets and all looks good. bmp280 and hmc5883 working de24cd0 baro4 mag0

jflyper commented 7 years ago

@Snowboard-Nut

inav_1.2.0_NAZE_b91d37e.hex

Snowboard-Nut commented 7 years ago

@jflyper bmp280 and hmc5883 working b91d37e baro4 mag0

jflyper commented 7 years ago

@Snowboard-Nut

inav_1.2.0NAZE 7e8ef5d.hex

digitalentity commented 7 years ago

Thanks for trying to track this down!

Snowboard-Nut commented 7 years ago

@jflyper @digitalentity

Bingo! As soon as SET BARO_HARDWARE = 4 is set the HMC5883 vanishes... bmp280 and hmc5883 not working 7e8ef5d baro4 mag0

jflyper commented 7 years ago

@Snowboard-Nut

Help me pin point the precise location.

inav_1.2.0_NAZE_da48582.hex

Snowboard-Nut commented 7 years ago

@jflyper @digitalentity My pleasure to contribute to the project! HMC5883 vanishes as soon as BARO_HARDWARE = 4 is invoked. bmp280 and hmc5883 not working da48582 baro4 mag0

jflyper commented 7 years ago

@Snowboard-Nut

This should be the last one.

inav_1.2.0_NAZE_f15440e.hex

Snowboard-Nut commented 7 years ago

@jflyper Hold on. Disregard. flashed wrong firmware but on da48582 I am getting abnormal baro fluctuations: baro fluctuations

Snowboard-Nut commented 7 years ago

@jflyper Your f15440e.hex is actually da48582. Please check.

EDIT: the first copy of da48582 mag did not work. your hex labeled as f15440e actually shows as da48582 in CLI Version but it worked?! and the last one is where i noticed the above baro fluctuations. Screen shot of da48582 named as f15440e: bmp280 and hmc5883 working da48582 baro4 mag0

and here is the mislabeled version fully loaded with my CLI settings to check for other interactions: bmp280 and hmc5883 working da48582 baro4 mag0 fully loaded

jflyper commented 7 years ago

@Snowboard-Nut

Wow. Hang on ... How about this?

inav_1.2.0_NAZE_f15440e_revised.hex

Snowboard-Nut commented 7 years ago

@jflyper Flashed and first thing i did was CLI Version and it shows da48582, should I continue my tests?

jflyper commented 7 years ago

@Snowboard-Nut Deep apologies... Let me check what's going on on my side (will test the version with my naze).

Hmm... it boots with f15440e. Must be a stale copy buffer.

Okay, I confirmed it's f15440e with my naze.

inav_1.2.0_NAZE_f15440e_revised2.hex

Snowboard-Nut commented 7 years ago

@jflyper HMC5883 working with BMP280. Baro sensor graph shows expected fluctuations (+/- .5 ft). My complete CLI setup was imported and shows no other unexpected interactions. bmp280 and hmc5883 working f15440e_revised2 baro4 mag0 fully loaded

Great working with you, anything else you need feel free to ask anytime.

jflyper commented 7 years ago

@Snowboard-Nut Was my pleasure hunting with you.

@Folks So, it was hunted down to da48582 (#515). Only concern is that I had to tweak to build this one was to disable USE_FLASHFS and USE_FLASH_M25P16 to make some room (-4 bytes short!), but I don't think it matters.

Snowboard-Nut commented 7 years ago

@jflyper Correction- Baro sensor graph showed expected behavior at the time I posted the last message. After going back into the Baro sensor graph a couple minutes later I see this now: baro fluctuations

I am in a very controlled environment and this is most definitely abnormal behavior for the BMP280. Hmm

EDIT: And yet I go to the Baro sensor graph again after this last reply and now I see this which is normal for me... baro fluctuations

Snowboard-Nut commented 7 years ago

@jflyper I am definitely getting Baro fluctuations every so often of 10ft+ that are Definitely Not normal where I am testing at. Any thought on this? baro fluctuations

bk79 commented 7 years ago

Faulty sensor?

Snowboard-Nut commented 7 years ago

@bk79 @jflyper Definitely not faulty. Just flashed back to my trusty old 1.2rc2 and I have the baro behavior I've seen for months with previous iNav versions of about .25ft deviation. The last experimental build definitely has an influence on baro reading... I've been letting the graph run for several minutes on both versions and there is clearly a problem. Here is 1.2rc2 baro sensor graph just now: baro fluctuations

martinbudden commented 7 years ago

@Snowboard-Nut , presumably the experimental build did not have the baro fix I made. Are you getting baro problems with builds than include the baro fix?

Snowboard-Nut commented 7 years ago

@martinbudden Not sure when your fix was implemented, but 1.2rc2 and previous show a great graph but the last 2 experimentals have shown huge random fluctuations of over 10 feet. I am in a sealed house, no AC or Heat kicking on and off, and No Wind outside, girlfriend asleep, and no doors or windows open.... I am in very well known environment for baro testing.... Was your fix included in 1.2rc2? I have flown 1.2rc2 since it came out and have watched graphs several times and I never see a deviation greater that 1 foot in extreme wind, and .5 foot while general flying on a calm day.

jflyper commented 7 years ago

@martinbudden I think Snowboard-Nut is running f15440e (#517). Next patch da48582 (#515) introduces the BARO-MAG detect woes.

@Snowboard-Nut In your spare time, would you go back to experimental builds and find out when the fluctuation was introduced?

martinbudden commented 7 years ago

Well, I'm pretty sure the experimental builds didn't have the baro fix in them, so I'm not too worried about that. I've attached the latest build, can you test that for baro issues. And just for reference could you also do MAG test and show: tasks, bootlog, baro and mag hardware. Thanks. inav_1.2.1_NAZE.hex.zip

Snowboard-Nut commented 7 years ago

Interesting observation using the last experimantal by jflyper: If I simply flash and ONLY set BARO_HARDWARE=4 then the baro readings swing mildly acceptable of what I'm used to. But when I merge my CLI settings into it, much larger and aggressive deviation swings occur. Not sure if this is critical or not regarding the matter at hand.

@martinbudden Will test and report....

martinbudden commented 7 years ago

@jflyper , @Snowboard-Nut , thanks for doing the bisect to track this down. Trouble is that PR https://github.com/iNavFlight/inav/pull/515 is the one that checks for proper initialisation of the compass. So I'm going to have to read the spec sheet again and do some thinking before I can come up with a fix.

stronnag commented 7 years ago

What is in your settings that might affect this, for example loop time and gyro sync?

Snowboard-Nut commented 7 years ago

@stronnag Im wondering this same thing too. loop and gyro are default: `# mixer mixer CUSTOM mmix reset mmix 0 1.000 -1.000 0.765 -1.000 mmix 1 1.000 -1.000 -0.765 1.000 mmix 2 1.000 1.000 0.765 1.000 mmix 3 1.000 1.000 -0.765 -1.000 smix reset

feature

feature -RX_PPM feature -VBAT feature -INFLIGHT_ACC_CAL feature -RX_SERIAL feature -MOTOR_STOP feature -SERVO_TILT feature -SOFTSERIAL feature -GPS feature -FAILSAFE feature -SONAR feature -TELEMETRY feature -CURRENT_METER feature -3D feature -RX_PARALLEL_PWM feature -RX_MSP feature -RSSI_ADC feature -LED_STRIP feature -DISPLAY feature -ONESHOT125 feature -BLACKBOX feature -CHANNEL_FORWARDING feature -TRANSPONDER feature -AIRMODE feature -SUPEREXPO feature -VTX feature -RX_NRF24 feature -SOFTSPI feature RX_PPM feature VBAT feature MOTOR_STOP feature SOFTSERIAL feature GPS feature FAILSAFE feature TELEMETRY feature ONESHOT125

beeper

beeper GYRO_CALIBRATED beeper RX_LOST beeper RX_LOST_LANDING beeper DISARMING beeper ARMING beeper ARMING_GPS_FIX beeper BAT_CRIT_LOW beeper BAT_LOW beeper GPS_STATUS beeper RX_SET beeper ACC_CALIBRATION beeper ACC_CALIBRATION_FAIL beeper READY_BEEP beeper MULTI_BEEPS beeper DISARM_REPEAT beeper ARMED beeper SYSTEM_INIT beeper ON_USB

map

map AETR1234

serial

serial 0 1 115200 38400 0 115200 serial 1 2 115200 115200 0 115200 serial 30 4 115200 38400 19200 115200 serial 31 1 19200 38400 0 115200

set looptime = 2000 set i2c_overclock = OFF set gyro_sync = OFF set gyro_sync_denom = 2 set mid_rc = 1500 set min_check = 1100 set max_check = 1900 set rssi_channel = 8 set rssi_scale = 30 set rssi_ppm_invert = OFF set rc_smoothing = ON set input_filtering_mode = OFF set min_throttle = 1150 set max_throttle = 1850 set min_command = 1000 set servo_center_pulse = 1500 set 3d_deadband_low = 1406 set 3d_deadband_high = 1514 set 3d_neutral = 1460 set 3d_deadband_throttle = 1000 set motor_pwm_rate = 400 set servo_pwm_rate = 50 set disarm_kill_switch = OFF set auto_disarm_delay = 5 set small_angle = 25 set reboot_character = 82 set gps_provider = UBLOX set gps_sbas_mode = AUTO set gps_dyn_model = AIR_1G set gps_auto_config = ON set gps_auto_baud = ON set inav_accz_unarmedcal = ON set inav_use_gps_velned = ON set inav_gps_delay = 200 set inav_gps_min_sats = 6 set inav_w_z_baro_p = 0.350 set inav_w_z_gps_p = 0.200 set inav_w_z_gps_v = 0.500 set inav_w_xy_gps_p = 1.000 set inav_w_xy_gps_v = 2.000 set inav_w_z_res_v = 0.500 set inav_w_xy_res_v = 0.500 set inav_w_acc_bias = 0.010 set inav_max_eph_epv = 1000.000 set inav_baro_epv = 100.000 set nav_disarm_on_landing = OFF set nav_use_midthr_for_althold = OFF set nav_extra_arming_safety = ON set nav_user_control_mode = CRUISE set nav_position_timeout = 5 set nav_wp_radius = 100 set nav_max_speed = 450 set nav_max_climb_rate = 140 set nav_manual_speed = 500 set nav_manual_climb_rate = 200 set nav_landing_speed = 200 set nav_land_slowdown_minalt = 500 set nav_land_slowdown_maxalt = 2000 set nav_emerg_landing_speed = 500 set nav_min_rth_distance = 500 set nav_rth_tail_first = OFF set nav_rth_alt_mode = CURRENT set nav_rth_altitude = 1000 set nav_mc_bank_angle = 30 set nav_mc_hover_thr = 1500 set nav_mc_auto_disarm_delay = 2000 set nav_fw_cruise_thr = 1400 set nav_fw_min_thr = 1200 set nav_fw_max_thr = 1700 set nav_fw_bank_angle = 20 set nav_fw_climb_angle = 20 set nav_fw_dive_angle = 15 set nav_fw_pitch2thr = 10 set nav_fw_roll2pitch = 75 set nav_fw_loiter_radius = 5000 set serialrx_provider = SPEK1024 set spektrum_sat_bind = 0 set telemetry_switch = OFF set telemetry_inversion = ON set frsky_default_lattitude = 0.000 set frsky_default_longitude = 0.000 set frsky_coordinates_format = 0 set frsky_unit = IMPERIAL set frsky_vfas_precision = 0 set hott_alarm_sound_interval = 5 set battery_capacity = 0 set vbat_scale = 110 set vbat_max_cell_voltage = 43 set vbat_min_cell_voltage = 33 set vbat_warning_cell_voltage = 35 set current_meter_scale = 400 set current_meter_offset = 0 set multiwii_current_meter_output = OFF set current_meter_type = ADC set align_gyro = DEFAULT set align_acc = DEFAULT set align_mag = CW270FLIP set align_board_roll = 0 set align_board_pitch = 0 set align_board_yaw = 0 set gyro_lpf = 42HZ set moron_threshold = 32 set imu_dcm_kp = 2500 set imu_dcm_ki = 50 set imu_dcm_kp_mag = 10000 set imu_dcm_ki_mag = 0 set pos_hold_deadband = 20 set alt_hold_deadband = 75 set yaw_motor_direction = 1 set yaw_jump_prevention_limit = 200 set tri_unarmed_servo = ON set servo_lowpass_freq = 400 set servo_lowpass_enable = OFF set failsafe_delay = 10 set failsafe_off_delay = 200 set failsafe_throttle = 1000 set failsafe_kill_switch = OFF set failsafe_throttle_low_delay = 100 set failsafe_procedure = RTH set rx_min_usec = 885 set rx_max_usec = 2115 set acc_hardware = 0 set baro_use_median_filter = ON set baro_hardware = 4 set mag_hardware = 0 set blackbox_rate_num = 1 set blackbox_rate_denom = 1 set blackbox_device = SERIAL set magzero_x = 6 set magzero_y = -68 set magzero_z = 539 set acczero_x = 15 set acczero_y = 36 set acczero_z = -167 set accgain_x = 4080 set accgain_y = 4063 set accgain_z = 4062

rxfail

rxfail 0 a rxfail 1 a rxfail 2 a rxfail 3 h rxfail 4 h rxfail 5 h rxfail 6 h rxfail 7 h rxfail 8 h rxfail 9 h rxfail 10 h rxfail 11 h rxfail 12 h rxfail 13 h rxfail 14 h rxfail 15 h rxfail 16 h rxfail 17 h

dump profile

profile

profile 0

aux

aux 0 0 0 1500 2100 aux 1 1 1 900 2100 aux 2 3 1 1300 1650 aux 3 10 1 1300 1650 aux 4 24 1 1650 2100 aux 5 23 2 1500 2100 aux 6 0 0 900 900 aux 7 0 0 900 900 aux 8 0 0 900 900 aux 9 0 0 900 900 aux 10 0 0 900 900 aux 11 0 0 900 900 aux 12 0 0 900 900 aux 13 0 0 900 900 aux 14 0 0 900 900 aux 15 0 0 900 900 aux 16 0 0 900 900 aux 17 0 0 900 900 aux 18 0 0 900 900 aux 19 0 0 900 900

adjrange

adjrange 0 0 0 900 900 0 0 adjrange 1 0 0 900 900 0 0 adjrange 2 0 0 900 900 0 0 adjrange 3 0 0 900 900 0 0 adjrange 4 0 0 900 900 0 0 adjrange 5 0 0 900 900 0 0 adjrange 6 0 0 900 900 0 0 adjrange 7 0 0 900 900 0 0 adjrange 8 0 0 900 900 0 0 adjrange 9 0 0 900 900 0 0 adjrange 10 0 0 900 900 0 0 adjrange 11 0 0 900 900 0 0

rxrange

rxrange 0 1000 2000 rxrange 1 1000 2000 rxrange 2 1000 2000 rxrange 3 1000 2000

servo

servo 0 1000 2000 1500 90 90 100 -1 servo 1 1000 2000 1500 90 90 100 -1 servo 2 1000 2000 1500 90 90 100 -1 servo 3 1000 2000 1500 90 90 100 -1 servo 4 1000 2000 1500 90 90 100 -1 servo 5 1000 2000 1500 90 90 100 -1 servo 6 1000 2000 1500 90 90 100 -1 servo 7 1000 2000 1500 90 90 100 -1

set nav_alt_p = 50 set nav_alt_i = 0 set nav_alt_d = 0 set nav_vel_p = 100 set nav_vel_i = 50 set nav_vel_d = 10 set nav_pos_p = 65 set nav_pos_i = 120 set nav_pos_d = 10 set nav_posr_p = 180 set nav_posr_i = 15 set nav_posr_d = 100 set nav_navr_p = 10 set nav_navr_i = 5 set nav_navr_d = 8 set deadband = 5 set yaw_deadband = 5 set throttle_tilt_comp_str = 0 set flaperon_throw_offset = 250 set flaperon_throw_inverted = OFF set mode_range_logic_operator = OR set default_rate_profile = 0 set gimbal_mode = NORMAL set mag_declination = 140 set mag_hold_rate_limit = 40 set p_pitch = 36 set i_pitch = 26 set d_pitch = 23 set p_roll = 36 set i_roll = 26 set d_roll = 23 set p_yaw = 85 set i_yaw = 45 set d_yaw = 0 set p_level = 20 set i_level = 15 set d_level = 75 set max_angle_inclination_rll = 300 set max_angle_inclination_pit = 300 set gyro_soft_lpf_hz = 60 set acc_soft_lpf_hz = 15 set dterm_lpf_hz = 40 set yaw_lpf_hz = 30 set yaw_p_limit = 300 set iterm_ignore_threshold = 200 set yaw_iterm_ignore_threshold = 50 set rate_accel_limit_roll_pitch = 0 set rate_accel_limit_yaw = 10000

dump rates

rateprofile

rateprofile 0

set rc_expo = 70 set rc_yaw_expo = 20 set thr_mid = 50 set thr_expo = 65 set roll_rate = 20 set pitch_rate = 20 set yaw_rate = 20 set tpa_rate = 0 set tpa_breakpoint = 1500 `

Snowboard-Nut commented 7 years ago

@martinbudden Here is the data you requested. I flashed your firmware and simply SET BARO_HARDWARE = 4 and then derived these results (baro results are what I expect and am used to seeing): martinbudden experimental mag baro graph with no cli merge

version

INAV/NAZE 1.2.1 Sep 19 2016 / 09:12:26 (8b895b2)

tasks

Task list rate/hz max/us avg/us maxload avgload total/ms 0 - SYSTEM 9 6 0 0.5% 0.5% 15 1 - GYRO/PID 498 1335 1187 66.9% 59.6% 219135 2 - SERIAL 100 615 2 6.6% 0.5% 589 3 - BEEPER 98 9 0 0.5% 0.5% 61 4 - BATTERY 49 19 0 0.5% 0.5% 160 5 - RX 49 172 141 1.3% 1.1% 3058 7 - COMPASS 9 229 198 0.7% 0.6% 831 8 - BARO 41 230 135 1.4% 1.0% 2323 Total (excluding SERIAL) 71.8% 63.8%

bootlog

Time Evt Parameters 0: 0 0: 1 500: 19 (0, 0, 0, 0) 500: 19 (1, 1, 0, 2) 500: 19 (2, 2, 0, 2) 500: 19 (3, 3, 0, 2) 500: 19 (4, 4, 0, 2) 500: 19 (5, 5, 0, 2) 500: 19 (6, 6, 0, 2) 500: 18 (7, 6, 0, 1) 500: 18 (8, 6, 0, 1) 500: 18 (9, 6, 0, 1) 500: 18 (10, 6, 0, 1) 500: 2 636: 9 (2, 0, 0, 0) 752: 10 (3, 0, 0, 0) 773: 11 (4, 0, 0, 0) 774: 12 (2, 0, 0, 0) 2432: 13 (0, 0, 0, 0) 2432: 4 2933: 8

get baro_hardware

baro_hardware = 4 Allowed range: 0 - 5

get mag_hardware

mag_hardware = 0 Allowed range: 0 - 7

Snowboard-Nut commented 7 years ago

@martinbudden This after I merge my CLI settings into your build. The CLI basically just enables GPS, FrSky Inverted Telem, Softserial. Baro reading definitely goes into fluctuation again with a massive 10ft+ swing on the baro: martinbudden experimental mag baro graph with cli merge

INAV/NAZE 1.2.1 Sep 19 2016 / 09:12:26 (8b895b2)

tasks

Task list rate/hz max/us avg/us maxload avgload total/ms 0 - SYSTEM 9 11 0 0.5% 0.5% 8 1 - GYRO/PID 499 1538 1366 77.2% 68.6% 117358 2 - SERIAL 98 910 2 9.4% 0.5% 382 3 - BEEPER 99 9 0 0.5% 0.5% 29 4 - BATTERY 49 22 0 0.6% 0.5% 77 5 - RX 49 192 161 1.4% 1.2% 1573 6 - GPS 24 473 76 1.6% 0.6% 416 7 - COMPASS 9 232 201 0.7% 0.6% 388 8 - BARO 41 232 137 1.4% 1.0% 1085 10 - TELEMETRY 249 129 3 3.7% 0.5% 212 Total (excluding SERIAL) 87.6% 74.0%

bootlog

Time Evt Parameters 0: 0 0: 1 500: 19 (0, 0, 0, 0) 500: 19 (1, 1, 0, 2) 500: 19 (2, 2, 0, 2) 500: 19 (3, 3, 0, 2) 500: 19 (4, 4, 0, 2) 500: 19 (5, 5, 0, 2) 500: 19 (6, 6, 0, 2) 500: 18 (7, 6, 0, 3) 500: 18 (8, 6, 0, 3) 500: 18 (9, 6, 0, 3) 500: 18 (10, 6, 0, 3) 500: 2 636: 9 (2, 0, 0, 0) 752: 10 (3, 0, 0, 0) 773: 11 (4, 0, 0, 0) 774: 12 (2, 0, 0, 0) 2432: 13 (0, 0, 0, 0) 2432: 4 2983: 5 3033: 7 3033: 8

get baro_hardware

baro_hardware = 4 Allowed range: 0 - 5

get mag_hardware

mag_hardware = 0 Allowed range: 0 - 7

Snowboard-Nut commented 7 years ago

Does this have anything to do with the high refresh rate of the BMP280? For example, when my CLI merge activates softserial, GPS, and Telem perhaps the baro filter is impacted from lack of processing power?

martinbudden commented 7 years ago

It could be a processing power issue. What do you have attached to softserial, and what happens when you switch off softserial?

Snowboard-Nut commented 7 years ago

@martinbudden softserial is FrSky Inverted Telem @ 19.2 and Bluetooth MSP @ 19.2

Neither of which is active NOR POWERED while doing all this testing via USB hard line to Naze. Do you feel it's worth trying to disable just softserial considering it's not being utilized during this testing session?

martinbudden commented 7 years ago

I think it's worth disabling it, just to see if it makes a difference. Just to get as much data about the problem as possible.

Snowboard-Nut commented 7 years ago

@martinbudden This baro graph is with softserial disabled. The graph has smoothed somewhat without a massive 10ft+ swing, but still very notchy and not near as smooth as the first graph I posted before my CLI merge, It would seem to me that by disabling softserial that it lowered CPU cycles slighty which in return slightly improved the baro response to a smoother curve with less aggressive random swings but it still is nowhere near as smooth a curve as the first sample graph I showed you that was after I simply flashed your build and SET BARO_HARDWARE = 4. martinbudden experimental mag baro graph with cli merge softserial disabled

In my mind(pure sleep-deprived delirious speculation) , it seems the STM32 is being taxed too hard after such things as softserial, gps, telem, oneshot are enabled and therefore starving the baro filtering. But I also think the high refresh rate of the BMP280 is absorbing more precious cycles then needed..... after all just look at the baro refresh rate versus the oh-so critical gyro refresh rate....

jflyper commented 7 years ago

@martinbudden @digitalentity Have you took a look at this? cleanflight/cleanflight:#2310

Aren't I2CErrors values we are looking at in above screen shots only reflects fatal bus errors that needs bus banging and restarting, and not counting minor errors such as slave addressing NAKs?

giacomo892 commented 7 years ago

I can confirm that my HMC5883 on NAZE target is detected and used for some minutes and then it is simply detached without any error.

jflyper commented 7 years ago

@giacomo892 Can you elaborate how it is "detached"? No more movements in 3D model, absence in cli status, that kind of thing.

giacomo892 commented 7 years ago

@jflyper Sure! I startup my "custom made" Naze board with MPU6050+BMP180+HMC5883L connected the same I2C bus (there is no difference if I attach the mag to the auxiliary I2C bus pins of the MPU6050 since they are configured in bypass mode. ).

What happens is that sometimes after some time the MAG green light in the configurator shutoff and I suppose that from that time the heading is only calculated based on the gyro readings.

The heading still precise (and poiting the right direction since it had the mag reference before) for some time but then start to drift as expected.

ps: does someone even considered to use the MPU6050 secondary bus the let MPU6050 reading the mag? It worked much better than directly connecting the mag the main i2c bus