Atmel Software Framework

imu3000.h File Reference

InvenSense IMU-3000 digital triaxial gyroscope.

This module implements a driver for the InvenSense IMU-3000 digital 3-axis MEMS gyroscope and digital motion processor (IMU). The IMU-3000 provides digital-output x-, y-, and z-axis angular rate sensor readings with a sensitivity of 16 LSBs per deg/sec and programmable full-scale ranges of +/-250, +/-500, +/-1000, and +/-2000 deg/sec. The device includes a dedicated I2C master accelerometer sensor bus facilitating direct data acquisition from an off-chip third party accelerometer without intervention from an external processor. A configurable 512 Byte FIFO allows system microcontrollers to burst read the sensor data and then sleep while the IMU collects more data.

Copyright (c) 2012 Atmel Corporation. All rights reserved.

#include <asf.h>

Macros

#define IMU3000_TWI_ADDR   (0x68)
 
#define TEMP_COUNTS_PER_DEG_C   (280) /* counts per degree C */
 
#define TEMP_OFFSET   (-13200) /* temperature sensor offset */
 
#define TEMP_REF_DEG   (35) /* reference temp (degrees C) */
 
#define IMU3000_ID_VAL   (IMU3000_TWI_ADDR)
 IMU3000 Register Bit Definitions. More...
 
#define FIFO_EN_TEMP_OUT   (0x80) /* insert temperature data in FIFO */
 
#define FIFO_EN_GYRO_XOUT   (0x40) /* insert X gyro data in FIFO */
 
#define FIFO_EN_GYRO_YOUT   (0x20) /* insert Y gyro data in FIFO */
 
#define FIFO_EN_GYRO_ZOUT   (0x10) /* insert Z gyro data in FIFO */
 
#define FIFO_EN_AUX_XOUT   (0x08) /* insert X accel data in FIFO */
 
#define FIFO_EN_AUX_YOUT   (0x04) /* insert Y accel data in FIFO */
 
#define FIFO_EN_AUX_ZOUT   (0x02) /* insert Z accel data in FIFO */
 
#define FIFO_EN_FOOTER   (0x01) /* insert last word for FIFO read */
 
#define AUX_VDDIO_VDD   (0x04) /* VDD I/O logic for aux. I2C bus */
 
#define AUX_VDDIO_VLOGIC   (0x00) /* VLOGIC I/O logic for aux. I2C bus */
 
#define AUX_ADDR_CLKOUTEN   (0x80) /* enable reference clock at CLKOUT */
 
#define DLPF_CFG_FIELD   (0x07) /* low pass bandwidth (3 bits) */
 
#define DLPF_CFG_256HZ   (0x00) /* 256Hz low pass b/w */
 
#define DLPF_CFG_188HZ   (0x01) /* 188Hz low pass b/w */
 
#define DLPF_CFG_98HZ   (0x02) /* 98Hz low pass b/w */
 
#define DLPF_CFG_42HZ   (0x03) /* 42Hz low pass b/w */
 
#define DLPF_CFG_20HZ   (0x04) /* 20Hz low pass b/w */
 
#define DLPF_CFG_10HZ   (0x05) /* 10Hz low pass b/w */
 
#define DLPF_CFG_5HZ   (0x06) /* 5Hz low pass b/w */
 
#define DLPF_CFG_2100HZ   (0x07) /* 2.1KHz low pass b/w */
 
#define FS_SEL_FIELD   (0x18) /* full scale range (2 bits) */
 
#define FS_SEL_250   (0x00) /* +/-250 deg/sec full scale */
 
#define FS_SEL_500   (0x08) /* +/-500 deg/sec full scale */
 
#define FS_SEL_1000   (0x10) /* +/-1000 deg/sec full scale */
 
#define FS_SEL_2000   (0x18) /* +/-2000 deg/sec full scale */
 
#define INT_CFG_RAW_RDY_EN   (0x01) /* data available interrupt */
 
