[imu_aspirin2] read mag again.. got disabled with Michal's baro_board stuff

explicitly enable reading of baro ms5611 through mpu with USE_IMU_ASPIRIN2_BARO_SLAVE:
seems to be configured but not functional since the baro value is never read anywhere..
This commit is contained in:
Felix Ruess
2013-02-14 00:03:56 +01:00
parent ed28e4d697
commit 1207fc2560
5 changed files with 84 additions and 27 deletions
+1 -3
View File
@@ -243,9 +243,7 @@ B2L -> CW
</subsystem>
<subsystem name="telemetry" type="transparent"/>
<subsystem name="imu" type="aspirin_v2.1">
<define name="IMU_ASPIRIN_DISABLE_BARO" value="TRUE"/>
</subsystem>
<subsystem name="imu" type="aspirin_v2.1"/>
<subsystem name="gps" type="ublox"/>
<subsystem name="stabilization" type="int_quat"/>
<subsystem name="ahrs" type="int_cmpl_quat"/>
+1 -3
View File
@@ -200,9 +200,7 @@
</subsystem>
<subsystem name="telemetry" type="transparent"/>
<subsystem name="imu" type="aspirin_v2.1">
<define name="IMU_ASPIRIN_DISABLE_BARO" value="TRUE"/>
</subsystem>
<subsystem name="imu" type="aspirin_v2.1"/>
<subsystem name="gps" type="ublox"/>
<subsystem name="stabilization" type="int_quat"/>
<subsystem name="ahrs" type="int_cmpl_quat"/>
@@ -42,7 +42,7 @@ ifeq ($(TARGET), ap)
IMU_ASPIRIN_CFLAGS = -DUSE_IMU
endif
IMU_ASPIRIN_CFLAGS += -DIMU_TYPE_H=\"imu/imu_aspirin2.h\" -DIMU_OVERRIDE_CHANNELS
IMU_ASPIRIN_CFLAGS += -DIMU_TYPE_H=\"imu/imu_aspirin2.h\"
IMU_ASPIRIN_SRCS = $(SRC_SUBSYSTEMS)/imu.c \
$(SRC_SUBSYSTEMS)/imu/imu_aspirin2.c
@@ -1,5 +1,73 @@
ap.CFLAGS += -DIMU_ASPIRIN_DISABLE_BARO
include $(CFG_SHARED)/imu_aspirin_v2.1.makefile
# Hey Emacs, this is a -*- makefile -*-
#
# Aspirin IMU v2.2
#
#
# required xml:
# <section name="IMU" prefix="IMU_">
#
# <!-- these gyro and accel calib values are the defaults for aspirin2.2 -->
# <define name="GYRO_X_NEUTRAL" value="0"/>
# <define name="GYRO_Y_NEUTRAL" value="0"/>
# <define name="GYRO_Z_NEUTRAL" value="0"/>
#
# <define name="GYRO_X_SENS" value="4.359" integer="16"/>
# <define name="GYRO_Y_SENS" value="4.359" integer="16"/>
# <define name="GYRO_Z_SENS" value="4.359" integer="16"/>
#
# <define name="ACCEL_X_NEUTRAL" value="0"/>
# <define name="ACCEL_Y_NEUTRAL" value="0"/>
# <define name="ACCEL_Z_NEUTRAL" value="0"/>
#
# <define name="ACCEL_X_SENS" value="4.905" integer="16"/>
# <define name="ACCEL_Y_SENS" value="4.905" integer="16"/>
# <define name="ACCEL_Z_SENS" value="4.905" integer="16"/>
#
# <!-- replace the mag calibration with your own-->
# <define name="MAG_X_NEUTRAL" value="-45"/>
# <define name="MAG_Y_NEUTRAL" value="334"/>
# <define name="MAG_Z_NEUTRAL" value="7"/>
#
# <define name="MAG_X_SENS" value="3.4936416" integer="16"/>
# <define name="MAG_Y_SENS" value="3.607713" integer="16"/>
# <define name="MAG_Z_SENS" value="4.90788848" integer="16"/>
#
# </section>
#
#
# for fixedwing firmware and ap only
ifeq ($(TARGET), ap)
IMU_ASPIRIN_CFLAGS = -DUSE_IMU
endif
IMU_ASPIRIN_CFLAGS += -DIMU_TYPE_H=\"imu/imu_aspirin2.h\"
IMU_ASPIRIN_SRCS = $(SRC_SUBSYSTEMS)/imu.c \
$(SRC_SUBSYSTEMS)/imu/imu_aspirin2.c
include $(CFG_SHARED)/spi.makefile
ifeq ($(ARCH), lpc21)
IMU_ASPIRIN_CFLAGS += -DUSE_SPI1
IMU_ASPIRIN_CFLAGS += -DUSE_SPI_SLAVE0
else ifeq ($(ARCH), stm32)
IMU_ASPIRIN_CFLAGS += -DUSE_SPI2
# Slave select configuration
# SLAVE2 is on PB12 (NSS) (MPU600 CS)
IMU_ASPIRIN_CFLAGS += -DUSE_SPI_SLAVE2
endif
IMU_ASPIRIN_CFLAGS += -DIMU_ASPIRIN_VERSION_2_2
# Keep CFLAGS/Srcs for imu in separate expression so we can assign it to other targets
# see: conf/autopilot/subsystems/lisa_passthrough/imu_b2_v1.1.makefile for example
ap.CFLAGS += $(IMU_ASPIRIN_CFLAGS)
ap.srcs += $(IMU_ASPIRIN_SRCS)
#
# NPS simulator
#
include $(CFG_SHARED)/imu_nps.makefile
+10 -17
View File
@@ -28,10 +28,6 @@
#include "peripherals/hmc58xx_regs.h"
#include "peripherals/ms5611.h"
#ifdef BARO_I2C
#define MPU6000_NO_SLAVES
#endif
#ifndef MPU6000_SLAVE_IDX
#define MPU6000_SLAVE_IDX SPI_SLAVE2
#endif
@@ -211,6 +207,7 @@ static void mpu_configure(void)
(3 << 3) ); // Full Scale = 16g
#ifndef MPU6000_NO_SLAVES
PRINT_CONFIG_MSG("Reading MPU slaves")
/////////////////////////////////////
// SPI Slave Configuration Section
@@ -227,16 +224,16 @@ static void mpu_configure(void)
// Enable the aux i2c
mpu_set( MPU60X0_REG_I2C_MST_CTRL,
(0 << 7) | // no multimaster
(0 << 6) | // do not delay IRQ waiting for all external slaves
(0 << 5) | // no slave 3 FIFO
(0 << 4) | // restart or stop/start from one slave to another: read -> write is always stop/start
(8 << 0) ); // 0=348kHz 8=256kHz, 9=500kHz
(0 << 6) | // do not delay IRQ waiting for all external slaves
(0 << 5) | // no slave 3 FIFO
(0 << 4) | // restart or stop/start from one slave to another: read -> write is always stop/start
(8 << 0) ); // 0=348kHz 8=256kHz, 9=500kHz
mpu_set( MPU60X0_REG_I2C_MST_DELAY,
(0 << 2) | // No Delay Slave 2
(1 << 3) ); // Delay Slave 3
#ifdef IMU_ASPIRIN_VERSION_2_1
#if defined IMU_ASPIRIN_VERSION_2_1 && USE_IMU_ASPIRIN2_BARO_SLAVE
// MS5611 Send Reset
mpu_set( MPU60X0_REG_I2C_SLV4_ADDR, (MS5611_ADDR0));
@@ -251,7 +248,7 @@ static void mpu_configure(void)
// Wait at least 2.8ms
#endif
#endif // read MS5611 as MPU slave
// HMC5883 Magnetometer Configuration
@@ -297,9 +294,8 @@ static void mpu_configure(void)
// Slave 0 Control:
#if !IMU_ASPIRIN_DISABLE_BARO
#ifdef IMU_ASPIRIN_VERSION_2_1
PRINT_CONFIG_MSG("Reading the MS5611")
#if defined IMU_ASPIRIN_VERSION_2_1 && USE_IMU_ASPIRIN2_BARO_SLAVE
PRINT_CONFIG_MSG("Reading the MS5611 as MPU slave")
/*
@@ -342,10 +338,7 @@ PRINT_CONFIG_MSG("Reading the MS5611")
(0 << 6) | // Byte Swap
(3 << 0) ); // Read 6 bytes
#endif
#endif
#endif // read MS5611 as MPU slave
#endif