cleanflight / cleanflight

Clean-code version of the baseflight flight controller firmware
http://cleanflight.com
GNU General Public License v3.0
2.59k stars 1.39k forks source link

GPS - softserial communication timeouts #870

Closed James205mann closed 7 years ago

James205mann commented 9 years ago

Forgive me if I'm being a muppet but I've looked every where to Che k I'm not but haven't found a solution. I'm trying to connect a GPS to softserial 2 for osd use as I'm using a spectrum satellite on uart 2. This is a full naze32. The gui implies this will work which it does immediately after the GPS is configured on u-center. However after leaving it an hour or so it will no longer find any satellites. GPS passthrough in cli returns gibberish. It does not matter what baud rate I configure in u-center or cleanflight. It will work temporarily but only find 4 or 5 sats in cleanflight and then stop finding any. Works fine in just u-center. Any help much appriciated.

tricopterY commented 9 years ago

By definition SoftSerial is inefficient and should only be used for slow updates like Telemetry etc. I would only try to operate at 19200 Baud Rate. See, if that improves things for you. If you are not out in open space, you will not get a good fix/lock. Also, have your GPS module mounted away from any wiring or Carbon/Metal material. Normally, on a pedestal is the best. My two cents worth. ...BTW, if all fails test using your UART-2, just to establish some datum for comparison.

hydra commented 9 years ago

@James205mann please provide a configuration dump

James205mann commented 9 years ago

Thanks for the help.

@ tricopterY; Ive tried combinations of baudrates from 9600 to 19200 setting the same baudrate in u-center and cleanflight. No joy. I'm only hoping for the GPS info on my OSD so not worried about a higher than 9600 baudrate, but it would be nice.

@hydra;here is my entire dump, didn't want to miss something.

dump

version

Cleanflight/NAZE 1.8.1 Apr 2 2015 / 17:06:11 (988ae2d)

dump master

mixer

mixer TRI

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 VBAT feature RX_SERIAL feature MOTOR_STOP feature SOFTSERIAL feature GPS feature FAILSAFE feature ONESHOT125 feature BLACKBOX

map

map TAER1234

led

led 0 15,15:ES:IA:0 led 1 15,8:E:WF:0 led 2 15,7:E:WF:0 led 3 15,0:NE:IA:0 led 4 8,0:N:F:0 led 5 7,0:N:F:0 led 6 0,0:NW:IA:0 led 7 0,7:W:WF:0 led 8 0,8:W:WF:0 led 9 0,15:SW:IA:0 led 10 7,15:S:WF:0 led 11 8,15:S:WF:0 led 12 7,7:U:WF:0 led 13 8,7:U:WF:0 led 14 7,8:D:WF:0 led 15 8,8:D:WF:0 led 16 8,9::R:3 led 17 9,10::R:3 led 18 10,11::R:3 led 19 10,12::R:3 led 20 9,13::R:3 led 21 8,14::R:3 led 22 7,14::R:3 led 23 6,13::R:3 led 24 5,12::R:3 led 25 5,11::R:3 led 26 6,10::R:3 led 27 7,9::R:3 led 28 0,0:::0 led 29 0,0:::0 led 30 0,0:::0 led 31 0,0:::0

color

color 0 0,0,0 color 1 0,255,255 color 2 0,0,255 color 3 30,0,255 color 4 60,0,255 color 5 90,0,255 color 6 120,0,255 color 7 150,0,255 color 8 180,0,255 color 9 210,0,255 color 10 240,0,255 color 11 270,0,255 color 12 300,0,255 color 13 330,0,255 color 14 0,0,0 color 15 0,0,0