#define INT_CFG_DMP_DONE_EN   (0x02) /* DMP done interrupt */
 
#define INT_CFG_IMU_RDY_EN   (0x04) /* device ready interrupt */
 
#define INT_CFG_I2C_MST_ERR_EN   (0x08) /* accel NACK on secondary I2C bus */
 
#define INT_CFG_ANYRD_2CLEAR   (0x10) /* clr latch on any reg read */
 
#define INT_CFG_LATCH_INT_EN   (0x20) /* latch until int cleared */
 
#define INT_CFG_OPEN   (0x40) /* open drain for int output */
 
#define INT_CFG_ACTL   (0x80) /* int is active low */
 
#define INT_STATUS_RAW_DATA_RDY   (0x01) /* raw data is ready */
 
#define INT_STATUS_DMP_DONE   (0x02) /* digital motion processor done */
 
#define INT_STATUS_IMU_RDY   (0x04) /* device (PLL) is ready */
 
#define INT_STATUS_I2C_MST_ERR   (0x08) /* accel NACK on secondary I2C bus */
 
#define INT_STATUS_FIFO_FULL   (0x80) /* FIFO has overflowed */
 
#define USER_CTRL_GYRO_RST   (0x01) /* reset gyro analog & digital funcs */
 
#define USER_CTRL_FIFO_RST   (0x02) /* reset / clear the FIFO */
 
#define USER_CTRL_DMP_RST   (0x04) /* reset digital motion processor */
 
#define USER_CTRL_AUX_IF_RST   (0x08) /* reset auxiliary accelerometer */
 
#define USER_CTRL_AUX_IF_EN   (0x20) /* enable auxiliary accelerometer */
 
#define USER_CTRL_FIFO_EN   (0x40) /* enable FIFO for sensor data */
 
#define USER_CTRL_DMP_EN   (0x80) /* enable digital motion processor */
 
#define PWR_MGM_CLK_SEL_INT   (0x00) /* internal oscillator */
 
#define PWR_MGM_CLK_SEL_X   (0x01) /* PLL w/ X gyro reference */
 
#define PWR_MGM_CLK_SEL_Y   (0x02) /* PLL w/ Y gyro reference */
 
#define PWR_MGM_CLK_SEL_Z   (0x03) /* PLL w/ Z gyro reference */
 
#define PWR_MGM_CLK_SEL_EXT_32K   (0x04) /* PLL w/ external 32.768 KHz */
 
#define PWR_MGM_CLK_SEL_EXT_19M   (0x05) /* PLL w/ external 19.2 MHz */
 
#define PWR_MGM_STBY_ZG   (0x08) /* put Z gyro in standby mode */
 
#define PWR_MGM_STBY_YG   (0x10) /* put Y gyro in standby mode */
 
#define PWR_MGM_STBY_XG   (0x20) /* put X gyro in standby mode */
 
#define PWR_MGM_SLEEP   (0x40) /* enable low power sleep mode */
 
#define PWR_MGM_H_RESET   (0x80) /* reset device */
 

Enumerations

