fixing spi communications test between overo and stm

This commit is contained in:
Antoine Drouin
2010-06-18 13:51:00 +00:00
parent 63b60dbb55
commit 4acd6415b2
9 changed files with 165 additions and 20 deletions
+1 -3
View File
@@ -91,7 +91,7 @@ main_stm32.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DE
main_stm32.srcs += downlink.c pprz_transport.c
main_stm32.CFLAGS += -DUSE_OVERO_LINK -DOVERO_LINK_MSG_UNION=AutopilotMessageBeth
main_stm32.CFLAGS += -DOVERO_LINK_LED_OK=3 -DOVERO_LINK_LED_KO=4 -DUSE_DMA1_C2_IRQ
main_stm32.CFLAGS += -DOVERO_LINK_LED_OK=5 -DOVERO_LINK_LED_KO=4 -DUSE_DMA1_C2_IRQ
main_stm32.srcs += lisa/lisa_overo_link.c lisa/arch/stm32/lisa_overo_link_arch.c
main_stm32.CFLAGS += -DBOOZ_IMU_TYPE_H=\"imu/booz_imu_b2.h\"
@@ -170,8 +170,6 @@ main_overo.srcs += $(SRC_FMS)/fms_spi_link.c
#
include $(PAPARAZZI_SRC)/conf/autopilot/lisa_test_progs.makefile
include $(PAPARAZZI_SRC)/conf/autopilot/lisa_passthrough.makefile
</makefile>
</airframe>
+103
View File
@@ -0,0 +1,103 @@
<!-- this is the biplan equiped with Lisa/L#XXX and asctec V2 controllers -->
<airframe name="booz2_a7">
<servos min="0" neutral="0" max="0xff">
<servo name="FRONT" no="0" min="0" neutral="0" max="255"/>
<servo name="BACK" no="1" min="0" neutral="0" max="255"/>
<servo name="LEFT" no="2" min="0" neutral="0" max="255"/>
<servo name="RIGHT" no="3" min="0" neutral="0" max="255"/>
</servos>
<commands>
<axis name="PITCH" failsafe_value="0"/>
<axis name="ROLL" failsafe_value="0"/>
<axis name="YAW" failsafe_value="0"/>
<axis name="THRUST" failsafe_value="0"/>
</commands>
<section name="SUPERVISION" prefix="SUPERVISION_">
<define name="MIN_MOTOR" value="3"/>
<define name="MAX_MOTOR" value="200"/>
<define name="TRIM_A" value="0"/>
<define name="TRIM_E" value="0"/>
<define name="TRIM_R" value="0"/>
<define name="NB_MOTOR" value="4"/>
<define name="SCALE" value="256"/>
<define name="ROLL_COEF" value="{ 0 , 0, 256, -256 }"/>
<define name="PITCH_COEF" value="{ 256, -256, 0, 0 }"/>
<define name="YAW_COEF" value="{ 256, 256, -256, -256 }"/>
<define name="THRUST_COEF" value="{ 256, 256, 256, 256 }"/>
</section>
<section name="IMU" prefix="IMU_">
<define name="GYRO_P_NEUTRAL" value="31948"/>
<define name="GYRO_Q_NEUTRAL" value="31834"/>
<define name="GYRO_R_NEUTRAL" value="32687"/>
<define name="GYRO_P_SENS" value=" 1.101357422" integer="16"/>
<define name="GYRO_Q_SENS" value="-1.122670898" integer="16"/>
<define name="GYRO_R_SENS" value="-1.104890137" integer="16"/>
<define name="ACCEL_X_SENS" value="-2.58273701242" integer="16"/>
<define name="ACCEL_Y_SENS" value="-2.54076215332" integer="16"/>
<define name="ACCEL_Z_SENS" value="-2.57633620646" integer="16"/>
<define name="ACCEL_X_NEUTRAL" value="32857"/>
<define name="ACCEL_Y_NEUTRAL" value="32429"/>
<define name="ACCEL_Z_NEUTRAL" value="32593"/>
<define name="MAG_X_SENS" value=" 5.32718104135" integer="16"/>
<define name="MAG_Y_SENS" value="-4.87857821202" integer="16"/>
<define name="MAG_Z_SENS" value="-3.11986612709" integer="16"/>
<define name="MAG_X_NEUTRAL" value="-43"/>
<define name="MAG_Y_NEUTRAL" value=" 49"/>
<define name="MAG_Z_NEUTRAL" value="-66"/>
<define name="BODY_TO_IMU_PHI" value="RadOfDeg( 0.)"/>
<define name="BODY_TO_IMU_THETA" value="RadOfDeg( 0.)"/>
<define name="BODY_TO_IMU_PSI" value="RadOfDeg( 45.)"/>
</section>
<section name="BAT">
<define name="MILLIAMP_PER_PERCENT" value="0.86"/>
<define name="CATASTROPHIC_BAT_LEVEL" value="9.3" unit="V"/>
<define name="BATTERY_SENS" value="0.48" integer="16"/>
</section>
<makefile>
USER =
#HOST = 10.31.4.22
#HOST = overo
HOST = beth
TARGET_DIR = ~
SRC_FMS=fms
ARCH=stm32
ARCHI=stm32
BOARD_CFG=\"boards/lisa_0.99.h\"
FLASH_MODE = JTAG
include $(PAPARAZZI_SRC)/conf/autopilot/lisa_test_progs.makefile
include $(PAPARAZZI_SRC)/conf/autopilot/lisa_passthrough.makefile
#
#
#
</makefile>
</airframe>
+5 -4
View File
@@ -29,7 +29,7 @@ pt.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uar
pt.srcs += downlink.c pprz_transport.c
# Link Overo
pt.CFLAGS += -DUSE_OVERO_LINK -DOVERO_LINK_MSG_UNION=AutopilotMessageBeth
pt.CFLAGS += -DUSE_OVERO_LINK -DOVERO_LINK_MSG_UNION=AutopilotMessagePT
pt.CFLAGS += -DOVERO_LINK_LED_OK=3 -DOVERO_LINK_LED_KO=4 -DUSE_DMA1_C2_IRQ
pt.srcs += lisa/lisa_overo_link.c lisa/arch/stm32/lisa_overo_link_arch.c
@@ -57,8 +57,9 @@ pt.CFLAGS += -DRADIO_CONTROL_LINK=Uart3
# Actuators
pt.srcs += $(SRC_BOOZ)/actuators/booz_supervision.c
pt.srcs += $(SRC_BOOZ)/actuators/booz_actuators_mkk.c
pt.srcs += $(SRC_BOOZ_ARCH)/actuators/booz_actuators_mkk_arch.c
pt.CFLAGS += -DACTUATORS_ASCTEC_V2_PROTOCOL
pt.srcs += $(SRC_BOOZ)/actuators/booz_actuators_asctec.c
pt.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
pt.CFLAGS += -DACTUATORS_MKK_DEVICE=i2c1 -DUSE_TIM2_IRQ
pt.CFLAGS += -DACTUATORS_ASCTEC_DEVICE=i2c1
pt.CFLAGS += -DUSE_I2C1
+2 -2
View File
@@ -684,7 +684,7 @@ test_baro3.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
#
# test spi slave
# test spi slave ( hardcoded SPI without DMA )
#
test_spi_slave.ARCHDIR = $(ARCHI)
test_spi_slave.TARGET = test_spi_slave
@@ -707,7 +707,7 @@ test_spi_slave.srcs += downlink.c pprz_transport.c
#
# test spi slave2 ( with DMA )
# test spi slave2 ( hardcoded SPI with DMA )
#
test_spi_slave2.ARCHDIR = $(ARCHI)
test_spi_slave2.TARGET = test_spi_slave2
+2 -1
View File
@@ -60,11 +60,12 @@ static void send_message() {
spi_link_send(msg_out, sizeof(union AutopilotMessageBeth), msg_in);
// if (!foo%100) {
if (0) {
printf("%d -> %d %d %d %d %d %d %d %d %d\n", foo,
msg_in->bench_sensor.x, msg_in->bench_sensor.y, msg_in->bench_sensor.z,
msg_in->gyro.x, msg_in->gyro.y, msg_in->gyro.z,
msg_in->accel.x, msg_in->accel.y, msg_in->accel.z);
// }
}
foo++;
}
+3 -3
View File
@@ -64,14 +64,14 @@ static inline void main_init( void ) {
actuators_init();
// radio_control_init();
// booz_imu_init();
// overo_link_init();
overo_link_init();
bench_sensors_init();
}
static inline void main_periodic( void ) {
// booz_imu_periodic();
actuators_set(FALSE);
// OveroLinkPeriodic(main_on_overo_link_lost)
OveroLinkPeriodic(main_on_overo_link_lost)
RunOnceEvery(10, {LED_PERIODIC(); DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});
read_bench_sensors();
@@ -80,7 +80,7 @@ static inline void main_periodic( void ) {
static inline void main_event( void ) {
// BoozImuEvent(on_gyro_accel_event, on_mag_event);
// OveroLinkEvent(main_on_overo_msg_received);
OveroLinkEvent(main_on_overo_msg_received);
BenchSensorsEvent(main_on_bench_sensors);
+43
View File
@@ -4,10 +4,15 @@
#include <inttypes.h>
#include "math/pprz_algebra_int.h"
/*
* Testing
*/
struct AutopilotMessageFoo {
uint8_t foo;
uint8_t bar;
uint8_t blaa;
uint8_t bli;
};
union AutopilotMessageFoo1 {
@@ -15,6 +20,10 @@ union AutopilotMessageFoo1 {
struct AutopilotMessageFoo down;
};
/*
* BETH
*/
struct AutopilotMessageBethUp {
struct Int16Vect3 gyro;
struct Int16Vect3 accel;
@@ -33,6 +42,9 @@ union AutopilotMessageBeth {
};
/*
* STM Telemetry through wifi
*/
#define TW_BUF_LEN 63
struct AutopilotMessageTWUp {
uint8_t tw_len;
@@ -49,5 +61,36 @@ union AutopilotMessageTW {
struct AutopilotMessageTWDown down;
};
/*
* Passthrough, aka biplan
*/
struct AutopilotMessagePTUp {
struct Int16Vect3 gyro;
struct Int16Vect3 accel;
struct Int16Vect3 mag;
int16_t rc_pitch;
int16_t rc_roll;
int16_t rc_yaw;
int16_t rc_thrust;
int16_t rc_mode;
uint8_t rc_status;
};
struct AutopilotMessagePTDown {
int16_t command_pitch;
int16_t command_roll;
int16_t command_yaw;
int16_t command_thrust;
};
union AutopilotMessagePT {
struct AutopilotMessageBethUp up;
struct AutopilotMessageBethDown down;
};
#endif /* FMS_AUTOPILOT_H */
+6 -5
View File
@@ -49,8 +49,8 @@ int main(int argc, char *argv[]) {
spi_link_send(&msg_out, sizeof(struct AutopilotMessageFoo), &msg_in);
if (memcmp(&msg_in, &msg_out_prev, sizeof(msg_in))) {
printf("compare failed\n");
printf("expected %d %d %d\n", msg_out_prev.foo, msg_out_prev.bar, msg_out_prev.blaa);
printf("got %d %d %d\n\n", msg_in.foo, msg_in.bar, msg_in.blaa);
printf("expected %d %d %d %d\n", msg_out_prev.foo, msg_out_prev.bar, msg_out_prev.blaa, msg_out_prev.bli);
printf("got %d %d %d %d\n\n", msg_in.foo, msg_in.bar, msg_in.blaa, msg_in.bli);
}
else {
static uint32_t foo = 0;
@@ -60,7 +60,7 @@ int main(int argc, char *argv[]) {
}
}
usleep(1953);
//usleep(50000);
// usleep(50000);
}
return 0;
@@ -71,7 +71,8 @@ int main(int argc, char *argv[]) {
static void fill_msg(struct AutopilotMessageFoo* msg) {
static uint32_t foo = 0;
msg->foo = foo;
msg->bar = foo+1;
msg->blaa = foo+2;
msg->bar = foo+2;
msg->blaa = foo+4;
msg->bli = foo+8;
foo++;
}
-2
View File
@@ -36,8 +36,6 @@ static inline void main_event( void );
static inline void on_overo_msg_received(void);
static inline void on_overo_link_lost(void);
struct AutopilotMessageFoo my_msg;
int main(void) {
hw_init();