2011-11-01 09:22:19 +01:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
* @addtogroup OpenPilotSystem OpenPilot System
|
|
|
|
* @{
|
|
|
|
* @addtogroup OpenPilotCore OpenPilot Core
|
|
|
|
* @{
|
|
|
|
* @file pios_board.h
|
2012-01-21 18:25:48 +01:00
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
2011-11-01 09:22:19 +01:00
|
|
|
* @brief Defines board hardware for the OpenPilot Version 1.1 hardware.
|
|
|
|
* @see The GNU Public License (GPL) Version 3
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program 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 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2013-04-14 01:34:43 +02:00
|
|
|
#ifndef PIOS_BOARD_H
|
|
|
|
#define PIOS_BOARD_H
|
2011-11-01 09:22:19 +01:00
|
|
|
|
2012-03-06 04:31:26 +01:00
|
|
|
#include <stdbool.h>
|
2011-11-01 09:22:19 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
2011-11-01 09:22:19 +01:00
|
|
|
// Timers and Channels Used
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
2011-11-01 09:22:19 +01:00
|
|
|
/*
|
2013-05-19 16:37:30 +02:00
|
|
|
Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4
|
|
|
|
------+-----------+-----------+-----------+----------
|
|
|
|
TIM1 | | | |
|
|
|
|
TIM2 | --------------- PIOS_DELAY -----------------
|
|
|
|
TIM3 | | | |
|
|
|
|
TIM4 | | | |
|
|
|
|
TIM5 | | | |
|
|
|
|
TIM6 | | | |
|
|
|
|
TIM7 | | | |
|
|
|
|
TIM8 | | | |
|
|
|
|
------+-----------+-----------+-----------+----------
|
2013-04-20 17:07:19 +02:00
|
|
|
*/
|
2011-11-01 09:22:19 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
2011-11-01 09:22:19 +01:00
|
|
|
// DMA Channels Used
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
2011-11-01 09:22:19 +01:00
|
|
|
/* Channel 1 - */
|
|
|
|
/* Channel 2 - SPI1 RX */
|
|
|
|
/* Channel 3 - SPI1 TX */
|
|
|
|
/* Channel 4 - SPI2 RX */
|
|
|
|
/* Channel 5 - SPI2 TX */
|
|
|
|
/* Channel 6 - */
|
|
|
|
/* Channel 7 - */
|
|
|
|
/* Channel 8 - */
|
|
|
|
/* Channel 9 - */
|
|
|
|
/* Channel 10 - */
|
|
|
|
/* Channel 11 - */
|
|
|
|
/* Channel 12 - */
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
2011-11-01 09:22:19 +01:00
|
|
|
// BOOTLOADER_SETTINGS
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
|
|
|
#define BOARD_READABLE true
|
|
|
|
#define BOARD_WRITABLE true
|
|
|
|
#define MAX_DEL_RETRYS 3
|
2011-11-01 09:22:19 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
2011-11-01 09:22:19 +01:00
|
|
|
// PIOS_LED
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
|
|
|
#define PIOS_LED_HEARTBEAT 0
|
|
|
|
#define PIOS_LED_ALARM 1
|
2011-11-01 09:22:19 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
2011-11-01 09:22:19 +01:00
|
|
|
// PIOS_SPI
|
|
|
|
// See also pios_board.c
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
2017-04-16 02:38:42 +02:00
|
|
|
#define PIOS_SPI_MAX_DEVS 3
|
|
|
|
extern uint32_t pios_spi_gyro_id;
|
|
|
|
extern uint32_t pios_spi_accel_id;
|
|
|
|
#define PIOS_SPI_L3GD20_ADAPTER (pios_spi_gyro_id)
|
|
|
|
#define PIOS_SPI_BMA180_ADAPTER (pios_spi_accel_id)
|
|
|
|
#define PIOS_SPI_MPU6000_ADAPTER (pios_spi_gyro_id)
|
2011-11-01 09:22:19 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
2011-11-01 10:38:35 +01:00
|
|
|
// PIOS_WDG
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
2017-04-16 02:38:42 +02:00
|
|
|
#define PIOS_WATCHDOG_TIMEOUT 250
|
|
|
|
#define PIOS_WDG_REGISTER RTC_BKP_DR4
|
|
|
|
#define PIOS_WDG_ACTUATOR 0x0001
|
|
|
|
#define PIOS_WDG_STABILIZATION 0x0002
|
|
|
|
#define PIOS_WDG_ATTITUDE 0x0004
|
|
|
|
#define PIOS_WDG_MANUAL 0x0008
|
|
|
|
#define PIOS_WDG_SENSORS 0x0010
|
|
|
|
#define PIOS_WDG_AUTOTUNE 0x0020
|
2011-11-01 10:38:35 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
2011-11-01 09:22:19 +01:00
|
|
|
// PIOS_I2C
|
|
|
|
// See also pios_board.c
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
2017-04-16 02:38:42 +02:00
|
|
|
#define PIOS_I2C_MAX_DEVS 3
|
2011-11-17 17:13:34 +01:00
|
|
|
extern uint32_t pios_i2c_mag_adapter_id;
|
2017-04-16 02:38:42 +02:00
|
|
|
extern uint32_t pios_i2c_pressure_adapter_id;
|
|
|
|
|
|
|
|
#define PIOS_I2C_MS5611_INTERNAL_ADAPTER (pios_i2c_pressure_adapter_id)
|
|
|
|
#define PIOS_I2C_HMC5X83_INTERNAL_ADAPTER (pios_i2c_mag_adapter_id)
|
|
|
|
|
2012-04-17 15:38:27 +02:00
|
|
|
extern uint32_t pios_i2c_flexiport_adapter_id;
|
2017-04-16 02:38:42 +02:00
|
|
|
#define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id)
|
|
|
|
#define PIOS_I2C_ETASV3_ADAPTER (PIOS_I2C_FLEXI_ADAPTER)
|
|
|
|
#define PIOS_I2C_EXTERNAL_ADAPTER (pios_i2c_flexiport_adapter_id)
|
|
|
|
|
2011-11-01 09:22:19 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-01 09:22:19 +01:00
|
|
|
// PIOS_USART
|
|
|
|
//
|
|
|
|
// See also pios_board.c
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2017-04-25 13:11:37 +02:00
|
|
|
#define PIOS_USART_MAX_DEVS 5
|
|
|
|
// Inverter for SBUS handling
|
|
|
|
#define PIOS_USART_INVERTER_PORT UART4
|
|
|
|
#define PIOS_USART_INVERTER_GPIO GPIOC
|
|
|
|
#define PIOS_USART_INVERTER_PIN GPIO_Pin_3
|
|
|
|
#define PIOS_USART_INVERTER_ENABLE Bit_SET
|
|
|
|
#define PIOS_USART_INVERTER_DISABLE Bit_RESET
|
2011-11-01 09:22:19 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-01 09:22:19 +01:00
|
|
|
// PIOS_COM
|
|
|
|
//
|
|
|
|
// See also pios_board.c
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
|
|
|
#define PIOS_COM_MAX_DEVS 4
|
2011-11-01 09:22:19 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
|
|
|
// TELEMETRY
|
|
|
|
// ------------------------
|
|
|
|
#define TELEM_QUEUE_SIZE 80
|
2013-11-17 22:39:39 +01:00
|
|
|
#define PIOS_TELEM_STACK_SIZE 800
|
2011-11-01 10:38:35 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-01 09:22:19 +01:00
|
|
|
// System Settings
|
2013-05-19 16:37:30 +02:00
|
|
|
//
|
2012-01-28 20:04:55 +01:00
|
|
|
// See also System_stm32f4xx.c
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
|
|
|
// These macros are deprecated
|
|
|
|
// please use PIOS_PERIPHERAL_APBx_CLOCK According to the table below
|
|
|
|
// #define PIOS_MASTER_CLOCK
|
|
|
|
// #define PIOS_PERIPHERAL_CLOCK
|
|
|
|
// #define PIOS_PERIPHERAL_CLOCK
|
2012-01-28 20:04:55 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
#define PIOS_SYSCLK 168000000
|
|
|
|
// Peripherals that belongs to APB1 are:
|
|
|
|
// DAC |PWR |CAN1,2
|
|
|
|
// I2C1,2,3 |UART4,5 |USART3,2
|
|
|
|
// I2S3Ext |SPI3/I2S3 |SPI2/I2S2
|
|
|
|
// I2S2Ext |IWDG |WWDG
|
|
|
|
// RTC/BKP reg
|
2012-01-28 20:04:55 +01:00
|
|
|
// TIM2,3,4,5,6,7,12,13,14
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// Calculated as SYSCLK / APBPresc * (APBPre == 1 ? 1 : 2)
|
|
|
|
// Default APB1 Prescaler = 4
|
|
|
|
#define PIOS_PERIPHERAL_APB1_CLOCK (PIOS_SYSCLK / 2)
|
2012-01-28 20:04:55 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// Peripherals belonging to APB2
|
|
|
|
// SDIO |EXTI |SYSCFG |SPI1
|
|
|
|
// ADC1,2,3
|
|
|
|
// USART1,6
|
|
|
|
// TIM1,8,9,10,11
|
2012-01-28 20:04:55 +01:00
|
|
|
//
|
|
|
|
// Default APB2 Prescaler = 2
|
|
|
|
//
|
2013-05-19 16:37:30 +02:00
|
|
|
#define PIOS_PERIPHERAL_APB2_CLOCK PIOS_SYSCLK
|
2012-01-28 20:04:55 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-01 09:22:19 +01:00
|
|
|
// Interrupt Priorities
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
|
|
|
#define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
|
|
|
|
#define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
|
|
|
|
#define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
|
|
|
|
#define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
|
|
|
|
// ------------------------
|
2011-11-01 10:38:35 +01:00
|
|
|
// PIOS_RCVR
|
|
|
|
// See also pios_board.c
|
2013-05-19 16:37:30 +02:00
|
|
|
// ------------------------
|
2011-11-14 00:23:56 +01:00
|
|
|
#define PIOS_RCVR_MAX_DEVS 3
|
|
|
|
#define PIOS_RCVR_MAX_CHANNELS 12
|
2012-06-04 16:46:23 +02:00
|
|
|
#define PIOS_GCSRCVR_TIMEOUT_MS 100
|
2011-11-01 10:38:35 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-01 10:38:35 +01:00
|
|
|
// Receiver PPM input
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-14 00:23:56 +01:00
|
|
|
#define PIOS_PPM_MAX_DEVS 1
|
2016-05-30 22:52:27 +02:00
|
|
|
#define PIOS_PPM_NUM_INPUTS 16
|
2011-11-01 10:38:35 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-01 10:38:35 +01:00
|
|
|
// Receiver PWM input
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-14 00:23:56 +01:00
|
|
|
#define PIOS_PWM_MAX_DEVS 1
|
|
|
|
#define PIOS_PWM_NUM_INPUTS 8
|
2011-11-01 10:38:35 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-01 10:38:35 +01:00
|
|
|
// Receiver SPEKTRUM input
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-14 00:23:56 +01:00
|
|
|
#define PIOS_SPEKTRUM_MAX_DEVS 2
|
|
|
|
#define PIOS_SPEKTRUM_NUM_INPUTS 12
|
2011-11-01 10:38:35 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-01 10:38:35 +01:00
|
|
|
// Receiver S.Bus input
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-14 00:23:56 +01:00
|
|
|
#define PIOS_SBUS_MAX_DEVS 1
|
2013-05-19 16:37:30 +02:00
|
|
|
#define PIOS_SBUS_NUM_INPUTS (16 + 2)
|
2011-11-01 10:38:35 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-27 05:19:42 +01:00
|
|
|
// Receiver DSM input
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2012-07-20 13:08:54 +02:00
|
|
|
#define PIOS_DSM_MAX_DEVS 2
|
|
|
|
#define PIOS_DSM_NUM_INPUTS 12
|
2011-11-27 05:19:42 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-01 10:38:35 +01:00
|
|
|
// Servo outputs
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
|
|
|
#define PIOS_SERVO_UPDATE_HZ 50
|
|
|
|
#define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
|
2015-01-23 23:56:39 +01:00
|
|
|
#define PIOS_SERVO_BANKS 6
|
2011-11-01 10:38:35 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// --------------------------
|
2011-11-01 10:38:35 +01:00
|
|
|
// Timer controller settings
|
2013-05-19 16:37:30 +02:00
|
|
|
// --------------------------
|
|
|
|
#define PIOS_TIM_MAX_DEVS 6
|
2011-11-01 10:38:35 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2011-11-01 09:22:19 +01:00
|
|
|
// ADC
|
2012-05-15 10:08:58 +02:00
|
|
|
// PIOS_ADC_PinGet(0) = Current sensor
|
|
|
|
// PIOS_ADC_PinGet(1) = Voltage sensor
|
2013-03-28 17:20:50 +01:00
|
|
|
// PIOS_ADC_PinGet(2) = VREF
|
|
|
|
// PIOS_ADC_PinGet(3) = Temperature sensor
|
|
|
|
// PIOS_ADC_PinGet(4) = Board Power
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2012-05-15 10:08:58 +02:00
|
|
|
#define PIOS_DMA_PIN_CONFIG \
|
2013-05-19 16:37:30 +02:00
|
|
|
{ \
|
2015-04-08 15:01:37 +02:00
|
|
|
{ GPIOC, GPIO_Pin_0, ADC_Channel_10, true }, \
|
|
|
|
{ GPIOC, GPIO_Pin_1, ADC_Channel_11, true }, \
|
|
|
|
{ NULL, 0, ADC_Channel_Vrefint, true }, /* Voltage reference */ \
|
|
|
|
{ NULL, 0, ADC_Channel_TempSensor, true }, /* Temperature sensor */ \
|
|
|
|
{ GPIOC, GPIO_Pin_2, ADC_Channel_12, true } \
|
2013-05-19 16:37:30 +02:00
|
|
|
}
|
2012-05-15 10:08:58 +02:00
|
|
|
|
|
|
|
/* we have to do all this to satisfy the PIOS_ADC_MAX_SAMPLES define in pios_adc.h */
|
|
|
|
/* which is annoying because this then determines the rate at which we generate buffer turnover events */
|
|
|
|
/* the objective here is to get enough buffer space to support 100Hz averaging rate */
|
2013-05-19 16:37:30 +02:00
|
|
|
#define PIOS_ADC_NUM_CHANNELS 4
|
|
|
|
#define PIOS_ADC_MAX_OVERSAMPLING 2
|
|
|
|
#define PIOS_ADC_USE_ADC2 0
|
2013-05-26 16:17:03 +02:00
|
|
|
|
|
|
|
#define PIOS_ADC_USE_TEMP_SENSOR
|
2013-06-24 18:50:44 +02:00
|
|
|
#define PIOS_ADC_TEMPERATURE_PIN 3 /* V */
|
2011-11-01 09:22:19 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
2012-02-07 08:12:55 +01:00
|
|
|
// USB
|
2013-05-19 16:37:30 +02:00
|
|
|
// -------------------------
|
|
|
|
#define PIOS_USB_MAX_DEVS 1
|
|
|
|
#define PIOS_USB_ENABLED 1 /* Should remove all references to this */
|
|
|
|
#define PIOS_USB_HID_MAX_DEVS 1
|
2011-11-01 09:22:19 +01:00
|
|
|
|
2013-04-14 01:34:43 +02:00
|
|
|
#endif /* PIOS_BOARD_H */
|
|
|
|
|
2011-11-01 09:22:19 +01:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
* @}
|
|
|
|
*/
|