enum  imu3000_register_t {
  IMU3000_WHO_AM_I = 0,
  IMU3000_PRODUCT_ID,
  IMU3000_02_RSVD,
  IMU3000_03_RSVD,
  IMU3000_04_RSVD,
  IMU3000_05_RSVD,
  IMU3000_06_RSVD,
  IMU3000_07_RSVD,
  IMU3000_08_RSVD,
  IMU3000_09_RSVD,
  IMU3000_0A_RSVD,
  IMU3000_0B_RSVD,
  IMU3000_X_OFFS_USRH,
  IMU3000_X_OFFS_USRL,
  IMU3000_Y_OFFS_USRH,
  IMU3000_Y_OFFS_USRL,
  IMU3000_Z_OFFS_USRH,
  IMU3000_Z_OFFS_USRL,
  IMU3000_FIFO_EN,
  IMU3000_AUX_VDDIO,
  IMU3000_AUX_SLV_ADDR,
  IMU3000_SMPLRT_DIV,
  IMU3000_DLPF_FS,
  IMU3000_INT_CFG,
  IMU3000_AUX_BURST_ADDR,
  IMU3000_19_RSVD,
  IMU3000_INT_STATUS,
  IMU3000_TEMP_OUT_H,
  IMU3000_TEMP_OUT_L,
  IMU3000_GYRO_XOUT_H,
  IMU3000_GYRO_XOUT_L,
  IMU3000_GYRO_YOUT_H,
  IMU3000_GYRO_YOUT_L,
  IMU3000_GYRO_ZOUT_H,
  IMU3000_GYRO_ZOUT_L,
  IMU3000_23_RSVD,
  IMU3000_24_RSVD,
  IMU3000_25_RSVD,
  IMU3000_26_RSVD,
  IMU3000_27_RSVD,
  IMU3000_28_RSVD,
  IMU3000_29_RSVD,
  IMU3000_2A_RSVD,
  IMU3000_2B_RSVD,
  IMU3000_2C_RSVD,
  IMU3000_2D_RSVD,
  IMU3000_2E_RSVD,
  IMU3000_2F_RSVD,
  IMU3000_30_RSVD,
  IMU3000_31_RSVD,
  IMU3000_32_RSVD,
  IMU3000_33_RSVD,
  IMU3000_34_RSVD,
  IMU3000_DMP_CFG_1,
  IMU3000_DMP_CFG_2,
  IMU3000_BANK_SEL,
  IMU3000_MEM_START_ADDR,
  IMU3000_MEM_R_W,
  IMU3000_FIFO_COUNTH,
  IMU3000_FIFO_COUNTL,
  IMU3000_FIFO_R_W,
  IMU3000_USER_CTRL,
  IMU3000_PWR_MGM,
  IMU3000_3F_RSVD,
  IMU3000_REGISTER_COUNT
}
 IMU3000 Register Addresses. More...
 

Functions

bool imu3000_init (sensor_t *, int)
 InvenSense IMU-3000 motion processor driver initialization. More...
 

#define AUX_ADDR_CLKOUTEN   (0x80) /* enable reference clock at CLKOUT */

Referenced by imu3000_default_init().

#define AUX_VDDIO_VDD   (0x04) /* VDD I/O logic for aux. I2C bus */
#define AUX_VDDIO_VLOGIC   (0x00) /* VLOGIC I/O logic for aux. I2C bus */
#define DLPF_CFG_10HZ   (0x05) /* 10Hz low pass b/w */
#define DLPF_CFG_188HZ   (0x01) /* 188Hz low pass b/w */
#define DLPF_CFG_20HZ   (0x04) /* 20Hz low pass b/w */
#define DLPF_CFG_2100HZ   (0x07) /* 2.1KHz low pass b/w */
#define DLPF_CFG_256HZ   (0x00) /* 256Hz low pass b/w */
#define DLPF_CFG_42HZ   (0x03) /* 42Hz low pass b/w */
#define DLPF_CFG_5HZ   (0x06) /* 5Hz low pass b/w */
#define DLPF_CFG_98HZ   (0x02) /* 98Hz low pass b/w */
#define DLPF_CFG_FIELD   (0x07) /* low pass bandwidth (3 bits) */

Referenced by imu3000_set_bandwidth().

