mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 22:17:01 +08:00
changes on navgo board for new baro and update some airframes
This commit is contained in:
@@ -14,10 +14,10 @@
|
|||||||
<!--load name="infrared_i2c.xml"/-->
|
<!--load name="infrared_i2c.xml"/-->
|
||||||
<!--load name="max3100.xml"/>
|
<!--load name="max3100.xml"/>
|
||||||
<load name="gsm.xml"/-->
|
<load name="gsm.xml"/-->
|
||||||
<load name="demo_module.xml">
|
<!--load name="demo_module.xml">
|
||||||
<define name="TEST" value="1"/>
|
<define name="TEST" value="1"/>
|
||||||
<define name="TEST_FLAG"/>
|
<define name="TEST_FLAG"/>
|
||||||
</load>
|
</load-->
|
||||||
<!--load name="enose.xml"/-->
|
<!--load name="enose.xml"/-->
|
||||||
<load name="light.xml"/>
|
<load name="light.xml"/>
|
||||||
<load name="infrared_adc.xml"/>
|
<load name="infrared_adc.xml"/>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
<subsystem name="radio_control" type="ppm"/>
|
<subsystem name="radio_control" type="ppm"/>
|
||||||
<subsystem name="telemetry" type="xbee_api"/>
|
<subsystem name="telemetry" type="xbee_api"/>
|
||||||
<subsystem name="control" type="new"/>
|
<subsystem name="control" type="adaptive"/>
|
||||||
<subsystem name="ahrs" type="infrared"/>
|
<subsystem name="ahrs" type="infrared"/>
|
||||||
<subsystem name="gps" type="ublox"/>
|
<subsystem name="gps" type="ublox"/>
|
||||||
<subsystem name="navigation"/>
|
<subsystem name="navigation"/>
|
||||||
@@ -217,103 +217,4 @@
|
|||||||
<define name="YAW_RESPONSE_FACTOR" value="1."/>
|
<define name="YAW_RESPONSE_FACTOR" value="1."/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!--
|
|
||||||
<makefile>
|
|
||||||
CONFIG = \"tiny_2_1_1.h\"
|
|
||||||
|
|
||||||
include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile
|
|
||||||
|
|
||||||
FLASH_MODE=IAP
|
|
||||||
|
|
||||||
ap.CFLAGS += -DFBW -DAP -DBOARD_CONFIG=$(CONFIG) -DUSE_LED -DTIME_LED=1
|
|
||||||
ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c main_fbw.c main_ap.c main.c
|
|
||||||
|
|
||||||
ap.CFLAGS += -DINTER_MCU
|
|
||||||
ap.srcs += inter_mcu.c
|
|
||||||
|
|
||||||
ap.srcs += commands.c
|
|
||||||
|
|
||||||
########## RC actuators + radio
|
|
||||||
ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017
|
|
||||||
ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c
|
|
||||||
|
|
||||||
ap.CFLAGS += -DRADIO_CONTROL
|
|
||||||
ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c
|
|
||||||
|
|
||||||
########## Modems
|
|
||||||
ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600
|
|
||||||
ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c
|
|
||||||
|
|
||||||
#TRANSPARENT
|
|
||||||
#ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1 -DPPRZ_UART=Uart1 -DDATALINK=PPRZ -DUART1_BAUD=B9600
|
|
||||||
#ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transport.c
|
|
||||||
|
|
||||||
########## ADC
|
|
||||||
ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3
|
|
||||||
ap.srcs += $(SRC_ARCH)/adc_hw.c
|
|
||||||
|
|
||||||
########## GPS
|
|
||||||
ap.CFLAGS += -DUSE_GPS -DUBX -DUSE_UART0 -DGPS_LINK=Uart0 -DUART0_BAUD=B38400 -DGPS_USE_LATLONG
|
|
||||||
# -DGPS_LED=2
|
|
||||||
ap.srcs += gps_ubx.c gps.c latlong.c
|
|
||||||
|
|
||||||
########## IR sensors
|
|
||||||
ap.CFLAGS += -DUSE_INFRARED -DALT_KALMAN
|
|
||||||
ap.srcs += infrared.c estimator.c
|
|
||||||
|
|
||||||
########## Gyro
|
|
||||||
#ap.CFLAGS += -DUSE_GYRO -DADXRS150
|
|
||||||
#ap.srcs += gyro.c
|
|
||||||
|
|
||||||
########## Nav
|
|
||||||
ap.CFLAGS += -DNAV -DAGR_CLIMB -DPITCH_TRIM
|
|
||||||
ap.srcs += subsystems/nav.c fw_h_ctl_a.c fw_v_ctl_n.c
|
|
||||||
ap.srcs += subsystems/navigation/nav_survey_rectangle.c
|
|
||||||
ap.srcs += subsystems/navigation/nav_line.c
|
|
||||||
|
|
||||||
########## SPI Master use slave0
|
|
||||||
ap.CFLAGS += -DUSE_SPI -DSPI_MASTER -DUSE_SPI_SLAVE0
|
|
||||||
ap.srcs += spi.c $(SRC_ARCH)/spi_hw.c
|
|
||||||
|
|
||||||
########## Barometer (SPI)
|
|
||||||
#ap.CFLAGS += -DUSE_BARO_MS5534A
|
|
||||||
#ap.srcs += $(SRC_ARCH)/baro_MS5534A.c
|
|
||||||
|
|
||||||
########## I2C0
|
|
||||||
ap.CFLAGS += -DUSE_I2C0
|
|
||||||
ap.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
|
|
||||||
|
|
||||||
########## Lights
|
|
||||||
ap.CFLAGS += -DUSE_LIGHT
|
|
||||||
ap.srcs += light.c
|
|
||||||
|
|
||||||
########## Max3100
|
|
||||||
ap.CFLAGS += -DMAX3100_BAUD_RATE=MAX3100_B9600
|
|
||||||
|
|
||||||
ap.CFLAGS += -DGCS_NUMBER=\"+33640286530\"
|
|
||||||
|
|
||||||
ap.CFLAGS += -DUSE_MODULES
|
|
||||||
|
|
||||||
# Config for SITL simulation
|
|
||||||
#include $(PAPARAZZI_SRC)/conf/autopilot/sitl.makefile
|
|
||||||
|
|
||||||
sim.ARCHDIR = $(ARCHI)
|
|
||||||
sim.CFLAGS += -DSITL -DAP -DFBW -DRADIO_CONTROL -DINTER_MCU -DDOWNLINK -DDOWNLINK_TRANSPORT=IvyTransport -DUSE_INFRARED -DNAV -DUSE_LED -DWIND_INFO
|
|
||||||
sim.srcs = latlong.c radio_control.c downlink.c commands.c gps.c inter_mcu.c infrared.c fw_h_ctl_a.c fw_v_ctl_n.c subsystems/nav.c estimator.c sys_time.c main_fbw.c main_ap.c datalink.c $(SRC_ARCH)/ppm_hw.c $(SRC_ARCH)/sim_gps.c $(SRC_ARCH)/sim_ir.c $(SRC_ARCH)/sim_ap.c $(SRC_ARCH)/ivy_transport.c $(SRC_ARCH)/sim_adc_generic.c $(SRC_ARCH)/led_hw.c
|
|
||||||
|
|
||||||
sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DPITCH_TRIM -DALT_KALMAN
|
|
||||||
|
|
||||||
sim.srcs += subsystems/navigation/nav_line.c subsystems/navigation/nav_survey_rectangle.c
|
|
||||||
|
|
||||||
sim.CFLAGS += -DUSE_LIGHT
|
|
||||||
sim.srcs += light.c
|
|
||||||
|
|
||||||
sim.CFLAGS += -DUSE_I2C0
|
|
||||||
sim.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
|
|
||||||
|
|
||||||
sim.CFLAGS += -DUSE_MODULES
|
|
||||||
|
|
||||||
</makefile>
|
|
||||||
-->
|
|
||||||
|
|
||||||
</airframe>
|
</airframe>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<airframe name="Blender">
|
<airframe name="Blender">
|
||||||
|
|
||||||
<modules main_freq="512">
|
<modules main_freq="512">
|
||||||
<load name="booz_pwm.xml">
|
<!--load name="booz_pwm.xml">
|
||||||
<define name="USE_PWM1"/>
|
<define name="USE_PWM1"/>
|
||||||
</load>
|
</load>
|
||||||
<load name="booz_drop.xml"/>
|
<load name="booz_drop.xml"/>
|
||||||
<load name="booz_cam.xml"/>
|
<load name="booz_cam.xml"/-->
|
||||||
<!--load name="sonar_maxbotix_booz.xml"/-->
|
<!--load name="sonar_maxbotix_booz.xml"/-->
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
@@ -22,13 +22,13 @@
|
|||||||
</target>
|
</target>
|
||||||
<target name="sim" board="pc">
|
<target name="sim" board="pc">
|
||||||
<subsystem name="fdm" type="nps"/>
|
<subsystem name="fdm" type="nps"/>
|
||||||
<!--define name="NPS_NO_SUPERVISION"/-->
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<subsystem name="radio_control" type="ppm"/>
|
<subsystem name="radio_control" type="ppm"/>
|
||||||
<subsystem name="telemetry" type="transparent"/>
|
<subsystem name="telemetry" type="transparent"/>
|
||||||
<subsystem name="actuators" type="asctec"/>
|
<subsystem name="actuators" type="skiron">
|
||||||
<!--subsystem name="actuators" type="mkk"/-->
|
<define name="SKIRON_I2C_SCL_TIME" value="25"/>
|
||||||
|
</subsystem>
|
||||||
<subsystem name="imu" type="b2_v1.1"/>
|
<subsystem name="imu" type="b2_v1.1"/>
|
||||||
<subsystem name="gps" type="ublox">
|
<subsystem name="gps" type="ublox">
|
||||||
<configure name="GPS_BAUD" value="B57600"/>
|
<configure name="GPS_BAUD" value="B57600"/>
|
||||||
@@ -48,17 +48,11 @@
|
|||||||
</firmware>
|
</firmware>
|
||||||
|
|
||||||
<servos min="0" neutral="0" max="0xff">
|
<servos min="0" neutral="0" max="0xff">
|
||||||
<servo name="PITCH" no="0" min="0" neutral="0" max="255"/>
|
|
||||||
<servo name="ROLL" no="1" min="0" neutral="0" max="255"/>
|
|
||||||
<servo name="YAW" no="2" min="0" neutral="0" max="255"/>
|
|
||||||
<servo name="THRUST" no="3" min="0" neutral="0" max="255"/>
|
|
||||||
</servos>
|
|
||||||
<!--servos min="0" neutral="0" max="0xff">
|
|
||||||
<servo name="FRONT" no="0" min="0" neutral="0" max="255"/>
|
<servo name="FRONT" no="0" min="0" neutral="0" max="255"/>
|
||||||
<servo name="BACK" no="1" min="0" neutral="0" max="255"/>
|
<servo name="BACK" no="2" min="0" neutral="0" max="255"/>
|
||||||
<servo name="RIGHT" no="2" min="0" neutral="0" max="255"/>
|
<servo name="RIGHT" no="1" min="0" neutral="0" max="255"/>
|
||||||
<servo name="LEFT" no="3" min="0" neutral="0" max="255"/>
|
<servo name="LEFT" no="3" min="0" neutral="0" max="255"/>
|
||||||
</servos-->
|
</servos>
|
||||||
|
|
||||||
<commands>
|
<commands>
|
||||||
<axis name="PITCH" failsafe_value="0"/>
|
<axis name="PITCH" failsafe_value="0"/>
|
||||||
@@ -67,20 +61,15 @@
|
|||||||
<axis name="THRUST" failsafe_value="0"/>
|
<axis name="THRUST" failsafe_value="0"/>
|
||||||
</commands>
|
</commands>
|
||||||
|
|
||||||
<!--section name="ACTUATORS_MKK" prefix="ACTUATORS_MKK_">
|
<section name="ACTUATORS_SKIRON" prefix="ACTUATORS_SKIRON_">
|
||||||
<define name="NB" value="4"/>
|
<define name="NB" value="4"/>
|
||||||
<define name="ADDR" value="{ 0x52, 0x56, 0x54, 0x58 }"/>
|
<define name="IDX" value="{ SERVO_FRONT, SERVO_BACK, SERVO_RIGHT, SERVO_LEFT }"/>
|
||||||
</section-->
|
</section>
|
||||||
|
|
||||||
<section name="SUPERVISION" prefix="SUPERVISION_">
|
<section name="SUPERVISION" prefix="SUPERVISION_">
|
||||||
<define name="TRIM_A" value="0"/>
|
<define name="MIN_MOTOR" value="20"/>
|
||||||
<define name="TRIM_E" value="0"/>
|
<define name="MAX_MOTOR" value="255"/>
|
||||||
<define name="TRIM_R" value="0"/>
|
<define name="TRIM_A" value="6"/>
|
||||||
</section>
|
|
||||||
<!--section name="SUPERVISION" prefix="SUPERVISION_">
|
|
||||||
<define name="MIN_MOTOR" value="25"/>
|
|
||||||
<define name="MAX_MOTOR" value="243"/>
|
|
||||||
<define name="TRIM_A" value="0"/>
|
|
||||||
<define name="TRIM_E" value="0"/>
|
<define name="TRIM_E" value="0"/>
|
||||||
<define name="TRIM_R" value="0"/>
|
<define name="TRIM_R" value="0"/>
|
||||||
<define name="NB_MOTOR" value="4"/>
|
<define name="NB_MOTOR" value="4"/>
|
||||||
@@ -89,8 +78,7 @@
|
|||||||
<define name="PITCH_COEF" value="{ 256, -256, 0, 0}"/>
|
<define name="PITCH_COEF" value="{ 256, -256, 0, 0}"/>
|
||||||
<define name="YAW_COEF" value="{ -256, -256, 256, 256}"/>
|
<define name="YAW_COEF" value="{ -256, -256, 256, 256}"/>
|
||||||
<define name="THRUST_COEF" value="{ 256, 256, 256, 256}"/>
|
<define name="THRUST_COEF" value="{ 256, 256, 256, 256}"/>
|
||||||
</section-->
|
</section>
|
||||||
|
|
||||||
|
|
||||||
<section name="IMU" prefix="IMU_">
|
<section name="IMU" prefix="IMU_">
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
</target>
|
</target>
|
||||||
<target name="sim" board="pc">
|
<target name="sim" board="pc">
|
||||||
<subsystem name="fdm" type="nps"/>
|
<subsystem name="fdm" type="nps"/>
|
||||||
<!--define name="NPS_NO_SUPERVISION"/-->
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<subsystem name="radio_control" type="ppm"/>
|
<subsystem name="radio_control" type="ppm"/>
|
||||||
@@ -30,11 +29,11 @@
|
|||||||
<define name="SKIRON_I2C_SCL_TIME" value="25"/>
|
<define name="SKIRON_I2C_SCL_TIME" value="25"/>
|
||||||
</subsystem>
|
</subsystem>
|
||||||
<subsystem name="imu" type="navgo"/>
|
<subsystem name="imu" type="navgo"/>
|
||||||
<subsystem name="gps" type="ublox"/>
|
<subsystem name="gps" type="ublox">
|
||||||
<subsystem name="stabilization" type="euler"/>
|
<configure name="GPS_BAUD" value="B57600"/>
|
||||||
<subsystem name="ahrs" type="int_cmpl_euler">
|
|
||||||
<define name="LOW_NOISE_THRESHOLD" value="50000"/>
|
|
||||||
</subsystem>
|
</subsystem>
|
||||||
|
<subsystem name="stabilization" type="euler"/>
|
||||||
|
<subsystem name="ahrs" type="int_cmpl_euler"/>
|
||||||
<subsystem name="ins" type="hff"/>
|
<subsystem name="ins" type="hff"/>
|
||||||
</firmware>
|
</firmware>
|
||||||
|
|
||||||
@@ -73,31 +72,39 @@
|
|||||||
|
|
||||||
<section name="IMU" prefix="IMU_">
|
<section name="IMU" prefix="IMU_">
|
||||||
|
|
||||||
<define name="GYRO_P_NEUTRAL" value="-126"/>
|
<define name="GYRO_P_NEUTRAL" value="10"/>
|
||||||
<define name="GYRO_Q_NEUTRAL" value="-29"/>
|
<define name="GYRO_Q_NEUTRAL" value="-32"/>
|
||||||
<define name="GYRO_R_NEUTRAL" value="-32"/>
|
<define name="GYRO_R_NEUTRAL" value="11"/>
|
||||||
|
|
||||||
<!-- SENS ITG3200 1/14.375 (deg/s)/LSB, rate frac 12bit => 1/14.375 * pi / 180 * 2^12 -->
|
<!-- SENS ITG3200 1/14.375 (deg/s)/LSB, rate frac 12bit => 1/14.375 * pi / 180 * 2^12 -->
|
||||||
<define name="GYRO_P_SENS" value="4.97312" integer="16"/>
|
<define name="GYRO_P_SENS" value="4.97312" integer="16"/>
|
||||||
<define name="GYRO_Q_SENS" value="4.97312" integer="16"/>
|
<define name="GYRO_Q_SENS" value="4.97312" integer="16"/>
|
||||||
<define name="GYRO_R_SENS" value="4.97312" integer="16"/>
|
<define name="GYRO_R_SENS" value="4.97312" integer="16"/>
|
||||||
|
|
||||||
<define name="ACCEL_X_NEUTRAL" value="4"/>
|
<define name="ACCEL_X_NEUTRAL" value="9"/>
|
||||||
<define name="ACCEL_Y_NEUTRAL" value="-17"/>
|
<define name="ACCEL_Y_NEUTRAL" value="14"/>
|
||||||
<define name="ACCEL_Z_NEUTRAL" value="-22"/>
|
<define name="ACCEL_Z_NEUTRAL" value="-16"/>
|
||||||
|
|
||||||
<!-- SENS ADXL345 16G 31.2 mg/LSB, accel frac 10bit => 31.2 * 2^10 / 1000 = 31.9488-->
|
<!-- SENS ADXL345 16G 31.2 mg/LSB, accel frac 10bit => 31.2 * 2^10 / 1000 = 31.9488-->
|
||||||
<define name="ACCEL_X_SENS" value="38.2816633245" integer="16"/>
|
<define name="ACCEL_X_SENS" value="38.5866088465" integer="16"/>
|
||||||
<define name="ACCEL_Y_SENS" value="38.7857058923" integer="16"/>
|
<define name="ACCEL_Y_SENS" value="38.7212932023" integer="16"/>
|
||||||
<define name="ACCEL_Z_SENS" value="39.7459254023" integer="16"/>
|
<define name="ACCEL_Z_SENS" value="39.403098907" integer="16"/>
|
||||||
|
|
||||||
<define name="MAG_X_NEUTRAL" value="85"/>
|
<define name="MAG_X_NEUTRAL" value="80"/>
|
||||||
<define name="MAG_Y_NEUTRAL" value="97"/>
|
<define name="MAG_Y_NEUTRAL" value="-271"/>
|
||||||
<define name="MAG_Z_NEUTRAL" value="-43"/>
|
<define name="MAG_Z_NEUTRAL" value="112"/>
|
||||||
|
|
||||||
|
<define name="MAG_X_SENS" value="4.44131219218" integer="16"/>
|
||||||
|
<define name="MAG_Y_SENS" value="4.56234629213" integer="16"/>
|
||||||
|
<define name="MAG_Z_SENS" value="5.298653926" integer="16"/>
|
||||||
|
|
||||||
|
<!--define name="MAG_X_NEUTRAL" value="0"/>
|
||||||
|
<define name="MAG_Y_NEUTRAL" value="0"/>
|
||||||
|
<define name="MAG_Z_NEUTRAL" value="0"/>
|
||||||
|
|
||||||
<define name="MAG_X_SENS" value="5.43371021972" integer="16"/>
|
<define name="MAG_X_SENS" value="5.43371021972" integer="16"/>
|
||||||
<define name="MAG_Y_SENS" value="4.8961742578" integer="16"/>
|
<define name="MAG_Y_SENS" value="4.8961742578" integer="16"/>
|
||||||
<define name="MAG_Z_SENS" value="5.31527656902" integer="16"/>
|
<define name="MAG_Z_SENS" value="5.31527656902" integer="16"/-->
|
||||||
|
|
||||||
<define name="BODY_TO_IMU_PHI" value="RadOfDeg(0.)"/> <!-- -10 -->
|
<define name="BODY_TO_IMU_PHI" value="RadOfDeg(0.)"/> <!-- -10 -->
|
||||||
<define name="BODY_TO_IMU_THETA" value="RadOfDeg(0.)"/> <!-- -10 -->
|
<define name="BODY_TO_IMU_THETA" value="RadOfDeg(0.)"/> <!-- -10 -->
|
||||||
@@ -125,6 +132,8 @@
|
|||||||
<define name="ACCEL_Y_SENS" value="38.7108" integer="16"/>
|
<define name="ACCEL_Y_SENS" value="38.7108" integer="16"/>
|
||||||
<define name="ACCEL_Z_SENS" value="39.6583" integer="16"/>
|
<define name="ACCEL_Z_SENS" value="39.6583" integer="16"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<define name="MAG_X_NEUTRAL" value="55"/>
|
<define name="MAG_X_NEUTRAL" value="55"/>
|
||||||
<define name="MAG_Y_NEUTRAL" value="54"/>
|
<define name="MAG_Y_NEUTRAL" value="54"/>
|
||||||
<define name="MAG_Z_NEUTRAL" value="92"/>
|
<define name="MAG_Z_NEUTRAL" value="92"/>
|
||||||
@@ -149,7 +158,8 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section name="INS" prefix="INS_">
|
<section name="INS" prefix="INS_">
|
||||||
<define name="BARO_SENS" value="14" integer="16"/>
|
<!-- 1.4 mm/LSB : 0.0014*2^8 = 0.3584 -->
|
||||||
|
<define name="BARO_SENS" value="1.156" integer="16"/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -145,9 +145,11 @@ else ifeq ($(BOARD), lisa_l)
|
|||||||
ap.CFLAGS += -DUSE_I2C2
|
ap.CFLAGS += -DUSE_I2C2
|
||||||
else ifeq ($(BOARD), navgo)
|
else ifeq ($(BOARD), navgo)
|
||||||
ap.CFLAGS += -DROTORCRAFT_BARO_LED=$(BARO_LED)
|
ap.CFLAGS += -DROTORCRAFT_BARO_LED=$(BARO_LED)
|
||||||
ap.CFLAGS += -DUSE_I2C1
|
include $(CFG_ROTORCRAFT)/spi.makefile
|
||||||
ap.CFLAGS += -DADS1114_I2C_DEVICE=i2c1
|
ap.CFLAGS += -DUSE_SPI_SLAVE0
|
||||||
ap.srcs += peripherals/ads1114.c
|
ap.CFLAGS += -DSPI_NO_UNSELECT_SLAVE
|
||||||
|
ap.CFLAGS += -DSPI_MASTER
|
||||||
|
ap.srcs += peripherals/mcp355x.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -12,10 +12,12 @@ IMU_NAVGO_CFLAGS += -DUSE_I2C1 -DI2C1_SCLL=25 -DI2C1_SCLH=25
|
|||||||
IMU_NAVGO_CFLAGS += -DITG3200_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
|
IMU_NAVGO_CFLAGS += -DITG3200_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
|
||||||
IMU_NAVGO_CFLAGS += -DITG3200_I2C_ADDR=ITG3200_ADDR_ALT
|
IMU_NAVGO_CFLAGS += -DITG3200_I2C_ADDR=ITG3200_ADDR_ALT
|
||||||
IMU_NAVGO_CFLAGS += -DITG3200_SMPLRT_DIV=1
|
IMU_NAVGO_CFLAGS += -DITG3200_SMPLRT_DIV=1
|
||||||
|
IMU_NAVGO_CFLAGS += -DITG3200_DLFP_CFG=5
|
||||||
IMU_NAVGO_SRCS += peripherals/itg3200.c
|
IMU_NAVGO_SRCS += peripherals/itg3200.c
|
||||||
|
|
||||||
IMU_NAVGO_CFLAGS += -DADXL345_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
|
IMU_NAVGO_CFLAGS += -DADXL345_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
|
||||||
IMU_NAVGO_CFLAGS += -DADXL345_I2C_ADDR=ADXL345_ADDR_ALT
|
IMU_NAVGO_CFLAGS += -DADXL345_I2C_ADDR=ADXL345_ADDR_ALT
|
||||||
|
IMU_NAVGO_CFLAGS += -DADXL345_BW_RATE=0x8
|
||||||
IMU_NAVGO_SRCS += peripherals/adxl345.i2c.c
|
IMU_NAVGO_SRCS += peripherals/adxl345.i2c.c
|
||||||
|
|
||||||
IMU_NAVGO_CFLAGS += -DHMC58XX_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
|
IMU_NAVGO_CFLAGS += -DHMC58XX_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
|
||||||
|
|||||||
@@ -193,7 +193,9 @@ void SPI1_ISR(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bit_is_set(SSPMIS, RTMIS)) { /* Rx fifo is not empty and no receive took place in the last 32 bits period */
|
if (bit_is_set(SSPMIS, RTMIS)) { /* Rx fifo is not empty and no receive took place in the last 32 bits period */
|
||||||
|
#if !SPI_NO_UNSELECT_SLAVE
|
||||||
SpiUnselectCurrentSlave();
|
SpiUnselectCurrentSlave();
|
||||||
|
#endif
|
||||||
SpiReceive();
|
SpiReceive();
|
||||||
SpiDisableRti();
|
SpiDisableRti();
|
||||||
SpiClearRti(); /* clear interrupt */
|
SpiClearRti(); /* clear interrupt */
|
||||||
|
|||||||
@@ -31,53 +31,51 @@
|
|||||||
/* Common Baro struct */
|
/* Common Baro struct */
|
||||||
struct Baro baro;
|
struct Baro baro;
|
||||||
|
|
||||||
/* Number of values to compute an offset at startup */
|
/* Counter to init mcp355x at startup */
|
||||||
#define OFFSET_NBSAMPLES_AVRG 300
|
#define STARTUP_COUNTER 200
|
||||||
uint16_t offset_cnt;
|
uint16_t startup_cnt;
|
||||||
|
|
||||||
#ifdef USE_BARO_AS_ALTIMETER
|
|
||||||
/* Weight for offset IIR filter */
|
|
||||||
#define OFFSET_FILTER 7
|
|
||||||
|
|
||||||
float baro_alt;
|
|
||||||
float baro_alt_offset;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void baro_init( void ) {
|
void baro_init( void ) {
|
||||||
ads1114_init();
|
mcp355x_init();
|
||||||
baro.status = BS_UNINITIALIZED;
|
baro.status = BS_UNINITIALIZED;
|
||||||
baro.absolute = 0;
|
baro.absolute = 0;
|
||||||
baro.differential = 0; /* not handled on this board */
|
baro.differential = 0; /* not handled on this board */
|
||||||
#ifdef ROTORCRAFT_BARO_LED
|
#ifdef ROTORCRAFT_BARO_LED
|
||||||
LED_OFF(ROTORCRAFT_BARO_LED);
|
LED_OFF(ROTORCRAFT_BARO_LED);
|
||||||
#endif
|
#endif
|
||||||
offset_cnt = OFFSET_NBSAMPLES_AVRG;
|
startup_cnt = STARTUP_COUNTER;
|
||||||
#ifdef USE_BARO_AS_ALTIMETER
|
|
||||||
baro_alt = 0.;
|
|
||||||
baro_alt_offset = 0.;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Need to play with slave select
|
||||||
|
#include "mcu_periph/spi.h"
|
||||||
|
|
||||||
void baro_periodic( void ) {
|
void baro_periodic( void ) {
|
||||||
|
|
||||||
if (baro.status == BS_UNINITIALIZED) {
|
if (baro.status == BS_UNINITIALIZED) {
|
||||||
#ifdef USE_BARO_AS_ALTIMETER
|
/**
|
||||||
// IIR filter to compute an initial offset
|
* Crappy code to empty the buffer
|
||||||
baro_alt_offset = (OFFSET_FILTER * baro_alt_offset + (float)baro.absolute) / (OFFSET_FILTER + 1);
|
* then unselect the device (goes to shutdown ?)
|
||||||
#endif
|
* reselect to go to continious conversion mode
|
||||||
|
* make some readings before setting BS_RUNNING
|
||||||
|
* don't unselect the slave !
|
||||||
|
*/
|
||||||
|
if (startup_cnt == 150) { SpiSelectSlave0(); mcp355x_read(); }
|
||||||
|
else if (startup_cnt == 149) { SpiUnselectSlave0(); }
|
||||||
|
else if (startup_cnt == 100) { SpiSelectSlave0(); }
|
||||||
|
else if (startup_cnt < 90) { RunOnceEvery(4, mcp355x_read()); }
|
||||||
// decrease init counter
|
// decrease init counter
|
||||||
--offset_cnt;
|
--startup_cnt;
|
||||||
#ifdef ROTORCRAFT_BARO_LED
|
#ifdef ROTORCRAFT_BARO_LED
|
||||||
LED_TOGGLE(ROTORCRAFT_BARO_LED);
|
LED_TOGGLE(ROTORCRAFT_BARO_LED);
|
||||||
#endif
|
#endif
|
||||||
if (offset_cnt == 0) {
|
if (startup_cnt == 0) {
|
||||||
baro.status = BS_RUNNING;
|
baro.status = BS_RUNNING;
|
||||||
#ifdef ROTORCRAFT_BARO_LED
|
#ifdef ROTORCRAFT_BARO_LED
|
||||||
LED_ON(ROTORCRAFT_BARO_LED);
|
LED_ON(ROTORCRAFT_BARO_LED);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Read the ADC
|
// Read the ADC (at 50/4 Hz, conversion time is 68 ms)
|
||||||
ads1114_read();
|
else { RunOnceEvery(4,mcp355x_read()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,22 +31,16 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "std.h"
|
#include "std.h"
|
||||||
#include "peripherals/ads1114.h"
|
#include "peripherals/mcp355x.h"
|
||||||
|
|
||||||
#ifdef USE_BARO_AS_ALTIMETER
|
|
||||||
extern float baro_alt;
|
|
||||||
extern float baro_alt_offset;
|
|
||||||
#define BaroAltHandler() { baro_alt = BARO_SENS*(baro_alt_offset - (float)baro.absolute); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BARO_FILTER_GAIN 5
|
#define BARO_FILTER_GAIN 5
|
||||||
|
|
||||||
#define BaroEvent(_b_abs_handler, _b_diff_handler) { \
|
#define BaroEvent(_b_abs_handler, _b_diff_handler) { \
|
||||||
Ads1114Event(); \
|
mcp355x_event(); \
|
||||||
if (ads1114_data_available) { \
|
if (mcp355x_data_available) { \
|
||||||
baro.absolute = (baro.absolute + BARO_FILTER_GAIN*Ads1114GetValue()) / (BARO_FILTER_GAIN+1); \
|
baro.absolute = (baro.absolute + BARO_FILTER_GAIN*mcp355x_data) / (BARO_FILTER_GAIN+1); \
|
||||||
_b_abs_handler(); \
|
_b_abs_handler(); \
|
||||||
ads1114_data_available = FALSE; \
|
mcp355x_data_available = FALSE; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ void imu_navgo_event( void )
|
|||||||
// If the itg3200 I2C transaction has succeeded: convert the data
|
// If the itg3200 I2C transaction has succeeded: convert the data
|
||||||
itg3200_event();
|
itg3200_event();
|
||||||
if (itg3200_data_available) {
|
if (itg3200_data_available) {
|
||||||
RATES_COPY(imu.gyro_unscaled, itg3200_data);
|
RATES_ASSIGN(imu.gyro_unscaled, -itg3200_data.q, itg3200_data.p, itg3200_data.r);
|
||||||
itg3200_data_available = FALSE;
|
itg3200_data_available = FALSE;
|
||||||
gyr_valid = TRUE;
|
gyr_valid = TRUE;
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ void imu_navgo_event( void )
|
|||||||
// HMC58XX event task
|
// HMC58XX event task
|
||||||
hmc58xx_event();
|
hmc58xx_event();
|
||||||
if (hmc58xx_data_available) {
|
if (hmc58xx_data_available) {
|
||||||
VECT3_ASSIGN(imu.mag_unscaled, -hmc58xx_data.x, -hmc58xx_data.y, hmc58xx_data.z);
|
VECT3_ASSIGN(imu.mag_unscaled, hmc58xx_data.x, hmc58xx_data.y, hmc58xx_data.z);
|
||||||
hmc58xx_data_available = FALSE;
|
hmc58xx_data_available = FALSE;
|
||||||
mag_valid = TRUE;
|
mag_valid = TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,17 +18,17 @@
|
|||||||
#define PCLK (CCLK / PBSD_VAL)
|
#define PCLK (CCLK / PBSD_VAL)
|
||||||
|
|
||||||
/* Onboard LEDs */
|
/* Onboard LEDs */
|
||||||
#define LED_1_BANK 1
|
#define LED_1_BANK 0
|
||||||
#define LED_1_PIN 25
|
#define LED_1_PIN 22
|
||||||
|
|
||||||
#define LED_2_BANK 1
|
#define LED_2_BANK 1
|
||||||
#define LED_2_PIN 24
|
#define LED_2_PIN 28
|
||||||
|
|
||||||
#define LED_3_BANK 1
|
#define LED_3_BANK 1
|
||||||
#define LED_3_PIN 23
|
#define LED_3_PIN 29
|
||||||
|
|
||||||
#define LED_4_BANK 1
|
#define LED_4_BANK 1
|
||||||
#define LED_4_PIN 31
|
#define LED_4_PIN 30
|
||||||
|
|
||||||
/* PPM : rc rx on P0.28 ( CAP0.2 ) */
|
/* PPM : rc rx on P0.28 ( CAP0.2 ) */
|
||||||
#define PPM_PINSEL PINSEL1
|
#define PPM_PINSEL PINSEL1
|
||||||
@@ -45,19 +45,22 @@
|
|||||||
/* battery */
|
/* battery */
|
||||||
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
|
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
|
||||||
#ifndef ADC_CHANNEL_VSUPPLY
|
#ifndef ADC_CHANNEL_VSUPPLY
|
||||||
#define ADC_CHANNEL_VSUPPLY AdcBank1(3)
|
#define ADC_CHANNEL_VSUPPLY AdcBank0(2)
|
||||||
#ifndef USE_AD1
|
#ifndef USE_AD0
|
||||||
#define USE_AD1
|
#define USE_AD0
|
||||||
#endif
|
#endif
|
||||||
#define USE_AD1_3
|
#define USE_AD0_2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DefaultVoltageOfAdc(adc) (0.01837*adc)
|
#define DefaultVoltageOfAdc(adc) (0.017889*adc)
|
||||||
|
|
||||||
/* SPI (SSP) */
|
/* SPI (SSP) */
|
||||||
#define SPI_SELECT_SLAVE0_PORT 0
|
#define SPI_SELECT_SLAVE0_PORT 0
|
||||||
#define SPI_SELECT_SLAVE0_PIN 20
|
#define SPI_SELECT_SLAVE0_PIN 20
|
||||||
|
|
||||||
|
//#define SPI_SELECT_SLAVE1_PORT 1
|
||||||
|
//#define SPI_SELECT_SLAVE1_PIN 19
|
||||||
|
|
||||||
#define SPI1_DRDY_PINSEL PINSEL1
|
#define SPI1_DRDY_PINSEL PINSEL1
|
||||||
#define SPI1_DRDY_PINSEL_BIT 0
|
#define SPI1_DRDY_PINSEL_BIT 0
|
||||||
#define SPI1_DRDY_PINSEL_VAL 1
|
#define SPI1_DRDY_PINSEL_VAL 1
|
||||||
|
|||||||
@@ -41,32 +41,20 @@ void mcp355x_init(void) {
|
|||||||
void mcp355x_read(void) {
|
void mcp355x_read(void) {
|
||||||
spi_buffer_length = 4;
|
spi_buffer_length = 4;
|
||||||
spi_buffer_input = mcp355x_spi_buf;
|
spi_buffer_input = mcp355x_spi_buf;
|
||||||
SpiSelectSlave0();
|
//SpiSelectSlave0();
|
||||||
SpiStart();
|
SpiStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DOWNLINK_DEVICE
|
|
||||||
#define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "mcu_periph/uart.h"
|
|
||||||
#include "messages.h"
|
|
||||||
#include "downlink.h"
|
|
||||||
|
|
||||||
void mcp355x_event(void) {
|
void mcp355x_event(void) {
|
||||||
static uint32_t filtered = 0;
|
|
||||||
if (spi_message_received) {
|
if (spi_message_received) {
|
||||||
spi_message_received = FALSE;
|
spi_message_received = FALSE;
|
||||||
if ((mcp355x_spi_buf[0]>>4) == 0) {
|
if ((mcp355x_spi_buf[0]>>4) == 0) {
|
||||||
//mcp355x_data = (int32_t)(((uint32_t)mcp355x_spi_buf[0]<<16) | ((uint32_t)mcp355x_spi_buf[1]<<8) | (mcp355x_spi_buf[2]));
|
|
||||||
mcp355x_data = (int32_t)(
|
mcp355x_data = (int32_t)(
|
||||||
((uint32_t)mcp355x_spi_buf[0]<<17) |
|
((uint32_t)mcp355x_spi_buf[0]<<17) |
|
||||||
((uint32_t)mcp355x_spi_buf[1]<<9) |
|
((uint32_t)mcp355x_spi_buf[1]<<9) |
|
||||||
((uint32_t)mcp355x_spi_buf[2]<<1) |
|
((uint32_t)mcp355x_spi_buf[2]<<1) |
|
||||||
(mcp355x_spi_buf[3]>>7));
|
(mcp355x_spi_buf[3]>>7));
|
||||||
filtered = (5*filtered + mcp355x_data) / (6);
|
mcp355x_data_available = TRUE;
|
||||||
DOWNLINK_SEND_DEBUG(DefaultChannel,4,mcp355x_spi_buf);
|
|
||||||
DOWNLINK_SEND_BARO_RAW(DefaultChannel,&mcp355x_data,&filtered);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user