From 65b3a0f3c5da6be1509dc7d0a2e334c60092abf2 Mon Sep 17 00:00:00 2001 From: francoisduf Date: Thu, 3 Nov 2016 20:04:35 +0100 Subject: [PATCH 1/3] YuPiF4 target added --- src/main/target/YUPIF4/target.c | 78 ++++++++++++++++ src/main/target/YUPIF4/target.h | 152 +++++++++++++++++++++++++++++++ src/main/target/YUPIF4/target.mk | 9 ++ 3 files changed, 239 insertions(+) create mode 100644 src/main/target/YUPIF4/target.c create mode 100644 src/main/target/YUPIF4/target.h create mode 100644 src/main/target/YUPIF4/target.mk diff --git a/src/main/target/YUPIF4/target.c b/src/main/target/YUPIF4/target.c new file mode 100644 index 0000000000..9429c45c48 --- /dev/null +++ b/src/main/target/YUPIF4/target.c @@ -0,0 +1,78 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight 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. + * + * Cleanflight 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 Cleanflight. If not, see . + */ + +#include + +#include +#include "drivers/io.h" +#include "drivers/pwm_mapping.h" +#include "drivers/timer.h" + +const uint16_t multiPPM[] = { + PWM1 | (MAP_TO_PPM_INPUT << 8), // PPM input + PWM2 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM3 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM4 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM5 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM6 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), + 0xFFFF +}; + +const uint16_t multiPWM[] = { + PWM1 | (MAP_TO_PWM_INPUT << 8), + PWM2 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM3 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM4 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM5 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM6 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), + 0xFFFF +}; + +const uint16_t airPPM[] = { + PWM1 | (MAP_TO_PPM_INPUT << 8), // PPM input + PWM2 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM3 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM4 | (MAP_TO_SERVO_OUTPUT << 8), + PWM5 | (MAP_TO_SERVO_OUTPUT << 8), + PWM6 | (MAP_TO_SERVO_OUTPUT << 8), + PWM7 | (MAP_TO_SERVO_OUTPUT << 8), + 0xFFFF +}; + +const uint16_t airPWM[] = { + PWM1 | (MAP_TO_PWM_INPUT << 8), + PWM2 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM3 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM4 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM5 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM6 | (MAP_TO_MOTOR_OUTPUT << 8), + PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), + 0xFFFF +}; + +const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { + { TIM8, IO_TAG(PC8), TIM_Channel_3, TIM8_CC_IRQn, 0, IOCFG_AF_PP, GPIO_AF_TIM8 }, + { TIM2, IO_TAG(PA0), TIM_Channel_1, TIM2_IRQn, 1, IOCFG_AF_PP, GPIO_AF_TIM2 }, + { TIM2, IO_TAG(PA1), TIM_Channel_2, TIM2_IRQn, 1, IOCFG_AF_PP, GPIO_AF_TIM2 }, + { TIM2, IO_TAG(PA2), TIM_Channel_3, TIM2_IRQn, 1, IOCFG_AF_PP, GPIO_AF_TIM2 }, + { TIM2, IO_TAG(PA3), TIM_Channel_4, TIM2_IRQn, 1, IOCFG_AF_PP, GPIO_AF_TIM2 }, + { TIM3, IO_TAG(PB0), TIM_Channel_3, TIM3_IRQn, 1, IOCFG_AF_PP, GPIO_AF_TIM3 }, + { TIM3, IO_TAG(PB1), TIM_Channel_4, TIM3_IRQn, 1, IOCFG_AF_PP, GPIO_AF_TIM3 }, +}; + diff --git a/src/main/target/YUPIF4/target.h b/src/main/target/YUPIF4/target.h new file mode 100644 index 0000000000..de462619ab --- /dev/null +++ b/src/main/target/YUPIF4/target.h @@ -0,0 +1,152 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight 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. + * + * Cleanflight 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 Cleanflight. If not, see . + */ + +#pragma once +#define TARGET_BOARD_IDENTIFIER "YPF4" +#define TARGET_CONFIG + +#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8) + +#define USBD_PRODUCT_STRING "YupiF4" + +#define LED0 PB6 +#define LED1 PB4 +#define LED2 PB5 + +#define BEEPER PC9 +//#define BEEPER_INVERTED + +#define INVERTER PB15 +#define INVERTER_USART USART6 + + +// MPU6500 interrupt +#define USE_EXTI +#define USE_MPU_DATA_READY_SIGNAL +#define MPU_INT_EXTI PC4 +// MPU6500 +#define MPU6500_CS_PIN PA4 +#define MPU6500_SPI_INSTANCE SPI1 + +#define ACC +#define USE_ACC_MPU6500 +#define USE_ACC_SPI_MPU6500 +#define ACC_MPU6500_ALIGN CW90_DEG + +#define GYRO +#define USE_GYRO_MPU6500 +#define USE_GYRO_SPI_MPU6500 +#define GYRO_MPU6500_ALIGN CW90_DEG + + +// Serial Ports +#define USE_VCP + +#define USE_UART1 +#define UART1_RX_PIN PA10 +#define UART1_TX_PIN PA9 + +#define USE_UART3 +#define UART3_RX_PIN PB11 +#define UART3_TX_PIN PB10 + +#define USE_UART6 +#define UART6_RX_PIN PC7 +#define UART6_TX_PIN PC6 + +#define SERIAL_PORT_COUNT 4 // VCP, UART1, UART3, UART6 + +#define USE_ESCSERIAL +#define ESCSERIAL_TIMER_TX_HARDWARE 0 + + +// SD Card +#define USE_SDCARD +#define SDCARD_DETECT_INVERTED + +#define SDCARD_DETECT_PIN PD2 +#define SDCARD_SPI_INSTANCE SPI3 +#define SDCARD_SPI_CS_PIN PA15 + +// SPI2 is on the APB1 bus whose clock runs at 84MHz. Divide to under 400kHz for init: +#define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 256 // 328kHz +// Divide to under 25MHz for normal operation: +#define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 4 // 21MHz + +#define SDCARD_DMA_CHANNEL_TX DMA1_Stream5 +#define SDCARD_DMA_CHANNEL_TX_COMPLETE_FLAG DMA_FLAG_TCIF5 +#define SDCARD_DMA_CLK RCC_AHB1Periph_DMA1 +#define SDCARD_DMA_CHANNEL DMA_Channel_0 + + +// SPI ports definition +#define USE_SPI + +#define USE_SPI_DEVICE_1 // Gyro +#define SPI1_NSS_PIN PA4 +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PA7 + +#define USE_SPI_DEVICE_3 // SD Card +#define SPI3_NSS_PIN PB3 +#define SPI3_SCK_PIN PC10 +#define SPI3_MISO_PIN PC11 +#define SPI3_MOSI_PIN PC12 + +// I2C port definition +#define USE_I2C +#define I2C_DEVICE (I2CDEV_1) +#define USE_I2C_PULLUP + +// ADC inputs +#define BOARD_HAS_VOLTAGE_DIVIDER +#define USE_ADC +#define VBAT_ADC_PIN PC1 +#define RSSI_ADC_GPIO_PIN PC0 + +// LED Strip can run off Pin 5 (PB1) of the motor outputs +#define LED_STRIP +#define WS2811_PIN PB1 +#define WS2811_TIMER TIM3 +#define WS2811_TIMER_CHANNEL TIM_Channel_4 +#define WS2811_DMA_HANDLER_IDENTIFER DMA1_ST2_HANDLER +#define WS2811_DMA_STREAM DMA1_Stream2 +#define WS2811_DMA_FLAG DMA_FLAG_TCIF2 +#define WS2811_DMA_IT DMA_IT_TCIF2 +#define WS2811_DMA_CHANNEL DMA_Channel_5 +#define WS2811_DMA_IRQ DMA1_Stream2_IRQn + +// Features +#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT + +#define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL +#define DEFAULT_FEATURES FEATURE_BLACKBOX + +#define USE_SERIAL_4WAY_BLHELI_INTERFACE + +// Number of available PWM outputs +#define MAX_PWM_OUTPUT_PORTS 6 + +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD (BIT(2)) + +#define USABLE_TIMER_CHANNEL_COUNT 7 +#define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(8)) + diff --git a/src/main/target/YUPIF4/target.mk b/src/main/target/YUPIF4/target.mk new file mode 100644 index 0000000000..344000ca6f --- /dev/null +++ b/src/main/target/YUPIF4/target.mk @@ -0,0 +1,9 @@ +F405_TARGETS += $(TARGET) +FEATURES += SDCARD VCP + +TARGET_SRC = \ + drivers/accgyro_spi_mpu6500.c \ + drivers/accgyro_mpu6500.c \ + drivers/light_ws2811strip.c \ + drivers/light_ws2811strip_stm32f4xx.c + From d270dfe59c0a5acb5ee535d82ce15a22415e436e Mon Sep 17 00:00:00 2001 From: Faduf Date: Fri, 4 Nov 2016 09:36:41 +0100 Subject: [PATCH 2/3] Create a README file for the Yupi Target --- src/main/target/YUPIF4/README.md | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/main/target/YUPIF4/README.md diff --git a/src/main/target/YUPIF4/README.md b/src/main/target/YUPIF4/README.md new file mode 100644 index 0000000000..f718b60cf4 --- /dev/null +++ b/src/main/target/YUPIF4/README.md @@ -0,0 +1,40 @@ +# YuPiF4 by RcNet + +An high quality flight controller for the most demanding pilotes. + +## Description + +The YuPiF4 is a 36x36mm (30.5x30.5 mounting holes) board with an F4 microcontroller. + +## MCU, Sensors and Features +### Hardware  +- MCU: STM32F405RTG6  +- IMU: not yet defined  +- IMU Interrupt: Yes  +- BARO: No  +- VCP: Yes  +- Hardware UARTS: 3 with an inverter for SBus and a Smart-Port Pad to solder directly your SPort wire  +- Blackbox: SD card slot  +- PPM : A specific pad is available for PPM input  +- Battery Voltage Sensor: Yes, directly connected, no wiring necessary  +- Integrated Voltage Regulator: the board can be powered by your lipo (2S to 6S)  +- Brushed Motor Mosfets: No  +- Motor outputs : can drive up to 6 motors  +- Buttons: Boot0 to enter in DFU mode### Features  +- Current Sensor: Not implemented  +- BlHeli passthrough: Yes   +- WS2811 Led Strip: Yes (on motor output Pin 5)  +- Transponder: No + +### Extension Board +- An extension board with GPS and Baro will be available + +## Designers and Maintainers + +[RcNet](https://github.com/ted-rcnet) and [FaduF](https://github.com/Faduf) + +## Manufacturers and Distributors + +This board is currently in the prototype phase. Only small batches were manufactured for testing.Website : http://www.yupif4.com/ + +![YuPiF4 - Logo](http://www.yupif4.com/imgs/YuPiF4.jpg) From 60bd20807611ee492e4635a23049f16066af8fa5 Mon Sep 17 00:00:00 2001 From: Faduf Date: Fri, 4 Nov 2016 09:42:02 +0100 Subject: [PATCH 3/3] Create an .md file for the YuPiF4 An .md file to describe the YuPiF4 target was created in the Doc/ folder of the Inav project. --- docs/Board - YuPiF4.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docs/Board - YuPiF4.md diff --git a/docs/Board - YuPiF4.md b/docs/Board - YuPiF4.md new file mode 100644 index 0000000000..9d393d57ab --- /dev/null +++ b/docs/Board - YuPiF4.md @@ -0,0 +1,38 @@ +# YuPiF4 by RcNet + +An high quality flight controller for the most demanding pilotes. + +## Description + +The YuPiF4 is a 36x36mm (30.5x30.5 mounting holes) board with an F4 microcontroller. + +## MCU, Sensors and Features +### Hardware  +- MCU: STM32F405RTG6  +- IMU: not yet defined  +- IMU Interrupt: Yes  +- BARO: No  +- VCP: Yes  +- Hardware UARTS: 3 with an inverter for SBus and a Smart-Port Pad to solder directly your SPort wire  +- Blackbox: SD card slot  +- PPM : A specific pad is available for PPM input  +- Battery Voltage Sensor: Yes, directly connected, no wiring necessary  +- Integrated Voltage Regulator: the board can be powered by your lipo (2S to 6S)  +- Brushed Motor Mosfets: No  +- Motor outputs : can drive up to 6 motors  +- Buttons: Boot0 to enter in DFU mode### Features  +- Current Sensor: Not implemented  +- BlHeli passthrough: Yes   +- WS2811 Led Strip: Yes (on motor output Pin 5)  +- Transponder: No + +### Extension Board +- An extension board with a GPS and a Baro will be available + +## Designers and Maintainers + +[RcNet](https://github.com/ted-rcnet) and [FaduF](https://github.com/Faduf) + +## Manufacturers and Distributors + +This board is currently in the prototype phase. Only small batches were manufactured for testing.Website : http://www.yupif4.com/