Skip to content

Add support for CLKIN on modern gyros to improve flight performance. #13502

Closed
@hydra

Description

@hydra

Is your feature request related to a problem? Please describe

Gyros like the ICM-42688-P have a CLKIN signal which allows the FC to generate the clock signal.

TDK's datasheet for the ICM-42688-P says:

External clock input supports highly accurate clock input from 31kHz to 50kHz, resulting in improvement of the following:
a) ODR uncertainty due to process, temperature, operating mode (PLL vs. RCOSC), and design limitations. This uncertainty can be as high as ±8% in RCOSC mode and ±1% in PLL mode. The CLKIN, assuming a 50ppm or better 32.768kHz source, will improve the ODR accuracy from ±80,000ppm to ±50ppm in RCOSC mode, or from ±10,000ppm to ±50ppm in PLL mode.
b) System level sensitivity error. Any clock uncertainty directly impacts gyroscope sensitivity at the system level. Sophisticated systems can estimate ODR inaccuracy to some extent, but not to the extent improved by using CLKIN.
c) System-level clock/sensor synchronization. When using CLKIN, the accelerometer and gyroscope are on the same clock as the host. There is no need to continually re-synchronize the sensor data as the sensor sample points and period are known to be in exact alignment with the common system clock.
d) CLKIN helps EIS (Electronic Image Stabilization) performance by providing:

  • Very accurate gyroscope sample points for use during integration to find true angular displacement.
  • Automatic time alignment between the motion sensor and the host and potentially the camera system.
    e) Other applications that benefit from CLKIN include navigation, gaming, robotics.

https://invensense.tdk.com/download-pdf/icm-42688-p-datasheet/

Describe the solution you'd like

The CLKIN signal can be generated from a timer, STM's advanced control timers are better suited to this, e.g. TIM1/TIM8. TIM8 makes a great candidate on the H723/H730/H743/750.

Additionally, if the INT signal is also connected to another channel on the same advanced control timer, then it's possible to easily verify and monitor the gyro INT signal timing in relation to the clock signal.

For dual-gyro boards it's also possible to use all 4 channels of TIM8, 2 per gyro.

The SPRacingH7EF for example, is configured as follows:

MCU:
image

GYROS:
image
image

Describe alternatives you've considered

Not using CLKIN and having the system work from INT timings and guessing the gyro clock.

It's also possible to use a timer, + dma stream + gpio BSRR or ODR registers to generate a clock signal on an arbitrary GPIO pin, but this isn't as efficient as using a timer.

Other information

I have hardware available for testing if needed if anyone wants to work on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature RequestFeature requests are excluded from automatically being marked as stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions