*** empty log message ***

This commit is contained in:
Antoine Drouin
2006-06-26 02:26:53 +00:00
parent cdc90ccb1f
commit 4582c96629
13 changed files with 108 additions and 374 deletions
-2
View File
@@ -164,8 +164,6 @@ upload_bl: bl
lpc21iap: lpc21iap:
cd sw/ground_segment/lpc21iap; make cd sw/ground_segment/lpc21iap; make
##### #####
##### #####
+2 -1
View File
@@ -51,7 +51,7 @@ THUMB_IW = -mthumb-interwork
# Output format. (can be srec, ihex, binary) # Output format. (can be srec, ihex, binary)
FORMAT = ihex FORMAT = ihex
FLASH_MODE=ISP #FLASH_MODE=ISP
$(TARGET).srcsnd = $(notdir $($(TARGET).srcs)) $(TARGET).srcsnd = $(notdir $($(TARGET).srcs))
SRCARM = $($(TARGET).srcsnd) SRCARM = $($(TARGET).srcsnd)
@@ -62,6 +62,7 @@ ASRCARM = crt0.S
# 0 = turn off optimization. s = optimize for size. # 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) # (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s OPT = s
#OPT=3
CSTANDARD = -std=gnu99 CSTANDARD = -std=gnu99
+10 -2
View File
@@ -11,13 +11,17 @@ imu.TARGETDIR = imu
LPC21ISP_BAUD = 38400 LPC21ISP_BAUD = 38400
LPC21ISP_XTAL = 12000 LPC21ISP_XTAL = 12000
FLASH_MODE = IAP
#FLASH_MODE = ISP
imu.CFLAGS += -DCONFIG=\"pprz_imu.h\" imu.CFLAGS += -DCONFIG=\"pprz_imu.h\"
imu.srcs = main_imu.c sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c imu.srcs = main_imu.c sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c
imu.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400 #imu.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400
imu.srcs += $(SRC_ARCH)/uart_hw.c imu.srcs += $(SRC_ARCH)/uart_hw.c
imu.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B9600 imu.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B9600 -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1
imu.srcs += downlink.c pprz_transport.c
imu.CFLAGS += -DADC -DUSE_AD0 -DUSE_AD0_1 -DUSE_AD0_2 -DUSE_AD0_3 -DUSE_AD0_4 imu.CFLAGS += -DADC -DUSE_AD0 -DUSE_AD0_1 -DUSE_AD0_2 -DUSE_AD0_3 -DUSE_AD0_4
imu.srcs += $(SRC_ARCH)/adc_hw.c imu.srcs += $(SRC_ARCH)/adc_hw.c
@@ -25,6 +29,10 @@ imu.srcs += $(SRC_ARCH)/adc_hw.c
imu.srcs += $(SRC_ARCH)/max1167.c imu.srcs += $(SRC_ARCH)/max1167.c
imu.srcs += $(SRC_ARCH)/micromag.c imu.srcs += $(SRC_ARCH)/micromag.c
imu.srcs += imu_v3.c
imu.srcs += ahrs_new.c
</makefile> </makefile>
</airframe> </airframe>
+14 -27
View File
@@ -112,24 +112,6 @@
<field name="desired_climb" type="float" format="%.1f"></field> <field name="desired_climb" type="float" format="%.1f"></field>
</message> </message>
<message name="RAW_IMU" ID="17">
<field name="gyro_x" type="float"/>
<field name="gyro_y" type="float"/>
<field name="gyro_z" type="float"/>
<field name="accel_x" type="float"/>
<field name="accel_y" type="float"/>
<field name="accel_z" type="float"/>
</message>
<message name="KALMAN" ID="18">
<field name="phi" type="float" format="%.3f"/>
<field name="phi_dot" type="float" format="%.3f"/>
<field name="phi_bias" type="float" format="%.3f"/>
<field name="theta" type="float" format="%.3f"/>
<field name="theta_dot" type="float" format="%.3f"/>
<field name="theta_bias" type="float" format="%.3f"/>
</message>
<message name="CAM" ID="20"> <message name="CAM" ID="20">
<field name="phi" type="int8" unit="deg"/> <field name="phi" type="int8" unit="deg"/>
<field name="theta" type="int8" unit="deg"/> <field name="theta" type="int8" unit="deg"/>
@@ -178,15 +160,6 @@
<field name="Azim" type="int16" unit="deg"/> <field name="Azim" type="int16" unit="deg"/>
</message> </message>
<message name="IMU" ID="26">
<field name="roll_dot" type="int16"/>
<field name="pitch_dot" type="int16"/>
<field name="yaw_dot" type="int16"/>
<field name="roll" type="int16"/>
<field name="pitch" type="int16"/>
<field name="yaw" type="int16"/>
</message>
<message name="SURVEY" ID="27"> <message name="SURVEY" ID="27">
<field name="east" type="float" unit="m"/> <field name="east" type="float" unit="m"/>
<field name="north" type="float" unit="m"/> <field name="north" type="float" unit="m"/>
@@ -264,6 +237,20 @@
<message name="ACTUATORS" ID="105"> <message name="ACTUATORS" ID="105">
<field name="values" type="uint16[]" unit="none"/> <field name="values" type="uint16[]" unit="none"/>
</message> </message>
<message name="IMU_SENSORS" ID="200">
<field name="accel_x" type="int16"/>
<field name="accel_y" type="int16"/>
<field name="accel_z" type="int16"/>
<field name="gyro_p" type="float" unit="rad/s"/>
<field name="gyro_q" type="float" unit="rad/s"/>
<field name="gyro_r" type="float" unit="rad/s"/>
<field name="mag_x" type="int16"/>
<field name="mag_y" type="int16"/>
<field name="mag_z" type="int16"/>
</message>
</class> </class>
-143
View File
@@ -1,143 +0,0 @@
/***********************************************************************/
/* ROM.ld: Linker Script File */
/***********************************************************************/
ENTRY(_boot)
STACK_SIZE = 0x1000;
/* Memory Definitions */
MEMORY
{
ROM (rx) : ORIGIN = 0x00004000, LENGTH = 484k
RAM (rw) : ORIGIN = 0x40000000, LENGTH = 32k
}
/* Section Definitions */
SECTIONS
{
/* first section is .text which is used for code */
.text :
{
/* *crt0.o (.text) */ /* Startup code */
KEEP(*(.init)) /* Startup code from .init-section */
*(.text .text.*) /* remaining code */
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.gcc_except_table)
*(.rodata) /* read-only data (constants) */
*(.rodata*)
*(.gnu.linkonce.r.*)
} > ROM
/***** old:
.text :
{
*crt0.o (.text)
*(.text)
*(.rodata)
*(.rodata*)
*(.glue_7)
*(.glue_7t)
} > ROM
*****/
. = ALIGN(4);
/* .ctors .dtors are used for c++ constructors/destructors */
/* added by Martin Thomas 4/2005 based on Anglia Design example */
.ctors :
{
PROVIDE(__ctors_start__ = .);
KEEP(*(SORT(.ctors.*)))
KEEP(*(.ctors))
PROVIDE(__ctors_end__ = .);
} >ROM
.dtors :
{
PROVIDE(__dtors_start__ = .);
KEEP(*(SORT(.dtors.*)))
KEEP(*(.dtors))
PROVIDE(__dtors_end__ = .);
} >ROM
. = ALIGN(4);
/* mthomas - end */
_etext = . ;
PROVIDE (etext = .);
/* .data section which is used for initialized data */
.data : AT (_etext)
{
_data = .;
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
SORT(CONSTRUCTORS) /* mt 4/2005 */
. = ALIGN(4);
*(.fastrun) /* !!!! "RAM-Function" example */
} > RAM
. = ALIGN(4);
_edata = . ;
PROVIDE (edata = .);
/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
__bss_start = . ;
__bss_start__ = . ;
*(.bss)
*(.gnu.linkonce.b*)
*(COMMON)
. = ALIGN(4);
} > RAM
. = ALIGN(4);
__bss_end__ = . ;
PROVIDE (__bss_end = .);
.stack ALIGN(256) :
{
. += STACK_SIZE;
PROVIDE (_stack = .);
} > RAM
_end = . ;
PROVIDE (end = .);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
}
-143
View File
@@ -1,143 +0,0 @@
/***********************************************************************/
/* ROM.ld: Linker Script File */
/***********************************************************************/
ENTRY(_boot)
STACK_SIZE = 0x400;
/* Memory Definitions */
MEMORY
{
ROM (rx) : ORIGIN = 0x00000000, LENGTH = 512k
RAM (rw) : ORIGIN = 0x40000000, LENGTH = 32k
}
/* Section Definitions */
SECTIONS
{
/* first section is .text which is used for code */
.text :
{
/* *crt0.o (.text) */ /* Startup code */
KEEP(*(.init)) /* Startup code from .init-section */
*(.text .text.*) /* remaining code */
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.gcc_except_table)
*(.rodata) /* read-only data (constants) */
*(.rodata*)
*(.gnu.linkonce.r.*)
} > ROM
/***** old:
.text :
{
*crt0.o (.text)
*(.text)
*(.rodata)
*(.rodata*)
*(.glue_7)
*(.glue_7t)
} > ROM
*****/
. = ALIGN(4);
/* .ctors .dtors are used for c++ constructors/destructors */
/* added by Martin Thomas 4/2005 based on Anglia Design example */
.ctors :
{
PROVIDE(__ctors_start__ = .);
KEEP(*(SORT(.ctors.*)))
KEEP(*(.ctors))
PROVIDE(__ctors_end__ = .);
} >ROM
.dtors :
{
PROVIDE(__dtors_start__ = .);
KEEP(*(SORT(.dtors.*)))
KEEP(*(.dtors))
PROVIDE(__dtors_end__ = .);
} >ROM
. = ALIGN(4);
/* mthomas - end */
_etext = . ;
PROVIDE (etext = .);
/* .data section which is used for initialized data */
.data : AT (_etext)
{
_data = .;
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
SORT(CONSTRUCTORS) /* mt 4/2005 */
. = ALIGN(4);
*(.fastrun) /* !!!! "RAM-Function" example */
} > RAM
. = ALIGN(4);
_edata = . ;
PROVIDE (edata = .);
/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
__bss_start = . ;
__bss_start__ = . ;
*(.bss)
*(.gnu.linkonce.b*)
*(COMMON)
. = ALIGN(4);
} > RAM
. = ALIGN(4);
__bss_end__ = . ;
PROVIDE (__bss_end = .);
.stack ALIGN(256) :
{
. += STACK_SIZE;
PROVIDE (_stack = .);
} > RAM
_end = . ;
PROVIDE (end = .);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
}
+1 -1
View File
@@ -44,7 +44,7 @@ void EXTINT0_ISR(void) {
ISR_ENTRY(); ISR_ENTRY();
/* read dummy control byte reply */ /* read dummy control byte reply */
uint8_t foo = SSPDR; uint8_t foo __attribute__ ((unused)) = SSPDR;
/* trigger 6 bytes read */ /* trigger 6 bytes read */
SSPDR = 0; SSPDR = 0;
SSPDR = 0; SSPDR = 0;
+3 -3
View File
@@ -6,8 +6,8 @@
#include "micromag.h" #include "micromag.h"
volatile uint8_t micromag_data_available; volatile uint8_t micromag_data_available;
int16_t micromag_values[MM_NB_AXIS]; volatile int16_t micromag_values[MM_NB_AXIS];
uint8_t volatile micromag_cur_axe; volatile uint8_t micromag_cur_axe;
static void EXTINT2_ISR(void) __attribute__((naked)); static void EXTINT2_ISR(void) __attribute__((naked));
@@ -45,7 +45,7 @@ void micromag_read( void ) {
void EXTINT2_ISR(void) { void EXTINT2_ISR(void) {
ISR_ENTRY(); ISR_ENTRY();
/* read dummy control byte reply */ /* read dummy control byte reply */
uint8_t foo = SSPDR; uint8_t foo __attribute__ ((unused)) = SSPDR;
/* trigger 2 bytes read */ /* trigger 2 bytes read */
SSPDR = 0; SSPDR = 0;
SSPDR = 0; SSPDR = 0;
+1 -1
View File
@@ -12,7 +12,7 @@ extern void micromag_init( void );
extern void micromag_read( void ); extern void micromag_read( void );
extern volatile uint8_t micromag_data_available; extern volatile uint8_t micromag_data_available;
extern int16_t micromag_values[MM_NB_AXIS]; extern volatile int16_t micromag_values[MM_NB_AXIS];
extern volatile uint8_t micromag_cur_axe; extern volatile uint8_t micromag_cur_axe;
#define MM_SS_PIN 20 #define MM_SS_PIN 20
+3 -2
View File
@@ -1,5 +1,6 @@
#PROC_AP PROC_FBW PROC_TINY #PROC_AP PROC_FBW PROC_TINY
ALLFLAGS = -DPROC_AP PROC = AP
ALLFLAGS = -DPROC_$(PROC)
LIBNAME = usbstack LIBNAME = usbstack
APPNAME = bl APPNAME = bl
@@ -71,7 +72,7 @@ $(APPNAME_RAM).elf: $(OBJS) $(LIBNAME).a $(LINKFILE_RAM)
crt.o: crt.S crt.o: crt.S
@ echo ".assembling" @ echo ".assembling"
$(CC) -c $(ASFLAGS) -Wa,-ahlms=crt.lst crt.S -o crt.o $(CC) -c $(ASFLAGS) -Wa,-ahlms=crt.lst crt.S -o crt.o
# Builds archive tar file # Builds archive tar file
arch: clean arch: clean
cd .. && $(TAR) --exclude={CVS,cvs} -cvzf $(PKG_NAME)-$(DATEL).tar.gz $(PKG_NAME) cd .. && $(TAR) --exclude={CVS,cvs} -cvzf $(PKG_NAME)-$(DATEL).tar.gz $(PKG_NAME)
+6
View File
@@ -1,6 +1,7 @@
#include "uart.h" #include "uart.h"
#define UART0_TX_INT_MODE 1 #define UART0_TX_INT_MODE 1
#define UART0_RX_INT_MODE 1 #define UART0_RX_INT_MODE 1
@@ -9,6 +10,9 @@
#include "armVIC.h" #include "armVIC.h"
#endif #endif
#ifdef USE_UART0
#if defined(UART0_TX_INT_MODE) || defined(UART0_RX_INT_MODE) #if defined(UART0_TX_INT_MODE) || defined(UART0_RX_INT_MODE)
void uart0_ISR(void) __attribute__((naked)); void uart0_ISR(void) __attribute__((naked));
#endif #endif
@@ -196,6 +200,8 @@ void uart0_ISR(void)
ISR_EXIT(); // recover registers and return ISR_EXIT(); // recover registers and return
} }
#endif /* USE_UART0 */
/* /*
* *
* UART1 handling functions - those are pale copies of UART0 ones * UART1 handling functions - those are pale copies of UART0 ones
+62 -48
View File
@@ -10,87 +10,80 @@
#include "adc.h" #include "adc.h"
#include "max1167.h" #include "max1167.h"
#include "micromag.h" #include "micromag.h"
#include "imu_v3.h"
#include "ahrs_new.h"
#include "airframe.h" #include "airframe.h"
#include "messages.h"
#include "downlink.h"
static inline void imu_init( void ); static inline void main_init( void );
static inline void imu_periodic_task( void ); static inline void main_periodic_task( void );
static inline void imu_event_task( void); static inline void main_event_task( void);
static void imu_print_accel ( void );
static void imu_print_bat ( void );
static void imu_init_spi1( void );
static void SPI1_ISR(void) __attribute__((naked));
struct adc_buf buf_ax; struct adc_buf buf_ax;
struct adc_buf buf_ay; struct adc_buf buf_ay;
struct adc_buf buf_az; struct adc_buf buf_az;
struct adc_buf buf_bat; struct adc_buf buf_bat;
static void imu_print_bat ( void );
static void imu_print_accel( void );
static void imu_print_gyro ( void );
static void imu_print_mag ( void );
static void main_init_spi1( void );
static void SPI1_ISR(void) __attribute__((naked));
#define SPI_SLAVE_NONE 0 #define SPI_SLAVE_NONE 0
#define SPI_SLAVE_MAG 1 #define SPI_SLAVE_MAG 1
#define SPI_SLAVE_MAX 2 #define SPI_SLAVE_MAX 2
uint8_t spi_cur_slave = SPI_SLAVE_NONE; uint8_t spi_cur_slave = SPI_SLAVE_NONE;
#define AHRS_NB_STATE 3 #define AHRS_NB_STATE 3
uint8_t ahrs_state = 0; uint8_t ahrs_state = 0;
int main( void ) { int main( void ) {
imu_init(); main_init();
while (1) { while (1) {
if (sys_time_periodic()) if (sys_time_periodic())
imu_periodic_task(); main_periodic_task();
imu_event_task(); main_event_task();
} }
return 0; return 0;
} }
static inline void imu_init( void ) { static inline void main_init( void ) {
hw_init(); hw_init();
sys_time_init(); sys_time_init();
uart0_init_tx();
uart1_init_tx(); uart1_init_tx();
adc_init(); adc_init();
adc_buf_channel(ADC_CHANNEL_AX, &buf_ax, DEFAULT_AV_NB_SAMPLE); imu_init();
adc_buf_channel(ADC_CHANNEL_AY, &buf_ay, DEFAULT_AV_NB_SAMPLE); main_init_spi1();
adc_buf_channel(ADC_CHANNEL_AZ, &buf_az, DEFAULT_AV_NB_SAMPLE);
adc_buf_channel(ADC_CHANNEL_BAT, &buf_bat, DEFAULT_AV_NB_SAMPLE);
imu_init_spi1();
max1167_init(); max1167_init();
micromag_init(); micromag_init();
int_enable(); int_enable();
} }
static inline void imu_event_task( void ) { static inline void main_event_task( void ) {
if (micromag_data_available) { if (micromag_data_available) {
micromag_data_available = FALSE; micromag_data_available = FALSE;
spi_cur_slave = SPI_SLAVE_NONE; spi_cur_slave = SPI_SLAVE_NONE;
ImuUpdateMag();
Uart1PrintString("MAG "); imu_print_mag();
Uart1PrintHex16(micromag_values[0]);
uart1_transmit(' ');
Uart1PrintHex16(micromag_values[1]);
uart1_transmit(' ');
Uart1PrintHex16(micromag_values[2]);
uart1_transmit('\n');
} }
if (max1167_data_available) { if (max1167_data_available) {
max1167_data_available = FALSE; max1167_data_available = FALSE;
spi_cur_slave = SPI_SLAVE_NONE; spi_cur_slave = SPI_SLAVE_NONE;
ImuUpdateGyros();
Uart1PrintString("GYRO "); imu_print_gyro();
Uart1PrintHex16(max1167_values[0]); ImuUpdateAccels();
uart1_transmit(' ');
Uart1PrintHex16(max1167_values[1]);
uart1_transmit(' ');
Uart1PrintHex16(max1167_values[2]);
uart1_transmit('\n');
imu_print_accel(); imu_print_accel();
// DOWNLINK_SEND_IMU_SENSORS(&imu_accel[AXIS_X], &imu_accel[AXIS_Y], &imu_accel[AXIS_Z],
// &imu_gyro[AXIS_X], &imu_gyro[AXIS_Y], &imu_gyro[AXIS_Z],
// &imu_mag[AXIS_X], &imu_mag[AXIS_Y], &imu_mag[AXIS_Z]);
if (ahrs_state == 2) { if (ahrs_state == 2) {
spi_cur_slave = SPI_SLAVE_MAG; spi_cur_slave = SPI_SLAVE_MAG;
@@ -99,13 +92,17 @@ static inline void imu_event_task( void ) {
} }
} }
static inline void imu_periodic_task( void ) { static inline void main_periodic_task( void ) {
static uint8_t foo = 0; static uint8_t foo = 0;
foo++; foo++;
if (!(foo % 4)) { if (!(foo % 4)) {
ahrs_state++; ahrs_state++;
if (ahrs_state == AHRS_NB_STATE) if (ahrs_state == AHRS_NB_STATE)
ahrs_state = 0; ahrs_state = 0;
if (spi_cur_slave != SPI_SLAVE_NONE)
Uart1PrintString("OVERUN");
switch (ahrs_state) { switch (ahrs_state) {
case 0: case 0:
spi_cur_slave = SPI_SLAVE_MAX; spi_cur_slave = SPI_SLAVE_MAX;
@@ -124,6 +121,13 @@ static inline void imu_periodic_task( void ) {
} }
} }
static void imu_print_bat ( void ) {
Uart1PrintString("BAT ");
uint16_t val = buf_bat.sum / DEFAULT_AV_NB_SAMPLE;
Uart1PrintHex16(val);
uart1_transmit('\n');
}
static void imu_print_accel ( void ) { static void imu_print_accel ( void ) {
Uart1PrintString("ACCEL "); Uart1PrintString("ACCEL ");
uint16_t val = buf_ax.sum / DEFAULT_AV_NB_SAMPLE; uint16_t val = buf_ax.sum / DEFAULT_AV_NB_SAMPLE;
@@ -137,14 +141,25 @@ static void imu_print_accel ( void ) {
uart1_transmit('\n'); uart1_transmit('\n');
} }
static void imu_print_bat ( void ) { static void imu_print_gyro ( void ) {
Uart1PrintString("BAT "); Uart1PrintString("GYRO ");
uint16_t val = buf_bat.sum / DEFAULT_AV_NB_SAMPLE; Uart1PrintHex16(max1167_values[0]);
Uart1PrintHex16(val); uart1_transmit(' ');
Uart1PrintHex16(max1167_values[1]);
uart1_transmit(' ');
Uart1PrintHex16(max1167_values[2]);
uart1_transmit('\n'); uart1_transmit('\n');
} }
static void imu_print_mag ( void ) {
Uart1PrintString("MAG ");
Uart1PrintHex16(micromag_values[0]);
uart1_transmit(' ');
Uart1PrintHex16(micromag_values[1]);
uart1_transmit(' ');
Uart1PrintHex16(micromag_values[2]);
uart1_transmit('\n');
}
/* SSPCR0 settings */ /* SSPCR0 settings */
#define SSP_DDS 0x07 << 0 /* data size : 8 bits */ #define SSP_DDS 0x07 << 0 /* data size : 8 bits */
@@ -159,9 +174,7 @@ static void imu_print_bat ( void ) {
#define SSP_MS 0x00 << 2 /* master slave mode : master */ #define SSP_MS 0x00 << 2 /* master slave mode : master */
#define SSP_SOD 0x00 << 3 /* slave output disable : don't care when master */ #define SSP_SOD 0x00 << 3 /* slave output disable : don't care when master */
static void main_init_spi1( void ) {
static void imu_init_spi1( void ) {
/* setup pins for SSP (SCK, MISO, MOSI) */ /* setup pins for SSP (SCK, MISO, MOSI) */
PINSEL1 |= 2 << 2 | 2 << 4 | 2 << 6; PINSEL1 |= 2 << 2 | 2 << 4 | 2 << 6;
@@ -179,6 +192,7 @@ static void imu_init_spi1( void ) {
void SPI1_ISR(void) { void SPI1_ISR(void) {
ISR_ENTRY(); ISR_ENTRY();
switch (spi_cur_slave) { switch (spi_cur_slave) {
case SPI_SLAVE_MAG : case SPI_SLAVE_MAG :
MmOnSpiIt(); MmOnSpiIt();
+6 -1
View File
@@ -3,9 +3,14 @@ simple answer
[preliminary] [preliminary]
re-make your aircraft, use $PAPARAZZI_SRC/sw/airborne/arm7/LPC2138-ROM-bl.ld instead of LPC2138-ROM.ld (rename it) link your airborne programs using the bootloader-specific linker script
make AIRCRAFT=TJ1 LDSCRIPT=arm7/LPC2148-ROM-bl.ld clean_ac fbw.compile
make AIRCRAFT=TJ1 LDSCRIPT=arm7/LPC2148-ROM-bl.ld ap.compile
apt-get install libusb apt-get install libusb
( warning on sid I had to do apt-get install libusb-0.1-4 )
cp $PAPARAZZI_SRC/conf/system/udev/rules/10-paparazzi.rules /etc/udev/rules.d/ cp $PAPARAZZI_SRC/conf/system/udev/rules/10-paparazzi.rules /etc/udev/rules.d/
cd $PAPARAZZI_SRC/sw/airborne/arm7/test/bootloader/ cd $PAPARAZZI_SRC/sw/airborne/arm7/test/bootloader/
make make