From 32bcbdf81335eb4bae34831d10aa3031f3347806 Mon Sep 17 00:00:00 2001 From: Tero Salminen Date: Tue, 27 Feb 2024 09:43:22 +0200 Subject: [PATCH] airspeed sensors: set I2C default clock to 400kHz MS4525DO and SDP3X sensors I2C default speed adjusted 100kHz -> 400kHz. Polarfire does not support 100kHz I2C clock frequency. Related sensor start workaround removed from airframes 4420, 4421 and 4430. Sensors are started in rc.sensors when parameters SENS_EN_MS4525DO and SENS_EN_SDP3X are defined. Signed-off-by: Tero Salminen --- ROMFS/px4fmu_common/init.d/airframes/4420_ssrc_arwing | 4 +++- ROMFS/px4fmu_common/init.d/airframes/4421_ssrc_skywalker | 1 - ROMFS/px4fmu_common/init.d/airframes/4430_ssrc_strivermini | 4 ++-- src/drivers/differential_pressure/ms4525do/MS4525DO.hpp | 2 +- src/drivers/differential_pressure/sdp3x/SDP3X.hpp | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/airframes/4420_ssrc_arwing b/ROMFS/px4fmu_common/init.d/airframes/4420_ssrc_arwing index fc593aed3b5b..1c2874466225 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4420_ssrc_arwing +++ b/ROMFS/px4fmu_common/init.d/airframes/4420_ssrc_arwing @@ -32,8 +32,10 @@ param set-default PWM_AUX_FUNC4 101 param set-default PWM_MAIN_REV 2 param set-default PWM_AUX_REV 2 +# Enable airspeed sensor +param set-default SENS_EN_SDP3X 1 + # Airspeed parameters -sdp3x start -X -f 400 param set-default ASPD_DO_CHECKS 15 param set-default FW_AIRSPD_MAX 22.0 param set-default FW_AIRSPD_MIN 14.0 diff --git a/ROMFS/px4fmu_common/init.d/airframes/4421_ssrc_skywalker b/ROMFS/px4fmu_common/init.d/airframes/4421_ssrc_skywalker index 46a6e03e2ff2..8e6358b641bc 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4421_ssrc_skywalker +++ b/ROMFS/px4fmu_common/init.d/airframes/4421_ssrc_skywalker @@ -23,7 +23,6 @@ param set-default PWM_MAIN_FUNC2 202 param set-default PWM_MAIN_FUNC4 101 # Airspeed parameters -ms4525do start -X -f 500 param set-default SENS_EN_MS4525DO 1 param set-default ASPD_DO_CHECKS 15 param set-default FW_AIRSPD_MAX 25.0 diff --git a/ROMFS/px4fmu_common/init.d/airframes/4430_ssrc_strivermini b/ROMFS/px4fmu_common/init.d/airframes/4430_ssrc_strivermini index ff454fcec4c8..cb6089a160dd 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4430_ssrc_strivermini +++ b/ROMFS/px4fmu_common/init.d/airframes/4430_ssrc_strivermini @@ -71,8 +71,8 @@ param set-default PWM_AUX_FUNC5 205 param set-default PWM_AUX_FUNC6 105 # Start airspeed sensor driver -ms4525do start -X -f 500 -sdp3x start -X -f 500 +param set-default SENS_EN_MS4525DO 1 +param set-default SENS_EN_SDP3X 1 # Airspeed parameters param set-default ASPD_DO_CHECKS 7 diff --git a/src/drivers/differential_pressure/ms4525do/MS4525DO.hpp b/src/drivers/differential_pressure/ms4525do/MS4525DO.hpp index b98483d2f141..61b74b810455 100644 --- a/src/drivers/differential_pressure/ms4525do/MS4525DO.hpp +++ b/src/drivers/differential_pressure/ms4525do/MS4525DO.hpp @@ -53,7 +53,7 @@ #include #include -static constexpr uint32_t I2C_SPEED = 100 * 1000; // 100 kHz I2C serial interface +static constexpr uint32_t I2C_SPEED = 400 * 1000; // 400 kHz I2C serial interface static constexpr uint8_t I2C_ADDRESS_DEFAULT = 0x28; /* Register address */ diff --git a/src/drivers/differential_pressure/sdp3x/SDP3X.hpp b/src/drivers/differential_pressure/sdp3x/SDP3X.hpp index d9c89c5821e6..8c87c2e83c3b 100644 --- a/src/drivers/differential_pressure/sdp3x/SDP3X.hpp +++ b/src/drivers/differential_pressure/sdp3x/SDP3X.hpp @@ -51,7 +51,7 @@ #define I2C_ADDRESS_2_SDP3X 0x22 #define I2C_ADDRESS_3_SDP3X 0x23 -static constexpr uint32_t I2C_SPEED = 100 * 1000; // 100 kHz I2C serial interface +static constexpr uint32_t I2C_SPEED = 400 * 1000; // 400 kHz I2C serial interface #define SDP3X_SCALE_TEMPERATURE 200.0f #define SDP3X_RESET_ADDR 0x00