paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [5153] Fixed-Wing Code on STM32 Step 1/10


From: Christophe De Wagter
Subject: [paparazzi-commits] [5153] Fixed-Wing Code on STM32 Step 1/10
Date: Mon, 26 Jul 2010 19:14:26 +0000

Revision: 5153
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5153
Author:   dewagter
Date:     2010-07-26 19:14:25 +0000 (Mon, 26 Jul 2010)
Log Message:
-----------
Fixed-Wing Code on STM32 Step 1/10

Modified Paths:
--------------
    paparazzi3/trunk/conf/airframes/AirborneCodeReorg/LisaFw.xml
    paparazzi3/trunk/conf/airframes/AirborneCodeReorg/TinyFw.xml
    paparazzi3/trunk/conf/autopilot/fixedwing_autopilot.makefile
    paparazzi3/trunk/conf/autopilot/subsystems/fixedwing_gps_ublox.makefile
    
paparazzi3/trunk/conf/autopilot/subsystems/fixedwing_telemetry_transparent.makefile
    paparazzi3/trunk/sw/airborne/estimator.h
    paparazzi3/trunk/sw/airborne/main.c
    paparazzi3/trunk/sw/airborne/main_ap.c
    paparazzi3/trunk/sw/airborne/stm32/sys_time_hw.h
    paparazzi3/trunk/sw/airborne/stm32/uart_hw.c
    paparazzi3/trunk/sw/airborne/stm32/uart_hw.h

Added Paths:
-----------
    paparazzi3/trunk/conf/settings/lisa.xml
    paparazzi3/trunk/sw/airborne/stm32/adc_hw.h
    paparazzi3/trunk/sw/airborne/stm32/gps_hw.h
    paparazzi3/trunk/sw/airborne/stm32/link_mcu_hw.h

Modified: paparazzi3/trunk/conf/airframes/AirborneCodeReorg/LisaFw.xml
===================================================================
--- paparazzi3/trunk/conf/airframes/AirborneCodeReorg/LisaFw.xml        
2010-07-26 03:23:57 UTC (rev 5152)
+++ paparazzi3/trunk/conf/airframes/AirborneCodeReorg/LisaFw.xml        
2010-07-26 19:14:25 UTC (rev 5153)
@@ -173,14 +173,28 @@
 
 # Config for AP
 
+# Board Specifics
 include $(PAPARAZZI_SRC)/conf/autopilot/lisa_l.makefile
+
+# Fixed Wing Specifics
 include $(PAPARAZZI_SRC)/conf/autopilot/fixedwing_common.makefile
 include $(CFG_FIXEDWING)/fixedwing_autopilot.makefile
 
+# Temporary problem solving
+ap.CFLAGS      += -DSTM32
+
+GPS_UART_NR    = 1
+GPS_BAUD       = 38400
+include $(CFG_FIXEDWING)/subsystems/fixedwing_gps_ublox.makefile
+
+MODEM_UART_NR  = 2
+MODEM_BAUD     = 57600
+include $(CFG_FIXEDWING)/subsystems/fixedwing_telemetry_transparent.makefile
+
 # Config for SITL simulation
 
 include $(PAPARAZZI_SRC)/conf/autopilot/sitl.makefile
-sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN 
-DTRAFFIC_INFO
-sim.srcs += nav_survey_rectangle.c traffic_info.c nav_line.c
+sim.CFLAGS     += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM 
-DALT_KALMAN -DTRAFFIC_INFO
+sim.srcs       += nav_survey_rectangle.c traffic_info.c nav_line.c
   </makefile>
 </airframe>

Modified: paparazzi3/trunk/conf/airframes/AirborneCodeReorg/TinyFw.xml
===================================================================
--- paparazzi3/trunk/conf/airframes/AirborneCodeReorg/TinyFw.xml        
2010-07-26 03:23:57 UTC (rev 5152)
+++ paparazzi3/trunk/conf/airframes/AirborneCodeReorg/TinyFw.xml        
2010-07-26 19:14:25 UTC (rev 5153)
@@ -171,8 +171,8 @@
   </section>
  <makefile>
 
