diff --git a/docs/boards/Board - ElinF405.md b/docs/boards/Board - ElinF405.md new file mode 100644 index 0000000000..f8d923c506 --- /dev/null +++ b/docs/boards/Board - ElinF405.md @@ -0,0 +1,29 @@ +# Board - Elin F405 + +## Hardware Features +* MCU + - STM32F405 +* IMU + - ICM-20602 +* Motor Outputs + - 4~6 outputs +* OSD +* VCP +* Hardware UARTS : + - UART1 - Serial RX, + - UART3 - Inverted Smart Port, + - UART4 - General use + - UART6 - General use +* Black box + - SPI 16MB +* LED Strip +* Integrated Voltage Regulator + - 5V , 3A +* Include Load Switch (VTX Real Pit Mode) + - -30V , -30A (VTX or LED On / Off) +* Include Low Pass LC filter +* Buttons + - Boot + +## Pinouts +![Elin F405 Pinout](images/ElinF405_pinout.jpg) diff --git a/docs/boards/images/ElinF405_pinout.jpg b/docs/boards/images/ElinF405_pinout.jpg new file mode 100644 index 0000000000..d42f7c69d2 Binary files /dev/null and b/docs/boards/images/ElinF405_pinout.jpg differ diff --git a/src/main/target/REVO/ELINF405.mk b/src/main/target/REVO/ELINF405.mk new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/main/target/REVO/config.c b/src/main/target/REVO/config.c new file mode 100644 index 0000000000..c6d8a057b6 --- /dev/null +++ b/src/main/target/REVO/config.c @@ -0,0 +1,41 @@ +/* + * This file is part of Cleanflight and Betaflight. + * + * Cleanflight and Betaflight are free software. You can redistribute + * this software and/or modify this software 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. + * + * Cleanflight and Betaflight are distributed in the hope that they + * 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 software. + * + * If not, see . + */ + +#include +#include + +#include "platform.h" +#include "drivers/serial.h" +#include "pg/rx.h" +#include "pg/piniobox.h" +#include "rx/rx.h" +#include "telemetry/telemetry.h" +#include "fc/config.h" + +#ifdef USE_TARGET_CONFIG +#include "pg/pg.h" + +void targetConfiguration(void) +{ + rxConfigMutable()->halfDuplex = true; + pinioBoxConfigMutable()->permanentId[0] = 40; + pinioBoxConfigMutable()->permanentId[1] = 41; +} +#endif diff --git a/src/main/target/REVO/target.c b/src/main/target/REVO/target.c index cb3407130c..bcc69882af 100644 --- a/src/main/target/REVO/target.c +++ b/src/main/target/REVO/target.c @@ -28,6 +28,16 @@ #include "drivers/timer_def.h" const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { +#if defined(ELINF405) + DEF_TIM(TIM11, CH1, PB9, TIM_USE_ANY, 0, 0), + DEF_TIM(TIM8, CH2N, PB0, TIM_USE_MOTOR, 0, 0), + DEF_TIM(TIM8, CH3N, PB1, TIM_USE_MOTOR, 0, 0), + DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, 0, 0), + DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, 0, 0), + DEF_TIM(TIM1, CH1, PA8, TIM_USE_MOTOR, 0, 0), + DEF_TIM(TIM3, CH4, PC9, TIM_USE_MOTOR, 0, 0), + DEF_TIM(TIM4, CH1, PB6, TIM_USE_LED, 0, 0), +#else DEF_TIM(TIM12, CH1, PB14, TIM_USE_PWM | TIM_USE_PPM, 0, 0), // PPM (5th pin on FlexiIO port) DEF_TIM(TIM12, CH2, PB15, TIM_USE_PWM, 0, 0), // S2_IN DEF_TIM(TIM8, CH1, PC6, TIM_USE_PWM, 0, 0), // S3_IN @@ -48,4 +58,5 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { DEF_TIM(TIM5, CH2, PA1, TIM_USE_MOTOR | TIM_USE_LED, 0, 0), // S5_OUT / LED DEF_TIM(TIM5, CH1, PA0, TIM_USE_MOTOR, 0, 0), // S6_OUT D1_ST2 #endif +#endif }; diff --git a/src/main/target/REVO/target.h b/src/main/target/REVO/target.h index f0c8ab4067..87ef78993d 100644 --- a/src/main/target/REVO/target.h +++ b/src/main/target/REVO/target.h @@ -36,6 +36,10 @@ #define TARGET_BOARD_IDENTIFIER "PODI" #define USBD_PRODUCT_STRING "PodiumF4" +#elif defined(ELINF405) +#define TARGET_BOARD_IDENTIFIER "ELIN" +#define USBD_PRODUCT_STRING "ElinF405" + #else #define TARGET_BOARD_IDENTIFIER "REVO" #define USBD_PRODUCT_STRING "Revolution" @@ -61,6 +65,9 @@ #define USE_BEEPER #define BEEPER_PIN PB6 #define BEEPER_INVERTED +#elif defined(ELINF405) +#define USE_BEEPER +#define BEEPER_PIN PB4 #else #define LED1_PIN PB4 // Leave beeper here but with none as io - so disabled unless mapped. @@ -117,6 +124,17 @@ #define GYRO_1_CS_PIN PA4 #define GYRO_1_SPI_INSTANCE SPI1 +#elif defined(ELINF405) + +#define USE_GYRO_SPI_MPU6500 +#define GYRO_1_ALIGN CW0_DEG +#define GYRO_1_CS_PIN PA4 +#define GYRO_1_SPI_INSTANCE SPI1 + +#define USE_ACC_SPI_MPU6500 +#define ACC_1_ALIGN CW0_DEG + + #else #define USE_GYRO_SPI_MPU6000 @@ -136,6 +154,18 @@ #define GYRO_1_EXTI_PIN PC4 #define USE_MPU_DATA_READY_SIGNAL +#if defined(ELINF405) + +#define USE_OSD +#define DEFAULT_FEATURES FEATURE_OSD +#define USE_MAX7456 +#define MAX7456_SPI_INSTANCE SPI2 +#define MAX7456_SPI_CS_PIN PC8 +#define MAX7456_SPI_CLK (SPI_CLOCK_STANDARD) +#define MAX7456_RESTORE_CLK (SPI_CLOCK_FAST) + +#else + #define GYRO_2_EXTI_PIN NONE // Configure MAG and BARO unconditionally. @@ -149,6 +179,8 @@ #define USE_BARO_BMP085 #define USE_BARO_BMP280 +#endif + #if defined(AIRBOTF4) || defined(AIRBOTF4SD) #define USE_BARO_SPI_BMP280 #define BARO_SPI_INSTANCE SPI1 @@ -193,7 +225,7 @@ #define UART3_RX_PIN PB11 #define UART3_TX_PIN PB10 -#if defined(REVO) +#if defined(REVO) || defined(ELINF405) #define USE_UART4 #define UART4_RX_PIN PA1 #define UART4_TX_PIN PA0 @@ -202,23 +234,55 @@ #define USE_UART6 #define UART6_RX_PIN PC7 #define UART6_TX_PIN PC6 + +#if defined(ELINF405) +#define PINIO1_PIN PC13 +#define PINIO2_PIN PC14 + +#define DEFAULT_MIXER MIXER_QUADX +#define ENABLE_DSHOT_DMAR true +#define USE_TARGET_CONFIG +#else + #define PINIO1_PIN PC8 // DTR pin +#endif + #define USE_SOFTSERIAL1 #define USE_SOFTSERIAL2 -#if defined(REVO) +#if defined(REVO) || defined(ELINF405) #define SERIAL_PORT_COUNT 7 //VCP, USART1, USART3, UART4, USART6, SOFTSERIAL x 2 #else #define SERIAL_PORT_COUNT 6 //VCP, USART1, USART3, USART6, SOFTSERIAL x 2 #endif #define USE_ESCSERIAL +#if defined(ELINF405) +#define ESCSERIAL_TIMER_TX_PIN PC6 +#else #define ESCSERIAL_TIMER_TX_PIN PB14 // (HARDARE=0,PPM) +#endif #define USE_SPI +#if defined(ELINF405) #define USE_SPI_DEVICE_1 +#define SPI1_NSS_PIN PA4 +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PA7 + +#define USE_SPI_DEVICE_2 +#define SPI2_NSS_PIN PB12 +#define SPI2_SCK_PIN PB13 +#define SPI2_MISO_PIN PB14 +#define SPI2_MOSI_PIN PB15 +#else + +#define USE_SPI_DEVICE_1 + +#endif #define USE_SPI_DEVICE_3 #define SPI3_NSS_PIN PB3 @@ -262,6 +326,9 @@ #define SERIALRX_PROVIDER SERIALRX_SBUS #define SERIALRX_UART SERIAL_PORT_USART6 #define DEFAULT_FEATURES FEATURE_TELEMETRY +#elif defined(ELINF405) +#define SERIALRX_PROVIDER SERIALRX_SBUS +#define SERIALRX_UART SERIAL_PORT_USART1 #endif #define USE_SERIAL_4WAY_BLHELI_INTERFACE @@ -274,6 +341,9 @@ #if defined(AIRBOTF4) || defined(AIRBOTF4SD) #define USABLE_TIMER_CHANNEL_COUNT 13 #define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(5) | TIM_N(8) | TIM_N(12) ) +#elif defined(ELINF405) +#define USABLE_TIMER_CHANNEL_COUNT 8 +#define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(8) | TIM_N(11) ) #else #define USABLE_TIMER_CHANNEL_COUNT 12 #define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(5) | TIM_N(8) | TIM_N(12) ) diff --git a/src/main/target/REVO/target.mk b/src/main/target/REVO/target.mk index b01f8931ab..2a7790660a 100644 --- a/src/main/target/REVO/target.mk +++ b/src/main/target/REVO/target.mk @@ -13,4 +13,5 @@ TARGET_SRC = \ drivers/barometer/barometer_bmp085.c \ drivers/barometer/barometer_bmp280.c \ drivers/compass/compass_hmc5883l.c \ - drivers/compass/compass_qmc5883l.c + drivers/compass/compass_qmc5883l.c \ + drivers/max7456.c