Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
imu_icm42688 module

Driver module for the Invensense v3 IMU ICM42688.

No detailed description...

Example for airframe file

Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!

<module name="imu_icm42688">
b'<configure name="IMU_SPI_DEV" value="spi1" />\n '
b'<configure name="IMU_SPI_SLAVE_IDX" value="SPI_SLAVE0" />\n '
b'<configure name="IMU_ODR" default="4KHZ" />\n '
b'<configure name="GYRO_RANGE" default="500DPS" />\n '
b'<configure name="ACCEL_RANGE" default="2G" />\n '
b'<configure name="GYRO_AAF" value="977" />\n '
b'<configure name="ACCEL_AAF" value="213" />\n '
</module>

Module configuration options

Configure Options

  • name: IMU_SPI_DEV value: spi1
    Description: SPI device to use for ICM42688
  • name: IMU_SPI_SLAVE_IDX value: SPI_SLAVE0
    Description: Slave index of the IMU AP_CS pin (12)
  • name: IMU_ODR value: None
    Description: Output data rate of ACCEL and GYRO (invensense3.h:95/126)
  • name: GYRO_RANGE value: None
    Description: Gyro range (invensense3.h:114)
  • name: ACCEL_RANGE value: None
    Description: Accel range (invensense3.h:145)
  • name: GYRO_AAF value: 977
    Description: Gyro anti-aliasing filter
  • name: ACCEL_AAF value: 213
    Description: Accel anti-aliasing filter

Module functions

Init Functions

These initialization functions are called once on startup.

Event Functions

These event functions are called in each cycle of the module event loop.

Periodic Functions

These functions are called periodically at the specified frequency from the module periodic loop.

  • imu_icm42688_periodic()
    • Frequency in Hz: 1000
    • Autorun: LOCK
      Periodic function automatically starts after init and can't be stopped.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw imu_icm42688.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="imu_icm42688" dir="imu" task="sensors">
<doc>
<description>
Driver module for the Invensense v3 IMU ICM42688.
</description>
<configure name="IMU_SPI_DEV" value="spi1" description="SPI device to use for ICM42688"/>
<configure name="IMU_SPI_SLAVE_IDX" value="SPI_SLAVE0" description="Slave index of the IMU AP_CS pin (12)"/>
<configure name="IMU_ODR" default="4KHZ" description="Output data rate of ACCEL and GYRO (invensense3.h:95/126)"/>
<configure name="GYRO_RANGE" default="500DPS" description="Gyro range (invensense3.h:114)"/>
<configure name="ACCEL_RANGE" default="2G" description="Accel range (invensense3.h:145)"/>
<configure name="GYRO_AAF" value="977" description="Gyro anti-aliasing filter"/>
<configure name="ACCEL_AAF" value="213" description="Accel anti-aliasing filter"/>
</doc>
<dep>
<depends>i2c,spi_master,imu_common</depends>
<provides>imu</provides>
</dep>
<header>
<file name="imu_icm42688.h"/>
</header>
<init fun="imu_icm42688_init()"/>
<periodic fun="imu_icm42688_periodic()" freq="1000"/>
<event fun="imu_icm42688_event()"/>
<makefile target="!sim|nps|fbw">
<configure name="IMU_SPI_DEV" default="spi1" case="lower|upper"/>
<configure name="IMU_SPI_SLAVE_IDX" default="SPI_SLAVE0"/>
<configure name="IMU_ODR" default="4KHZ"/>
<configure name="GYRO_RANGE" default="2000DPS"/>
<configure name="ACCEL_RANGE" default="8G"/>
<configure name="GYRO_AAF" default="977"/>
<configure name="ACCEL_AAF" default="213"/>
<define name="IMU_SPI_DEV" value="$(IMU_SPI_DEV_LOWER)"/>
<define name="USE_$(IMU_SPI_DEV_UPPER)"/>
<define name="IMU_SPI_SLAVE_IDX" value="$(IMU_SPI_SLAVE_IDX)"/>
<define name="USE_$(IMU_SPI_SLAVE_IDX)"/>
<define name="INVENSENSE3_GYRO_ODR" value="INVENSENSE3_GYRO_ODR_$(IMU_ODR)"/>
<define name="INVENSENSE3_ACCEL_ODR" value="INVENSENSE3_ACCEL_ODR_$(IMU_ODR)"/>
<define name="INVENSENSE3_GYRO_RANGE" value="INVENSENSE3_GYRO_RANGE_$(GYRO_RANGE)"/>
<define name="INVENSENSE3_ACCEL_RANGE" value="INVENSENSE3_ACCEL_RANGE_$(ACCEL_RANGE)"/>
<define name="INVENSENSE3_GYRO_AAF" value="$(GYRO_AAF)"/>
<define name="INVENSENSE3_ACCEL_AAF" value="$(ACCEL_AAF)"/>
<file name="invensense3.c" dir="peripherals"/>
<file name="imu_icm42688.c"/>
</makefile>
</module>