-BOARD_CFG=\"tiny_2_1_1.h\"
-FLASH_MODE=IAP
+BOARD_CFG      = \"tiny_2_1_1.h\"
+FLASH_MODE     = IAP
 
 # Board Specifics
 include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile
@@ -185,25 +185,25 @@
 # IO Options
 include $(CFG_FIXEDWING)/subsystems/fixedwing_radio_control_ppm.makefile
 
-GPS_UART=Uart0
-GPS_BAUD=38400
+GPS_UART_NR    = 0
+GPS_BAUD       = 38400
 include $(CFG_FIXEDWING)/subsystems/fixedwing_gps_ublox.makefile
 
-MODEM_UART=Uart1
-MODEM_BAUD=9600
+MODEM_UART_NR  = 1
+MODEM_BAUD     = 9600
 include $(CFG_FIXEDWING)/subsystems/fixedwing_telemetry_transparent.makefile
 
 
 # Special options
-ap.CFLAGS += -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN
+ap.CFLAGS      += -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN
 
 
 ######################################
 # Todo
 
-ap.CFLAGS += -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3
-ap.CFLAGS += -DGYRO -DADXRS150
-ap.srcs += gyro.c
+ap.CFLAGS      += -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3
+ap.CFLAGS      += -DGYRO -DADXRS150
+ap.srcs        += $(SRC_FIXEDWING)/gyro.c
 
 
 ######################################

Modified: paparazzi3/trunk/conf/autopilot/fixedwing_autopilot.makefile
===================================================================
--- paparazzi3/trunk/conf/autopilot/fixedwing_autopilot.makefile        
2010-07-26 03:23:57 UTC (rev 5152)
+++ paparazzi3/trunk/conf/autopilot/fixedwing_autopilot.makefile        
2010-07-26 19:14:25 UTC (rev 5153)
@@ -60,11 +60,13 @@
 #
 ap.CFLAGS += -DUSE_SYS_TIME
 ap.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c
+#ap.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)'
 ap.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./60.))'
 ifeq ($(ARCHI), stm32) 
-ap.CFLAGS += -DSYS_TIME_LED=1
+ap.CFLAGS += -DSYS_TIME_LED=1  -DPERIPHERALS_AUTO_INIT
 endif
 
+
 #
 # FlyByWire Main
 #
@@ -80,8 +82,9 @@
 ap.CFLAGS += -DNAV
 ap.srcs += $(SRC_FIXEDWING)/nav.c $(SRC_FIXEDWING)/fw_h_ctl.c 
$(SRC_FIXEDWING)/fw_v_ctl.c
 ap.srcs += $(SRC_FIXEDWING)/nav_survey_rectangle.c $(SRC_FIXEDWING)/nav_line.c
+
 #
-# InterMCU Commands
+# InterMCU & Commands
 #
 
 ap.CFLAGS += -DINTER_MCU

Modified: 
paparazzi3/trunk/conf/autopilot/subsystems/fixedwing_gps_ublox.makefile
===================================================================
--- paparazzi3/trunk/conf/autopilot/subsystems/fixedwing_gps_ublox.makefile     
2010-07-26 03:23:57 UTC (rev 5152)
+++ paparazzi3/trunk/conf/autopilot/subsystems/fixedwing_gps_ublox.makefile     
2010-07-26 19:14:25 UTC (rev 5153)
@@ -1,13 +1,10 @@
 
 
 
-ifeq ($(GPS_UART), Uart0)
-ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B$(GPS_BAUD)
-else
-ap.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B$(GPS_BAUD)
-endif
+ap.CFLAGS += -DGPS -DUBX 
+ap.CFLAGS += -DGPS_LINK=Uart$(GPS_UART_NR)
+ap.CFLAGS += -DUSE_UART$(GPS_UART_NR)
+ap.CFLAGS += -DUART$(GPS_UART_NR)_BAUD=B$(GPS_BAUD)
 
+ap.srcs   += $(SRC_FIXEDWING)/gps_ubx.c $(SRC_FIXEDWING)/gps.c 
$(SRC_FIXEDWING)/latlong.c
 