set looptime = 3500 set emf_avoidance = 0 set mid_rc = 1500 set min_check = 1100 set max_check = 1900 set rssi_channel = 0 set rssi_scale = 30 set input_filtering_mode = 0 set min_throttle = 1100 set max_throttle = 1850 set min_command = 1100 set servo_center_pulse = 1500 set 3d_deadband_low = 1406 set 3d_deadband_high = 1514 set 3d_neutral = 1460 set 3d_deadband_throttle = 50 set motor_pwm_rate = 400 set servo_pwm_rate = 50 set retarded_arm = 0 set disarm_kill_switch = 1 set auto_disarm_delay = 30 set small_angle = 25 set flaps_speed = 0 set fixedwing_althold_dir = 1 set serial_port_1_functions = 1 set serial_port_1_msp_baudrate = 5 set serial_port_1_telemetry_baudrate = 0 set serial_port_1_blackbox_baudrate = 5 set serial_port_1_gps_baudrate = 5 set serial_port_2_functions = 64 set serial_port_2_msp_baudrate = 5 set serial_port_2_telemetry_baudrate = 0 set serial_port_2_blackbox_baudrate = 5 set serial_port_2_gps_baudrate = 5 set serial_port_3_functions = 0 set serial_port_3_msp_baudrate = 5 set serial_port_3_telemetry_baudrate = 0 set serial_port_3_blackbox_baudrate = 5 set serial_port_3_gps_baudrate = 2 set serial_port_4_functions = 2 set serial_port_4_msp_baudrate = 5 set serial_port_4_telemetry_baudrate = 0 set serial_port_4_blackbox_baudrate = 5 set serial_port_4_gps_baudrate = 1 set reboot_character = 82 set gps_provider = 1 set gps_sbas_mode = 1 set gps_auto_config = 1 set gps_auto_baud = 0 set serialrx_provider = 1 set spektrum_sat_bind = 0 set telemetry_switch = 0 set telemetry_inversion = 0 set frsky_default_lattitude = 0.000 set frsky_default_longitude = 0.000 set frsky_coordinates_format = 0 set frsky_unit = 0 set frsky_vfas_precision = 0 set battery_capacity = 0 set vbat_scale = 110 set vbat_max_cell_voltage = 42 set vbat_min_cell_voltage = 33 set vbat_warning_cell_voltage = 33 set current_meter_scale = 1000 set current_meter_offset = 0 set multiwii_current_meter_output = 0 set current_meter_type = 1 set align_gyro = 0 set align_acc = 0 set align_mag = 0 set align_board_roll = 0 set align_board_pitch = 0 set align_board_yaw = 90 set max_angle_inclination = 500 set gyro_lpf = 42 set moron_threshold = 32 set gyro_cmpf_factor = 600 set gyro_cmpfm_factor = 250 set yaw_control_direction = 1 set pid_at_min_throttle = 1 set acc_hardware = 0 set mag_hardware = 0 set blackbox_rate_num = 1 set blackbox_rate_denom = 32 set blackbox_device = 1

dump profile

profile

profile 0

aux

aux 0 1 1 1300 2100 aux 1 2 1 900 1300 aux 2 3 1 1300 2100 aux 3 4 1 1725 2100 aux 4 10 1 1750 2100 aux 5 12 2 1750 2100 aux 6 20 0 1300 2100 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 aux 20 0 0 900 900 aux 21 0 0 900 900 aux 22 0 0 900 900 aux 23 0 0 900 900 aux 24 0 0 900 900 aux 25 0 0 900 900 aux 26 0 0 900 900 aux 27 0 0 900 900 aux 28 0 0 900 900 aux 29 0 0 900 900 aux 30 0 0 900 900 aux 31 0 0 900 900 aux 32 0 0 900 900 aux 33 0 0 900 900 aux 34 0 0 900 900 aux 35 0 0 900 900 aux 36 0 0 900 900 aux 37 0 0 900 900 aux 38 0 0 900 900 aux 39 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

servo

servo 0 1020 2000 1500 30 -1 servo 1 1020 2000 1500 30 -1 servo 2 1020 2000 1500 100 -1 servo 3 1020 2000 1500 100 -1 servo 4 1020 2000 1500 100 -1 servo 5 1020 2000 1500 100 -1 servo 6 1020 2000 1500 100 -1 servo 7 1020 2000 1500 100 -1

set gps_pos_p = 15 set gps_pos_i = 0 set gps_pos_d = 0 set gps_posr_p = 34 set gps_posr_i = 14 set gps_posr_d = 53 set gps_nav_p = 25 set gps_nav_i = 33 set gps_nav_d = 83 set gps_wp_radius = 200 set nav_controls_heading = 1 set nav_speed_min = 100 set nav_speed_max = 300 set nav_slew_rate = 30 set alt_hold_deadband = 40 set alt_hold_fast_change = 1 set deadband = 0 set yaw_deadband = 0 set throttle_correction_value = 0 set throttle_correction_angle = 800 set yaw_direction = 1 set tri_unarmed_servo = 1 set servo_lowpass_freq = 400 set servo_lowpass_enable = 0 set default_rate_profile = 0 set failsafe_delay = 10 set failsafe_off_delay = 200 set failsafe_throttle = 1400 set failsafe_min_usec = 985 set failsafe_max_usec = 2115 set gimbal_flags = 1 set acc_lpf_factor = 4 set accxy_deadband = 40 set accz_deadband = 40 set accz_lpf_cutoff = 5.000 set acc_unarmedcal = 1 set acc_trim_pitch = 0 set acc_trim_roll = 0 set baro_tab_size = 21 set baro_noise_lpf = 0.600 set baro_cf_vel = 0.985 set baro_cf_alt = 0.965 set mag_declination = -200 set pid_controller = 0 set p_pitch = 47 set i_pitch = 32 set d_pitch = 23 set p_roll = 45 set i_roll = 31 set d_roll = 23 set p_yaw = 47 set i_yaw = 31 set d_yaw = 23 set p_pitchf = 2.500 set i_pitchf = 0.600 set d_pitchf = 0.060 set p_rollf = 2.500 set i_rollf = 0.600 set d_rollf = 0.060 set p_yawf = 8.000 set i_yawf = 0.500 set d_yawf = 0.050 set level_horizon = 3.000 set level_angle = 5.000 set sensitivity_horizon = 75 set p_alt = 200 set i_alt = 100 set d_alt = 250 set p_level = 90 set i_level = 10 set d_level = 100 set p_vel = 120 set i_vel = 45 set d_vel = 1

dump rates

rateprofile

rateprofile 0

set rc_rate = 120 set rc_expo = 65 set thr_mid = 60 set thr_expo = 30 set roll_rate = 60 set pitch_rate = 60 set yaw_rate = 45 set tpa_rate = 50 set tpa_breakpoint = 1600

#

James205mann commented 9 years ago

Sorry for the delay in getting back, I have now tried this with a FrSky PPM receiver and the GPS on UART 2 with the same behavior. Re flashed Cleanflight but that had no effect. I have tried a GPS analyzer and don't appear to be getting interference from how my components are sited. My next step will be to try a new GPS module even though the module works fine in u-center. Am I missing something else that might resolve this? Thank you again.

tricopterY commented 9 years ago

How do you power your gear? (if Lipo only - do you have 12V LEDs attached) Does any component on the FC feel hot, when touched? (Lipo and USB) Have you tried UART-2 just to establish some datum for comparison? SoftSerial clock may drift over time!!! (Question for @hydra) I am wondering if it's power related (voltage regulation), rather than firmware. One hour is fairly long for some of these cheap components used on most clones etc.

James205mann commented 9 years ago

Hi tricopterY, I now have the GPS wire on uart 2 with a cppm receiver. No change in behaviour. I have a pdb with 5v and 12v bec, 5v powering the naze and the GPS powered from an unused motor output. No less and nothing is getting warm.

Sorry, a more accurate description of the problem is that the GPS works fine on u-center when connected via a uasp (the USB to 6 pin connector?) and it's still ok when I then solder it to the naze. I then take it outside and get a flight or two with GPS signal. That's also ok. But if I leave it off for an hour or so, no GPS. Connect it to u-center or cleanflight and I'll get another flight or two with GPS signal. As I said my next step is to try another GPS module in case that is corrupt.

tricopterY commented 9 years ago

@James205mann thanks for the info. If you have ESCs with BEC (not OPTO), try powering the GPS with one of those ESC-BEC.

James205mann commented 9 years ago

Sorry for the delay in getting back to you. I have been away and still waiting on a replacement GPS module.

My ESCs are all opto.

When I use the command gpspassthrough in CLI i get a string of non sensible data. I.E. not nmea sentences. Is this right? Sorry, ignore this, just realised its probably UBLOX binary

James205mann commented 9 years ago

I have tried this with a new GPS module, a ublox-m8, on uart 2 with the same issue as before.

I connect the GPS to u-center and configure it, connect to the tricopter and verify it is working on Cleanflight. Take it outside and it works fine. Try it again the next day and it no longer finds sats. I'm at work now but I will try a bit more later, although I am totally lost now.