Skip to content

Update to LSM6DSV16X gyro driver #13724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 27, 2024

Conversation

SteveCEvans
Copy link
Member

STMicro advised some changes to the driver to get the gyro LPF1 filtering working.

Tested on an AIRBOTSUPERF4 to the extent that the gyro and acceleromter respond. Correct operation of the filters will need flight testing.

Copy link

Do you want to test this code? You can flash it directly from Betaflight Configurator:

  • Simply put #13724 (this pull request number) in the Select commit field of the Configurator firmware flasher tab (you need to Enable expert mode, Show release candidates and Development).

WARNING: It may be unstable. Use only for testing!

Copy link
Member

@haslinghuis haslinghuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# tasks
Task list             rate/hz  max/us  avg/us maxload avgload  total/ms   late    run reqd/us
00 - (         SYSTEM)     10       1       0    0.0%    0.0%         0      0     26       0
01 - (         SYSTEM)    993       3       0    0.2%    0.0%        20      0   2523       1
02 - (           GYRO)   7616       2       1    1.5%    0.8%       525      0  19339       0
03 - (         FILTER)   7616      11       7    8.3%    5.4%      3245      0  19339       0
04 - (            PID)   7616      23      18   17.5%   13.7%      8428      0  19339       0
05 - (            ACC)    993       3       1    0.2%    0.0%        63      0   2523       2
06 - (       ATTITUDE)    100       6       3    0.0%    0.0%        21      0    253       5
07 - (             RX)     10      10       6    0.0%    0.0%        12      0     78      10
08 - (         SERIAL)    100    2055       0   20.5%    0.0%       157      0    252      44
09 - (       DISPATCH)    994       3       0    0.2%    0.0%        20      0   2523       1
10 - (BATTERY_VOLTAGE)     50       1       1    0.0%    0.0%         2      0    127       0
11 - (BATTERY_CURRENT)     50       1       0    0.0%    0.0%         0      0    127       1
12 - ( BATTERY_ALERTS)      5       1       0    0.0%    0.0%         0      0     13       1
13 - (         BEEPER)    100       1       0    0.0%    0.0%         2      0    252       1
16 - (           BARO)     20       5       1    0.0%    0.0%        10      0    306       3
17 - (       ALTITUDE)    100       1       1    0.0%    0.0%         5      0    252       1
19 - (            OSD)     12      23      15    0.0%    0.0%       137      0    510      23
21 - (            CMS)     20       1       0    0.0%    0.0%         0      0     51       0
22 - (        VTXCTRL)      5       1       0    0.0%    0.0%         0      0     12       0
23 - (        CAMCTRL)      5       1       0    0.0%    0.0%         0      0     12       1
25 - (    ADCINTERNAL)      1       1       0    0.0%    0.0%         0      0      3       1
27 - (SPEED_NEGOTIATION)    100       2       0    0.0%    0.0%         3      0    252       1
RX Check Function                   4       1                        26
Total (excluding SERIAL)                                19.9%

# status
MCU AT32F435 Clock=288MHz, Vref=3.30V, Core temp=37degC
Stack size: 2048, Stack address: 0x2002fff0
Configuration: CONFIGURED, size: 3529, max available: 16384
Devices detected: SPI:1, I2C:1
Gyros detected: gyro 1 locked dma
GYRO=LSM6DSV16X, ACC=LSM6DSV16X, BARO=DPS310
OSD: MAX7456 (30 x 13)
BUILD KEY: aa2e0ef6af1f9b849b2a1102a76c1685 (4.6.0-dev)
System Uptime: 69 seconds, Current Time: 2024-06-25T18:47:01.320+00:00
CPU:20%, cycle time: 132, GYRO rate: 7575, RX rate: 15, System rate: 9
Voltage: 3 * 0.01V (0S battery - NOT PRESENT)
I2C Errors: 0
FLASH: JEDEC ID=0x00ef4018 16M
GPS: NOT ENABLED
Arming disable flags: RXLOSS CLI MSP

@haslinghuis haslinghuis added this to the 4.6 milestone Jun 25, 2024
Copy link
Contributor

@ledvinap ledvinap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LSM6DSV_ENCODE_BITS is confusing when there is no difference between single and multi bit values.

Code needs testing after LSM6DSV_CTRL3_SW_RESET fix

@sugaarK
Copy link
Member

sugaarK commented Jun 27, 2024

I did some quick and dirty Floor testing.. so it's no props but I see very good things.

I got a difference in noise peek between old and new settings of 18db in scaled gyro and 10db in post

Screenshot 2024-06-27 at 6 11 21 pm Screenshot 2024-06-27 at 6 15 14 pm

Error in code from STMicro

Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
@haslinghuis haslinghuis merged commit a1e5292 into betaflight:master Jun 27, 2024
haslinghuis pushed a commit to haslinghuis/betaflight that referenced this pull request Jun 27, 2024
* Enable LPF1_G_EN

* Gyro intialisation review input from STMicro

* Update src/main/drivers/accgyro/accgyro_spi_lsm6dsv16x.c

Error in code from STMicro

Co-authored-by: Petr Ledvina <ledvinap@gmail.com>

---------

Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
@SteveCEvans
Copy link
Member Author

LSM6DSV_ENCODE_BITS is confusing when there is no difference between single and multi bit values.

Code needs testing after LSM6DSV_CTRL3_SW_RESET fix

Tested OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

5 participants