Paparazzi SD-Logger Board

This commit is contained in:
Christophe De Wagter
2012-03-24 13:51:38 +01:00
parent 58130bf528
commit 20d0b61f65
4 changed files with 289 additions and 2 deletions
+13
View File
@@ -0,0 +1,13 @@
#
# sdlog_1.0.makefile
#
# Paparazzi SD Logger
#
include $(PAPARAZZI_SRC)/conf/boards/tiny_2.11.makefile
BOARD=sdlog
BOARD_VERSION=1.0
BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\"
+20 -1
View File
@@ -30,12 +30,15 @@
#ifdef PROC_LPCH2148
#define BOARD_LPCH2148
#endif
#ifdef PROC_LOGGER
#define BOARD_LOGGER
#endif
#ifdef BOARD_TINYJ
/* TINY Jeremy old MOSI P0.19 */
/* .set BOOT_PIN, 0x00080000 */
/* TINY Jeremy old SCK P0.17 */
.set BOOT_PIN, 0x00020000
.set BOOT_PIN, 0x00020000
#else
#ifdef BOARD_TINY
/* TINY old LPC_SSEL P0.20 */
@@ -49,12 +52,17 @@
/* Olimex LPC-H2148 P1.24 */
.set BOOT_PIN, 0x04000000
#else
#ifdef BOARD_LOGGER
/* SD-Logger P0.29 */
.set BOOT_PIN, 0x20000000
#else
/* Vbus P0.23 */
.set BOOT_PIN, 0x00800000
#endif
#endif
#endif
#endif
#endif
/* Stack Sizes */
.set UND_STACK_SIZE, 0x00000040 /* stack for "undefined instruction" interrupts is 4 bytes */
@@ -114,6 +122,7 @@ AppS_Addr: .word APP_START
Reset_Handler:
#ifndef BOARD_LPCH2148
#ifndef BOARD_LOGGER
/* check status of the USB in P0.xx */
ldr r0, =IOPIN0 /* load gpio addr */
ldr r1,[r0] /* get data */
@@ -122,6 +131,16 @@ Reset_Handler:
cmp r1, r2 /* compare bits */
beq Bootloader /* beq */
ldr PC, AppS_Addr
#else
/* check status of the USB in P0.xx */
ldr r0, =IOPIN0 /* load gpio addr */
ldr r1,[r0] /* get data */
ldr r2, =BOOT_PIN /* get boot pin */
and r1, r1, r2 /* clear all other bits */
cmp r1, r2 /* compare bits */
bne Bootloader /* beq */
ldr PC, AppS_Addr
#endif
#else
/* check status of the USB in P1.24 */
ldr r0, =PINSEL2 /* load mode addr */
+196
View File
@@ -0,0 +1,196 @@
/* board definition file for Paparazzi SD-Logger v1.0 */
#ifndef CONFIG_SD_LOGGER_PPRZ_H
#define CONFIG_SD_LOGGER_PPRZ_H
#ifdef SITL
/* Dummy definitions: adc are unused anyway */
#define AdcBank0(x) (x)
#define AdcBank1(x) (x)
#endif /* SITL */
/* Master oscillator freq. */
#define FOSC (12000000)
/* PLL multiplier */
#define PLL_MUL (5)
/* CPU clock freq. */
#define CCLK (FOSC * PLL_MUL)
/* current @7V, Tiny2.11, Funjet4, no LED
PCLK max min
15MHz 99mA 92mA
30MHz 105mA 98mA
60MHz 116mA 108mA
*/
#ifdef USE_USB_HIGH_PCLK
/* Peripheral bus speed mask 0x00-> 4, 0x01-> 1, 0x02-> 2 */
/* change both PBSD_BITS/VAL 15MHz, 60MHz, 30MHz */
#define PBSD_BITS 0x02
#define PBSD_VAL 2
#else
/* Peripheral bus speed mask 0x00->4, 0x01-> 1, 0x02 -> 2 */
#define PBSD_BITS 0x00
#define PBSD_VAL 4
#endif
/* Peripheral bus clock freq. */
#define PCLK (CCLK / PBSD_VAL)
#define LED_1_BANK 1
#define LED_1_PIN 17
#define LED_2_BANK 1
#define LED_2_PIN 16
#define LED_3_BANK 1
#define LED_3_PIN 23
#define LED_4_BANK 1
#define LED_4_PIN 18
#define POWER_SWITCH_LED 4
#define LED_5_BANK 1
#define LED_5_PIN 22
#define CAM_SWITCH_LED 5
#define LED_GPS_RESET_BANK 1
#define LED_GPS_RESET_PIN 21
#define Configure_GPS_RESET_Pin() LED_INIT(GPS_RESET)
#define Set_GPS_RESET_Pin_LOW() LED_ON(GPS_RESET)
#define Open_GPS_RESET_Pin() ClearBit(LED_DIR(GPS_RESET), LED_PIN(GPS_RESET))
/* P0.5 aka MAT0.1 */
#define SERVO_CLOCK_PIN 5
#define SERVO_CLOCK_PINSEL PINSEL0
#define SERVO_CLOCK_PINSEL_VAL 0x02
#define SERVO_CLOCK_PINSEL_BIT 10
/* p1.20 */
#define SERVO_RESET_PIN 20
/* PPM : rc rx on P0.6*/
#define PPM_PINSEL PINSEL0
#define PPM_PINSEL_VAL 0x02
#define PPM_PINSEL_BIT 12
#define PPM_CRI TIR_CR2I
#define PPM_CCR_CRF TCCR_CR2_F
#define PPM_CCR_CRR TCCR_CR2_R
#define PPM_CCR_CRI TCCR_CR2_I
#define PPM_CR T0CR2
/* ADC */
#define ADC_0 AdcBank1(6)
#ifdef USE_ADC_0
#ifndef USE_AD1
#define USE_AD1
#endif
#define USE_AD1_6
#endif
#define ADC_1 AdcBank1(7)
#ifdef USE_ADC_1
#ifndef USE_AD1
#define USE_AD1
#endif
#define USE_AD1_7
#endif
#define ADC_2 AdcBank0(4)
#ifdef USE_ADC_2
#ifndef USE_AD0
#define USE_AD0
#endif
#define USE_AD0_4
#endif
#define ADC_3 AdcBank0(6)
#ifdef USE_ADC_3
#ifndef USE_AD0
#define USE_AD0
#endif
#define USE_AD0_6
#endif
#define ADC_4 AdcBank0(3)
#ifdef USE_ADC_4
#ifndef USE_AD0
#define USE_AD0
#endif
#define USE_AD0_3
#endif
#define ADC_5 AdcBank0(2)
#ifdef USE_ADC_5
#ifndef USE_AD0
#define USE_AD0
#endif
#define USE_AD0_2
#endif
#define ADC_6 AdcBank0(1)
#ifdef USE_ADC_6
#ifndef USE_AD0
#define USE_AD0
#endif
#define USE_AD0_1
#endif
#define ADC_7 AdcBank1(3)
#ifdef USE_ADC_7
#ifndef USE_AD1
#define USE_AD1
#endif
#define USE_AD1_3
#endif
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
#ifndef ADC_CHANNEL_VSUPPLY
#define ADC_CHANNEL_VSUPPLY AdcBank1(5)
#ifndef USE_AD1
#define USE_AD1
#endif
#define USE_AD1_5
#endif
#define DefaultVoltageOfAdc(adc) (0.01787109375*adc)
#define SPI_SELECT_SLAVE0_PORT 0
#define SPI_SELECT_SLAVE0_PIN 20
#define SPI1_DRDY_PINSEL PINSEL1
#define SPI1_DRDY_PINSEL_BIT 0
#define SPI1_DRDY_PINSEL_VAL 1
#define SPI1_DRDY_EINT 0
#define SPI1_DRDY_VIC_IT VIC_EINT0
/* micro SD connected to SPI0 */
#define SPI_CHANNEL 0
/************ BANK 0 *************/
/* STOP button P0.3 */
#define LOG_STOP_KEY 29
/* POWER DETECT 5V P0.10 */
#define POWER_DETECT_PIN 10
/************ BANK 1 *************/
/* STOP button P1.20 */
#define CARD_DETECT_PIN 20
#define LED_GREEN 3
#define LED_YELLOW 2
#define LED_RED 1
#endif /* CONFIG_SD_LOGGER_PPRZ_H */
+60 -1
View File
@@ -104,6 +104,31 @@
#define LOG_STOP_KEY 7
#endif
/*
#ifndef POWER_DETECT_PIN
// Pin 0.10
#define POWER_DETECT_PIN 6
#endif
#ifndef CARD_DETECT_PIN
// Pin 1.20
#define CARD_DETECT_PIN 20
#endif
*/
#ifndef LED_GREEN
#define LED_GREEN 3
#endif
#ifndef LED_YELLOW
#define LED_YELLOW 2
#endif
#ifndef LED_RED
#define LED_RED 1
#endif
/* USB Vbus (= P0.23) */
#define VBUS_PIN 23
@@ -391,7 +416,7 @@ int do_log(void)
}
/* write to SD until key is pressed */
while ((IO0PIN & _BV(LOG_STOP_KEY))>>LOG_STOP_KEY)
while ((IO0PIN & (1<<LOG_STOP_KEY))>>LOG_STOP_KEY)
{
#ifdef USE_MAX11040
@@ -469,6 +494,40 @@ int main(void)
int waitloop, ledcount;
main_init();
#ifdef _DEBUG_BOARD_
while(1)
{
if (IO0PIN & (1 << LOG_STOP_KEY))
{
LED_ON(LED_YELLOW);
}
else
{
LED_OFF(LED_YELLOW);
}
if (IO1PIN & (1 << CARD_DETECT_PIN))
{
LED_OFF(LED_GREEN);
}
else
{
LED_ON(LED_GREEN);
}
if (IO0PIN & (1 << POWER_DETECT_PIN))
// if (IO0PIN & (1 << VBUS_PIN))
{
LED_ON(LED_RED);
}
else
{
LED_OFF(LED_RED);
}
}
#endif
while(1)
{
LED_ON(2);