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

PX4 Pixhawk IMU via SPI.

Consists of two (internal) IMU's and one internal magneto. Also an optional external magneto. L3GD20 + LSM303D

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_px4fmu_v2.4">
b'<define name="IMU_PX4_DISABLE_MAG" value="FALSE" />\n '
b'<configure name="IMU_PX4FMU_SPI_DEV" value="spi1" />\n '
b'<configure name="IMU_L3G_SPI_SLAVE_IDX" value="SPI_SLAVE0" />\n '
b'<configure name="IMU_LSM_SPI_SLAVE_IDX" value="SPI_SLAVE1" />\n '
</module>

Module configuration options

Configure Options

  • name: IMU_PX4FMU_SPI_DEV value: spi1
    Description: SPI device to use
  • name: IMU_L3G_SPI_SLAVE_IDX value: SPI_SLAVE0
    Description: slave select pin for the L3GD20
  • name: IMU_LSM_SPI_SLAVE_IDX value: SPI_SLAVE1
    Description: slave select pin for the LSM303D

Define Options

  • name: IMU_PX4_DISABLE_MAG value: FALSE
    Description: define to TRUE to disable the mag on the Pixhawk

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_px4_periodic()
    • Running at maximum module frequency.
    • 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

<!DOCTYPE module SYSTEM "module.dtd">
<module name="imu_px4fmu_v2.4" dir="imu" task="sensors">
<doc>
<description>
PX4 Pixhawk IMU via SPI.
Consists of two (internal) IMU's and one internal magneto. Also an optional external magneto.
L3GD20 + LSM303D
</description>
<configure name="IMU_PX4FMU_SPI_DEV" value="spi1" description="SPI device to use"/>
<configure name="IMU_L3G_SPI_SLAVE_IDX" value="SPI_SLAVE0" description="slave select pin for the L3GD20"/>
<configure name="IMU_LSM_SPI_SLAVE_IDX" value="SPI_SLAVE1" description="slave select pin for the LSM303D"/>
<define name="IMU_PX4_DISABLE_MAG" value="FALSE" description="define to TRUE to disable the mag on the Pixhawk"/>
</doc>
<dep>
<depends>spi_master,i2c,imu_common</depends>
<provides>imu,mag</provides>
</dep>
<header>
<file name="imu_px4fmu_v2.4.h"/>
</header>
<init fun="imu_px4_init()"/>
<periodic fun="imu_px4_periodic()"/>
<event fun="imu_px4_event()"/>
<makefile target="!sim|nps|fbw">
<configure name="IMU_PX4FMU_SPI_DEV" default="spi1" case="lower|upper"/>
<define name="IMU_PX4FMU_SPI_DEV" value="$(IMU_PX4FMU_SPI_DEV_LOWER)"/>
<define name="USE_$(IMU_PX4FMU_SPI_DEV_UPPER)"/>
<!-- L3GD20 -->
<configure name="IMU_L3G_SPI_SLAVE_IDX" default="SPI_SLAVE0"/>
<define name="USE_$(IMU_L3G_SPI_SLAVE_IDX)"/>
<define name="IMU_L3G_SPI_SLAVE_IDX" value="$(IMU_L3G_SPI_SLAVE_IDX)"/>
<!-- LSM303d -->
<configure name="IMU_LSM_SPI_SLAVE_IDX" default="SPI_SLAVE1"/>
<define name="USE_$(IMU_LSM_SPI_SLAVE_IDX)"/>
<define name="IMU_LSM_SPI_SLAVE_IDX" value="$(IMU_LSM_SPI_SLAVE_IDX)"/>
<file name="l3gd20_spi.c" dir="peripherals"/>
<file name="lsm303d_spi.c" dir="peripherals"/>
<file name="hmc58xx.c" dir="peripherals"/>
<file name="imu_px4fmu_v2.4.c"/>
<test>
<define name="IMU_PX4FMU_SPI_DEV" value="spi1"/>
<define name="IMU_L3G_SPI_SLAVE_IDX" value="SPI_SLAVE0"/>
<define name="IMU_LSM_SPI_SLAVE_IDX" value="SPI_SLAVE1"/>
<define name="SPI_MASTER"/>
<define name="USE_SPI1"/>
<define name="USE_SPI_SLAVE0"/>
<define name="USE_SPI_SLAVE1"/>
<define name="USE_I2C2"/>
<define name="PERIODIC_FREQUENCY" value="512"/>
<define name="IMU_PX4_PERIODIC_FREQ" value="512"/>
</test>
</makefile>
</module>