mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-28 01:53:48 +08:00
fixing spi communications test between overo and stm
This commit is contained in:
@@ -91,7 +91,7 @@ main_stm32.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DE
|
|||||||
main_stm32.srcs += downlink.c pprz_transport.c
|
main_stm32.srcs += downlink.c pprz_transport.c
|
||||||
|
|
||||||
main_stm32.CFLAGS += -DUSE_OVERO_LINK -DOVERO_LINK_MSG_UNION=AutopilotMessageBeth
|
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.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\"
|
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_test_progs.makefile
|
||||||
|
|
||||||
include $(PAPARAZZI_SRC)/conf/autopilot/lisa_passthrough.makefile
|
|
||||||
|
|
||||||
</makefile>
|
</makefile>
|
||||||
|
|
||||||
</airframe>
|
</airframe>
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -29,7 +29,7 @@ pt.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uar
|
|||||||
pt.srcs += downlink.c pprz_transport.c
|
pt.srcs += downlink.c pprz_transport.c
|
||||||
|
|
||||||
# Link Overo
|
# 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.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
|
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
|
# Actuators
|
||||||
pt.srcs += $(SRC_BOOZ)/actuators/booz_supervision.c
|
pt.srcs += $(SRC_BOOZ)/actuators/booz_supervision.c
|
||||||
pt.srcs += $(SRC_BOOZ)/actuators/booz_actuators_mkk.c
|
pt.CFLAGS += -DACTUATORS_ASCTEC_V2_PROTOCOL
|
||||||
pt.srcs += $(SRC_BOOZ_ARCH)/actuators/booz_actuators_mkk_arch.c
|
pt.srcs += $(SRC_BOOZ)/actuators/booz_actuators_asctec.c
|
||||||
pt.srcs += i2c.c $(SRC_ARCH)/i2c_hw.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
|
pt.CFLAGS += -DUSE_I2C1
|
||||||
|
|||||||
@@ -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.ARCHDIR = $(ARCHI)
|
||||||
test_spi_slave.TARGET = test_spi_slave
|
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.ARCHDIR = $(ARCHI)
|
||||||
test_spi_slave2.TARGET = test_spi_slave2
|
test_spi_slave2.TARGET = test_spi_slave2
|
||||||
|
|||||||
@@ -60,11 +60,12 @@ static void send_message() {
|
|||||||
|
|
||||||
spi_link_send(msg_out, sizeof(union AutopilotMessageBeth), msg_in);
|
spi_link_send(msg_out, sizeof(union AutopilotMessageBeth), msg_in);
|
||||||
// if (!foo%100) {
|
// if (!foo%100) {
|
||||||
|
if (0) {
|
||||||
printf("%d -> %d %d %d %d %d %d %d %d %d\n", foo,
|
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->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->gyro.x, msg_in->gyro.y, msg_in->gyro.z,
|
||||||
msg_in->accel.x, msg_in->accel.y, msg_in->accel.z);
|
msg_in->accel.x, msg_in->accel.y, msg_in->accel.z);
|
||||||
// }
|
}
|
||||||
foo++;
|
foo++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,14 +64,14 @@ static inline void main_init( void ) {
|
|||||||
actuators_init();
|
actuators_init();
|
||||||
// radio_control_init();
|
// radio_control_init();
|
||||||
// booz_imu_init();
|
// booz_imu_init();
|
||||||
// overo_link_init();
|
overo_link_init();
|
||||||
bench_sensors_init();
|
bench_sensors_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void main_periodic( void ) {
|
static inline void main_periodic( void ) {
|
||||||
// booz_imu_periodic();
|
// booz_imu_periodic();
|
||||||
actuators_set(FALSE);
|
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);});
|
RunOnceEvery(10, {LED_PERIODIC(); DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});
|
||||||
|
|
||||||
read_bench_sensors();
|
read_bench_sensors();
|
||||||
@@ -80,7 +80,7 @@ static inline void main_periodic( void ) {
|
|||||||
|
|
||||||
static inline void main_event( void ) {
|
static inline void main_event( void ) {
|
||||||
// BoozImuEvent(on_gyro_accel_event, on_mag_event);
|
// 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);
|
BenchSensorsEvent(main_on_bench_sensors);
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,15 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include "math/pprz_algebra_int.h"
|
#include "math/pprz_algebra_int.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Testing
|
||||||
|
*/
|
||||||
|
|
||||||
struct AutopilotMessageFoo {
|
struct AutopilotMessageFoo {
|
||||||
uint8_t foo;
|
uint8_t foo;
|
||||||
uint8_t bar;
|
uint8_t bar;
|
||||||
uint8_t blaa;
|
uint8_t blaa;
|
||||||
|
uint8_t bli;
|
||||||
};
|
};
|
||||||
|
|
||||||
union AutopilotMessageFoo1 {
|
union AutopilotMessageFoo1 {
|
||||||
@@ -15,6 +20,10 @@ union AutopilotMessageFoo1 {
|
|||||||
struct AutopilotMessageFoo down;
|
struct AutopilotMessageFoo down;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BETH
|
||||||
|
*/
|
||||||
struct AutopilotMessageBethUp {
|
struct AutopilotMessageBethUp {
|
||||||
struct Int16Vect3 gyro;
|
struct Int16Vect3 gyro;
|
||||||
struct Int16Vect3 accel;
|
struct Int16Vect3 accel;
|
||||||
@@ -33,6 +42,9 @@ union AutopilotMessageBeth {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* STM Telemetry through wifi
|
||||||
|
*/
|
||||||
#define TW_BUF_LEN 63
|
#define TW_BUF_LEN 63
|
||||||
struct AutopilotMessageTWUp {
|
struct AutopilotMessageTWUp {
|
||||||
uint8_t tw_len;
|
uint8_t tw_len;
|
||||||
@@ -49,5 +61,36 @@ union AutopilotMessageTW {
|
|||||||
struct AutopilotMessageTWDown down;
|
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 */
|
#endif /* FMS_AUTOPILOT_H */
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ int main(int argc, char *argv[]) {
|
|||||||
spi_link_send(&msg_out, sizeof(struct AutopilotMessageFoo), &msg_in);
|
spi_link_send(&msg_out, sizeof(struct AutopilotMessageFoo), &msg_in);
|
||||||
if (memcmp(&msg_in, &msg_out_prev, sizeof(msg_in))) {
|
if (memcmp(&msg_in, &msg_out_prev, sizeof(msg_in))) {
|
||||||
printf("compare failed\n");
|
printf("compare failed\n");
|
||||||
printf("expected %d %d %d\n", msg_out_prev.foo, msg_out_prev.bar, msg_out_prev.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\n\n", msg_in.foo, msg_in.bar, msg_in.blaa);
|
printf("got %d %d %d %d\n\n", msg_in.foo, msg_in.bar, msg_in.blaa, msg_in.bli);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
static uint32_t foo = 0;
|
static uint32_t foo = 0;
|
||||||
@@ -60,7 +60,7 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
usleep(1953);
|
usleep(1953);
|
||||||
//usleep(50000);
|
// usleep(50000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -71,7 +71,8 @@ int main(int argc, char *argv[]) {
|
|||||||
static void fill_msg(struct AutopilotMessageFoo* msg) {
|
static void fill_msg(struct AutopilotMessageFoo* msg) {
|
||||||
static uint32_t foo = 0;
|
static uint32_t foo = 0;
|
||||||
msg->foo = foo;
|
msg->foo = foo;
|
||||||
msg->bar = foo+1;
|
msg->bar = foo+2;
|
||||||
msg->blaa = foo+2;
|
msg->blaa = foo+4;
|
||||||
|
msg->bli = foo+8;
|
||||||
foo++;
|
foo++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ static inline void main_event( void );
|
|||||||
static inline void on_overo_msg_received(void);
|
static inline void on_overo_msg_received(void);
|
||||||
static inline void on_overo_link_lost(void);
|
static inline void on_overo_link_lost(void);
|
||||||
|
|
||||||
struct AutopilotMessageFoo my_msg;
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
|
||||||
hw_init();
|
hw_init();
|
||||||
|
|||||||
Reference in New Issue
Block a user