-ap.CFLAGS += -DGPS -DUBX -DGPS_LINK=$(GPS_UART)
-ap.srcs += $(SRC_FIXEDWING)/gps_ubx.c $(SRC_FIXEDWING)/gps.c 
$(SRC_FIXEDWING)/latlong.c
-

Modified: 
paparazzi3/trunk/conf/autopilot/subsystems/fixedwing_telemetry_transparent.makefile
===================================================================
--- 
paparazzi3/trunk/conf/autopilot/subsystems/fixedwing_telemetry_transparent.makefile
 2010-07-26 03:23:57 UTC (rev 5152)
+++ 
paparazzi3/trunk/conf/autopilot/subsystems/fixedwing_telemetry_transparent.makefile
 2010-07-26 19:14:25 UTC (rev 5153)
@@ -1,13 +1,10 @@
 
 
-ifeq ($(MODEM_UART), Uart0)
-ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B$(MODEM_BAUD)
-else
-ap.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B$(MODEM_BAUD)
-endif
+ap.CFLAGS += -DUSE_UART$(MODEM_UART_NR) 
+ap.CFLAGS += -DUART$(MODEM_UART_NR)_BAUD=B$(MODEM_BAUD)
 
+MODEM_UART = Uart$(MODEM_UART_NR)
 
-
 ap.CFLAGS += -DDOWNLINK -DDOWNLINK_FBW_DEVICE=$(MODEM_UART) 
-DDOWNLINK_AP_DEVICE=$(MODEM_UART) -DPPRZ_UART=$(MODEM_UART)
 ap.CFLAGS += -DDOWNLINK_TRANSPORT=PprzTransport -DDATALINK=PPRZ
 ap.srcs += $(SRC_FIXEDWING)/downlink.c $(SRC_FIXEDWING)/datalink.c 
$(SRC_FIXEDWING)/pprz_transport.c

Added: paparazzi3/trunk/conf/settings/lisa.xml
===================================================================
--- paparazzi3/trunk/conf/settings/lisa.xml                             (rev 0)
+++ paparazzi3/trunk/conf/settings/lisa.xml     2010-07-26 19:14:25 UTC (rev 
5153)
@@ -0,0 +1,32 @@
+<!DOCTYPE settings SYSTEM "settings.dtd">
+
+<!-- A conf to use for standard operation (no tuning) -->
+
+<settings>
+  <dl_settings>
+    <dl_settings NAME="flight params">
+      <dl_setting MAX="1000" MIN="0" STEP="10" VAR="flight_altitude" 
shortname="altitude"/>
+      <dl_setting MAX="360" MIN="0" STEP="1" VAR="nav_course"/>
+      <dl_setting MAX="10" MIN="-10" STEP="5" VAR="nav_shift" module="nav" 
handler="IncreaseShift" shortname="inc. shift"/>
+      <dl_setting MAX="0" MIN="0" STEP="1" VAR="estimator_flight_time" 
shortname="flight time" module="autopilot" handler="ResetFlightTimeAndLaunch"/>
+      <dl_setting MAX="200" MIN="-200" STEP="10" VAR="nav_radius" module="nav" 
handler="SetNavRadius">
+        <strip_button icon="circle-right.png" name="Circle right" value="1"/>  
      
+        <strip_button icon="circle-left.png" name="Circle left" value="-1"/>
+       <key_press key="greater" value="1"/>
+       <key_press key="less" value="-1"/>
+      </dl_setting>
+    </dl_settings>
+
+    <dl_settings NAME="mode">
+      <dl_setting MAX="2" MIN="0" STEP="1" VAR="pprz_mode" module="estimator" 
values="MANUAL|AUTO1|AUTO2|HOME|NOGPS|FAILSAFE">
+      </dl_setting>
+      <dl_setting MAX="1" MIN="0" STEP="1" VAR="launch">
+      </dl_setting>
+      <dl_setting MAX="1" MIN="0" STEP="1" VAR="kill_throttle">
+      </dl_setting>
+      <dl_setting MAX="2" MIN="0" STEP="1" 
VAR="telemetry_mode_Ap_DefaultChannel" shortname="tele_AP" module="downlink"/>
+      <dl_setting MAX="2" MIN="0" STEP="1" VAR="gps_reset" module="gps_ubx" 
handler="Reset" shortname="GPS reset"/>
+    </dl_settings>
+
+  </dl_settings>
+</settings>

