Add LSM6DSV16X/LSM6DSK320X support to LSM6DXX accgyro driver#11694
Merged
sensei-hacker merged 1 commit intoJul 7, 2026
Merged
Conversation
These chips reorganize CTRL1_XL/CTRL2_G to hold ODR + operating mode only (full scale moved to CTRL6_C/CTRL8_XL) with a different ODR bit encoding than the existing LSM6DSO/DSL/DS3 chips, so they get their own config sequence (lsm6dxxConfigGenV) via an early-return branch, leaving the legacy path untouched. Register values cross-checked against the ST datasheets and atbetaflight's hardware-validated accgyro_spi_lsm6dsv16x.c. Also wires DAKEFPVF405/target.h to the driver (shares CS/bus/alignment with the board's existing gyro options, per its manufacturer config), since it's the hardware testbed for this change. Hardware-validated on two physical DAKEFPVF405 units (one per chip): detection, at-rest/dynamic accel+gyro sanity, and CW90_DEG orientation sign all confirmed correct.
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds driver support for two IMU chips not previously recognized by INAV's
accgyro_lsm6dxx.c: LSM6DSV16X and LSM6DSK320X. These chips reorganizeCTRL1_XL/CTRL2_Gto hold ODR + operating mode only (full scale moved toCTRL6_C/CTRL8_XL) with a different ODR bit encoding than the existing LSM6DSO/DSL/DS3 chips this driver already supports, so they get their own configuration sequence (lsm6dxxConfigGenV()) reached via an early-return branch inlsm6dxxConfig(), gated onWHO_AM_I. The pre-existing legacy code path is untouched.Also wires
DAKEFPVF405/target.hto the driver (USE_IMU_LSM6DXX+ CS/bus/alignment, sharing the same physical pin as the board's existing gyro options per its manufacturer's public config), since that's the hardware testbed used to validate this change and its Betaflight-equivalent config lists both new chips as populated options.Changes
src/main/drivers/accgyro/accgyro_lsm6dxx.c/.h: newlsm6dxxConfigGenV()config path,WHO_AM_Idetection for the two new chip IDs (0x70,0x75), new register-value constants for the Gen V register layoutsrc/main/target/DAKEFPVF405/target.h: addsUSE_IMU_LSM6DXXalongside the board's existing gyro optionsTesting
accgyro_spi_lsm6dsv16x.creference driverBLUEBERRYF435WING), confirming no regression to already-shipped boardsGYRO=LSM6DXX, ACC=LSM6DXX, status OK)CW90_DEGboard-alignment orientation confirmed correct via physical roll and pitch tests (sign and magnitude both verified against the documented axis convention inimu.c)Design note: legacy chips are unaffected
Detection dispatches on an exact
WHO_AM_Ihardware match (a fixed silicon value, not something a legacy chip could produce), and the entire new config path is behind a single early return that's unreachable unlessWHO_AM_Ialready matched one of the two new chip IDs. The pre-existing legacy LSM6DSO/DSL/DS3 code path is verified byte-for-byte unmodified.Related Issues
N/A - proactively added driver support after finding these chips listed as gyro options in a target's manufacturer config with no existing INAV driver.