#define FIFO_EN_AUX_XOUT   (0x08) /* insert X accel data in FIFO */
#define FIFO_EN_AUX_YOUT   (0x04) /* insert Y accel data in FIFO */
#define FIFO_EN_AUX_ZOUT   (0x02) /* insert Z accel data in FIFO */
#define FIFO_EN_FOOTER   (0x01) /* insert last word for FIFO read */
#define FIFO_EN_GYRO_XOUT   (0x40) /* insert X gyro data in FIFO */
#define FIFO_EN_GYRO_YOUT   (0x20) /* insert Y gyro data in FIFO */
#define FIFO_EN_GYRO_ZOUT   (0x10) /* insert Z gyro data in FIFO */
#define FIFO_EN_TEMP_OUT   (0x80) /* insert temperature data in FIFO */
#define FS_SEL_1000   (0x10) /* +/-1000 deg/sec full scale */
#define FS_SEL_2000   (0x18) /* +/-2000 deg/sec full scale */
#define FS_SEL_250   (0x00) /* +/-250 deg/sec full scale */
#define FS_SEL_500   (0x08) /* +/-500 deg/sec full scale */
#define FS_SEL_FIELD   (0x18) /* full scale range (2 bits) */

Referenced by imu3000_set_range().

#define IMU3000_ID_VAL   (IMU3000_TWI_ADDR)

IMU3000 Register Bit Definitions.

Referenced by imu3000_default_init().

#define IMU3000_TWI_ADDR   (0x68)
#define INT_CFG_ACTL   (0x80) /* int is active low */
#define INT_CFG_ANYRD_2CLEAR   (0x10) /* clr latch on any reg read */
#define INT_CFG_DMP_DONE_EN   (0x02) /* DMP done interrupt */
#define INT_CFG_I2C_MST_ERR_EN   (0x08) /* accel NACK on secondary I2C bus */
#define INT_CFG_IMU_RDY_EN   (0x04) /* device ready interrupt */
#define INT_CFG_LATCH_INT_EN   (0x20) /* latch until int cleared */
#define INT_CFG_OPEN   (0x40) /* open drain for int output */
#define INT_CFG_RAW_RDY_EN   (0x01) /* data available interrupt */
#define INT_STATUS_DMP_DONE   (0x02) /* digital motion processor done */
#define INT_STATUS_FIFO_FULL   (0x80) /* FIFO has overflowed */
#define INT_STATUS_I2C_MST_ERR   (0x08) /* accel NACK on secondary I2C bus */
#define INT_STATUS_IMU_RDY   (0x04) /* device (PLL) is ready */
#define INT_STATUS_RAW_DATA_RDY   (0x01) /* raw data is ready */
#define PWR_MGM_CLK_SEL_EXT_19M   (0x05) /* PLL w/ external 19.2 MHz */
#define PWR_MGM_CLK_SEL_EXT_32K   (0x04) /* PLL w/ external 32.768 KHz */
#define PWR_MGM_CLK_SEL_INT   (0x00) /* internal oscillator */
#define PWR_MGM_CLK_SEL_X   (0x01) /* PLL w/ X gyro reference */
#define PWR_MGM_CLK_SEL_Y   (0x02) /* PLL w/ Y gyro reference */
#define PWR_MGM_CLK_SEL_Z   (0x03) /* PLL w/ Z gyro reference */
#define PWR_MGM_H_RESET   (0x80) /* reset device */
#define PWR_MGM_SLEEP   (0x40) /* enable low power sleep mode */
#define PWR_MGM_STBY_XG   (0x20) /* put X gyro in standby mode */
#define PWR_MGM_STBY_YG   (0x10) /* put Y gyro in standby mode */
#define PWR_MGM_STBY_ZG   (0x08) /* put Z gyro in standby mode */
#define TEMP_COUNTS_PER_DEG_C   (280) /* counts per degree C */
#define TEMP_OFFSET   (-13200) /* temperature sensor offset */
#define TEMP_REF_DEG   (35) /* reference temp (degrees C) */
#define USER_CTRL_AUX_IF_EN   (0x20) /* enable auxiliary accelerometer */

Referenced by imu3000_default_init().

#define USER_CTRL_AUX_IF_RST   (0x08) /* reset auxiliary accelerometer */

Referenced by imu3000_default_init().