Modified: paparazzi3/trunk/sw/airborne/estimator.h
===================================================================
--- paparazzi3/trunk/sw/airborne/estimator.h    2010-07-26 03:23:57 UTC (rev 
5152)
+++ paparazzi3/trunk/sw/airborne/estimator.h    2010-07-26 19:14:25 UTC (rev 
5153)
@@ -32,7 +32,8 @@
 #include <inttypes.h>
 
 #include "std.h"
-#ifndef READYBOARD_NO_BARO
+//#ifndef READYBOARD_NO_BARO
+#ifdef BARO_MS5534A
 #include "baro_MS5534A.h"
 #endif
 

Modified: paparazzi3/trunk/sw/airborne/main.c
===================================================================
--- paparazzi3/trunk/sw/airborne/main.c 2010-07-26 03:23:57 UTC (rev 5152)
+++ paparazzi3/trunk/sw/airborne/main.c 2010-07-26 19:14:25 UTC (rev 5153)
@@ -41,10 +41,18 @@
 #define Ap(f)
 #endif
 
+#ifdef STM32
+#include "init_hw.h"
+#endif
+
 int main( void ) {
+#ifdef STM32
+  hw_init();
+  sys_time_init();
+#endif
   Fbw(init);
   Ap(init);
-  InitSysTimePeriodic()
+  InitSysTimePeriodic();
   while (1) {
     if (sys_time_periodic()) {
       Fbw(periodic_task);
@@ -52,6 +60,9 @@
     }
     Fbw(event_task);
     Ap(event_task);
+#ifdef STM32
+    LED_PERIODIC();
+#endif
   }
   return 0;
 }

Modified: paparazzi3/trunk/sw/airborne/main_ap.c
===================================================================
--- paparazzi3/trunk/sw/airborne/main_ap.c      2010-07-26 03:23:57 UTC (rev 
5152)
+++ paparazzi3/trunk/sw/airborne/main_ap.c      2010-07-26 19:14:25 UTC (rev 
5153)
@@ -54,7 +54,11 @@
 #include "flight_plan.h"
 #include "datalink.h"
 #include "xbee.h"
+#ifdef STM32
+#include <stm32/gpio.h>
+#else
 #include "gpio.h"
+#endif
 #include "light.h"
 
 #if defined RADIO_CONTROL || defined RADIO_CONTROL_AUTO1
@@ -490,7 +494,8 @@
     tcas_periodic_task_1Hz();
     break;
 #endif
-
+  default:
+    break;
   }
 
 #ifdef USE_LIGHT
@@ -508,6 +513,8 @@
       estimator_flight_time = 1;
       launch = TRUE; /* Not set in non auto launch */
       DOWNLINK_SEND_TAKEOFF(DefaultChannel, &cpu_time_sec);
+  default:
+    break;
     }
 
 #ifdef DIGITAL_CAM
@@ -812,7 +819,9 @@
   int_enable();
 
   /** wait 0.5s (historical :-) */
+#ifndef STM32
   sys_time_usleep(500000);
+#endif
 
 #if defined GPS_CONFIGURE
   gps_configure_uart();

Added: paparazzi3/trunk/sw/airborne/stm32/adc_hw.h
===================================================================
--- paparazzi3/trunk/sw/airborne/stm32/adc_hw.h                         (rev 0)
+++ paparazzi3/trunk/sw/airborne/stm32/adc_hw.h 2010-07-26 19:14:25 UTC (rev 
5153)
@@ -0,0 +1,31 @@
+/*
+ * $Id: adc_hw.h 2638 2008-08-18 01:30:27Z poine $
+ *  
+ * Copyright (C) 2008  Antoine Drouin
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * paparazzi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with paparazzi; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA. 
+ *
+ */
+
+#ifndef ADC_HW_H
+#define ADC_HW_H
+
+#define AdcBank0(x) (x)
+#define AdcBank1(x) (x+NB_ADC)
+
+#endif /* ADC_HW_H */

