-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Allow overriding the spi clock speed for icm42688 #13346
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
Conversation
Do you want to test this code? You can flash it directly from Betaflight Configurator:
WARNING: It may be unstable. Use only for testing! |
There was a report of glitches on the raw gyro output of an icm42688 which were resolved by reducing the the SPI clock speed. I don't think a single report justifies changing the default speed or even adding a CLI command to make it configurable, but it's relatively low impact to allow the speed to be set at compile time by passing the value via EXTRA_FLAGS and this will make it easier to see if changing the speed solves any future cases that might turn up. Passing the original macro name caused the cloud builds to fail, so this PR introduces a new, shorter macro for setting the override value; ICM426XX_CLOCK When passing a value for a macro through EXTRA_FLAGS for a manual compile we need to use single quotes, e.g. to set 12MHz we could use -D'ICM426XX_CLOCK=12000000' When using the configurator to start a cloud build the value can be placed in the "Custom Defines" text box as ICM426XX_CLOCK=12000000 (or whatever value is desired)
d006d73
to
4f154eb
Compare
Thanks, James. |
Hi Chris, |
approving for it's simplicity and non-effect strategy. |
There was a report of glitches on the raw gyro output of an icm42688 which were resolved by reducing the the SPI clock speed. I don't think a single report justifies changing the default speed or even adding a CLI command to make it configurable, but it's relatively low impact to allow the speed to be set at compile time by passing the value via EXTRA_FLAGS and this will make it easier to see if changing the speed solves any future cases that might turn up.
(The first attempt at this PR used the existing macro name ICM426XX_MAX_SPI_CLK_HZ to set the override value, however this can't be passed to the cloud build via the configurator, so the PR was changed to introduce a new, simpler name to provide the override value, ICM426XX_CLOCK)
When passing a value for a macro through EXTRA_FLAGS we need to use single quotes, e.g. to set 12MHz we could use
-D'ICM426XX_CLOCK=12000000'
When using the configurator to start a cloud build the value can be placed in the "Custom Defines" text box as
ICM426XX_CLOCK=12000000
(or whatever value is desired)
Thread discussing (in part) the problem:
https://discord.com/channels/868013470023548938/1202941174177079336
Image showing a glitch:
https://cdn.discordapp.com/attachments/1202941174177079336/1203147744370495558/image.png?ex=65d009a7&is=65bd94a7&hm=12c936b068c6d6852e1239107d7b827a487461c25f2fdd35ccd159cd437d6e6e&