#define USER_CTRL_DMP_EN   (0x80) /* enable digital motion processor */
#define USER_CTRL_DMP_RST   (0x04) /* reset digital motion processor */
#define USER_CTRL_FIFO_EN   (0x40) /* enable FIFO for sensor data */
#define USER_CTRL_FIFO_RST   (0x02) /* reset / clear the FIFO */
#define USER_CTRL_GYRO_RST   (0x01) /* reset gyro analog & digital funcs */

IMU3000 Register Addresses.

Enumerator
IMU3000_WHO_AM_I 
IMU3000_PRODUCT_ID 
IMU3000_02_RSVD 
IMU3000_03_RSVD 
IMU3000_04_RSVD 
IMU3000_05_RSVD 
IMU3000_06_RSVD 
IMU3000_07_RSVD 
IMU3000_08_RSVD 
IMU3000_09_RSVD 
IMU3000_0A_RSVD 
IMU3000_0B_RSVD 
IMU3000_X_OFFS_USRH 
IMU3000_X_OFFS_USRL 
IMU3000_Y_OFFS_USRH 
IMU3000_Y_OFFS_USRL 
IMU3000_Z_OFFS_USRH 
IMU3000_Z_OFFS_USRL 
IMU3000_FIFO_EN 
IMU3000_AUX_VDDIO 
IMU3000_AUX_SLV_ADDR 
IMU3000_SMPLRT_DIV 
IMU3000_DLPF_FS 
IMU3000_INT_CFG 
IMU3000_AUX_BURST_ADDR 
IMU3000_19_RSVD 
IMU3000_INT_STATUS 
IMU3000_TEMP_OUT_H 
IMU3000_TEMP_OUT_L 
IMU3000_GYRO_XOUT_H 
IMU3000_GYRO_XOUT_L 
IMU3000_GYRO_YOUT_H 
IMU3000_GYRO_YOUT_L 
IMU3000_GYRO_ZOUT_H 
IMU3000_GYRO_ZOUT_L 
IMU3000_23_RSVD 
IMU3000_24_RSVD 
IMU3000_25_RSVD 
IMU3000_26_RSVD 
IMU3000_27_RSVD 
IMU3000_28_RSVD 
IMU3000_29_RSVD 
IMU3000_2A_RSVD 
IMU3000_2B_RSVD 
IMU3000_2C_RSVD 
IMU3000_2D_RSVD 
IMU3000_2E_RSVD 
IMU3000_2F_RSVD 
IMU3000_30_RSVD 
IMU3000_31_RSVD 
IMU3000_32_RSVD 
IMU3000_33_RSVD 
IMU3000_34_RSVD 
IMU3000_DMP_CFG_1 
IMU3000_DMP_CFG_2 
IMU3000_BANK_SEL 
IMU3000_MEM_START_ADDR 
IMU3000_MEM_R_W 
IMU3000_FIFO_COUNTH 
IMU3000_FIFO_COUNTL 
IMU3000_FIFO_R_W 
IMU3000_USER_CTRL 
IMU3000_PWR_MGM 
IMU3000_3F_RSVD 
IMU3000_REGISTER_COUNT 

bool imu3000_init ( sensor_t sensor,
int  resvd 
)

InvenSense IMU-3000 motion processor driver initialization.

This is the main initialization function for the IMU-3000 device.

Parameters
sensorAddress of a sensor device descriptor.
resvdReserved value.
Returns
bool true if the sensor is ready for use, else false.

References ARRAYSIZE, sensor_desc::aux, sensor_device_t::func, sensor_desc::hal, imu3000_event(), imu3000_ioctl(), imu3000_read(), sensor_funcs_t::read, SENSOR_CAPS_3_AXIS, SENSOR_CAPS_AUX_ACCEL, SENSOR_CAPS_AUX_TEMP, SENSOR_UNITS_deg_per_sec, SENSOR_VENDOR_INVENSENSE, and status.