Added: paparazzi3/trunk/sw/airborne/stm32/gps_hw.h
===================================================================
--- paparazzi3/trunk/sw/airborne/stm32/gps_hw.h                         (rev 0)
+++ paparazzi3/trunk/sw/airborne/stm32/gps_hw.h 2010-07-26 19:14:25 UTC (rev 
5153)
@@ -0,0 +1,4 @@
+#ifndef GPS_HW_H
+#define GPS_HW_H
+
+#endif /* GPS_HW_H */

Added: paparazzi3/trunk/sw/airborne/stm32/link_mcu_hw.h
===================================================================
--- paparazzi3/trunk/sw/airborne/stm32/link_mcu_hw.h                            
(rev 0)
+++ paparazzi3/trunk/sw/airborne/stm32/link_mcu_hw.h    2010-07-26 19:14:25 UTC 
(rev 5153)
@@ -0,0 +1,42 @@
+/*  $Id: link_mcu_hw.h 2064 2007-11-23 12:35:50Z hecto $
+ *
+ * Copyright (C) 2003-2005  Pascal Brisset, Antoine Drouin
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * paparazzi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with paparazzi; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.  
+ *
+ */
+
+/** \brief handling of arm7 inter mcu link
+ *  
+ */
+
+#ifndef LINK_MCU_HW_H
+#define LINK_MCU_HW_H
+
+#define CRC_INIT 0x0    
+#define CrcLow(x) ((x)&0xff)    
+#define CrcHigh(x) ((x)>>8)     
+
+static inline uint16_t CrcUpdate(uint16_t crc, uint8_t data) {          
+  uint8_t a = ((uint8_t)CrcHigh(crc)) + data;   
+  uint8_t b = ((uint8_t)CrcLow(crc)) + a;       
+  crc = b | a << 8;     
+  return crc;   
+}
+
+#endif /* LINK_MCU_HW_H */

Modified: paparazzi3/trunk/sw/airborne/stm32/sys_time_hw.h
===================================================================
--- paparazzi3/trunk/sw/airborne/stm32/sys_time_hw.h    2010-07-26 03:23:57 UTC 
(rev 5152)
+++ paparazzi3/trunk/sw/airborne/stm32/sys_time_hw.h    2010-07-26 19:14:25 UTC 
(rev 5153)
@@ -37,6 +37,8 @@
 #include "led.h"
 #endif
 
+#define InitSysTimePeriodic() 
+
 extern void sys_time_init( void );
 extern void sys_tick_irq_handler(void);
 

Modified: paparazzi3/trunk/sw/airborne/stm32/uart_hw.c
===================================================================
--- paparazzi3/trunk/sw/airborne/stm32/uart_hw.c        2010-07-26 03:23:57 UTC 
(rev 5152)
+++ paparazzi3/trunk/sw/airborne/stm32/uart_hw.c        2010-07-26 19:14:25 UTC 
(rev 5153)
@@ -29,8 +29,6 @@
 #include <stm32/gpio.h>
 #include "std.h"
 
-
-
 #ifdef USE_UART1 
 
 volatile uint16_t uart1_rx_insert_idx, uart1_rx_extract_idx;
@@ -397,3 +395,18 @@
 
 
 #endif /* USE_UART3 */
+
+void uart_init( void )
+{
+#ifdef USE_UART1 
+  uart1_init();
+#endif
+#ifdef USE_UART2 
+  uart2_init();
+#endif
+#ifdef USE_UART3 
+  uart3_init();
+#endif
+}
+
+

Modified: paparazzi3/trunk/sw/airborne/stm32/uart_hw.h
===================================================================
--- paparazzi3/trunk/sw/airborne/stm32/uart_hw.h        2010-07-26 03:23:57 UTC 
(rev 5152)
+++ paparazzi3/trunk/sw/airborne/stm32/uart_hw.h        2010-07-26 19:14:25 UTC 
(rev 5153)
@@ -31,6 +31,7 @@
 
 #include "std.h"
 
+#define B9600     9600
 #define B38400   38400
 #define B57600   57600
 #define B115200 115200
@@ -107,4 +108,7 @@
 
 #endif /* USE_UART3 */
 
+
+void uart_init( void );
+
 #endif /* UART_HW_H */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]