Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MATEKF405 target #2566

Merged
merged 1 commit into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions src/main/target/MATEKF405/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@
#include "drivers/timer.h"

const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
{ TIM5, IO_TAG(PA3), TIM_Channel_4, 0, IOCFG_AF_PP_PD, GPIO_AF_TIM5, TIM_USE_PPM },
{ TIM9, IO_TAG(PA3), TIM_Channel_2, 0, IOCFG_AF_PP_PD, GPIO_AF_TIM9, TIM_USE_PPM },

{ TIM3, IO_TAG(PC6), TIM_Channel_1, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM3, TIM_USE_MC_MOTOR | TIM_USE_MC_SERVO | TIM_USE_FW_MOTOR },
{ TIM8, IO_TAG(PC7), TIM_Channel_2, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM8, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO },
{ TIM8, IO_TAG(PC8), TIM_Channel_3, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM8, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO },
{ TIM8, IO_TAG(PC9), TIM_Channel_4, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM8, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO },
{ TIM3, IO_TAG(PC6), TIM_Channel_1, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM3, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR }, //S1 DMA1_ST4 MT1
{ TIM8, IO_TAG(PC7), TIM_Channel_2, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM8, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO }, //S2 DMA2_ST3 SV3
{ TIM8, IO_TAG(PC8), TIM_Channel_3, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM8, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO }, //S3 DMA2_ST4 SV4
{ TIM8, IO_TAG(PC9), TIM_Channel_4, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM8, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO }, //S4 DMA3_ST7 SV5

{ TIM2, IO_TAG(PA15), TIM_Channel_1, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM2, TIM_USE_MC_MOTOR | TIM_USE_LED }, //S5 DMA1_ST5 2812LED
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change PA15 could no longer be used as TIM_USE_FW_SERVO. Is this intentional?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is more convenient to use S6(PA8) for FW_servo. S2, S3, S4, S6, 4 servos for Airplane, We tested it today.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, we will release one PDB for fixed wing with S2 S3 S4 S6 arranged


{ TIM1, IO_TAG(PA8), TIM_Channel_1, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM1, TIM_USE_MC_MOTOR | TIM_USE_MC_SERVO | TIM_USE_FW_SERVO }, //S6 DMA2_ST6 SV6
{ TIM4, IO_TAG(PB8), TIM_Channel_3, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM4, TIM_USE_MC_CHNFW | TIM_USE_MC_SERVO | TIM_USE_FW_MOTOR }, //S7 DMA1_ST7 MT2

{ TIM5, IO_TAG(PA2), TIM_Channel_3, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM5, TIM_USE_PWM }, //TX2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? It's allocated as PWM input.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is reserved for future resource command. delete it or not, Up to you. Thanks

Copy link
Contributor

@teckel12 teckel12 Dec 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@digitalentity Would this be used for soft serial? It seems that TX2 used as SS would be useful for FrSky Smartport telemetry so software inversion could be used to avoid the need for hacks or a hardware inverter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it at the moment. We could try using it for softserial in future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@digitalentity @MATEKSYS Looks like a nice FC! May be worth getting one and tweaking in SS support for us FrSky telemetry users. The easily accessible (5) UARTS is super nice! This may be the first board were you don't need to make compromises on what to connect.


//{ TIM5, IO_TAG(PA0), TIM_Channel_1, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM5, TIM_USE_ANY }, //TX4 softserial1_tx
//{ TIM5, IO_TAG(PA1), TIM_Channel_2, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM5, TIM_USE_ANY }, //RX4 softserial1_rx

{ TIM2, IO_TAG(PA15), TIM_Channel_1, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM2, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO | TIM_USE_LED},
{ TIM1, IO_TAG(PA8), TIM_Channel_1, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM1, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO },
};
40 changes: 28 additions & 12 deletions src/main/target/MATEKF405/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#define MPU6500_CS_PIN PC2
#define MPU6500_SPI_BUS BUS_SPI1

#define MPU6000_CS_PIN PC2
#define MPU6000_SPI_BUS BUS_SPI1

#define USE_EXTI
#define MPU_INT_EXTI PC3
#define USE_MPU_DATA_READY_SIGNAL
Expand All @@ -46,10 +49,16 @@
#define USE_GYRO_MPU6500
#define GYRO_MPU6500_ALIGN CW180_DEG

#define USE_GYRO_MPU6000
#define GYRO_MPU6000_ALIGN CW270_DEG

#define USE_ACC
#define USE_ACC_MPU6500
#define ACC_MPU6500_ALIGN CW180_DEG

#define USE_ACC_MPU6000
#define ACC_MPU6000_ALIGN CW270_DEG

// *************** SD Card **************************
#define USE_SDCARD
#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
Expand Down Expand Up @@ -77,6 +86,7 @@
#define USE_MAX7456
#define MAX7456_SPI_BUS BUS_SPI2
#define MAX7456_CS_PIN PB10

// *************** UART *****************************
#define USB_IO
#define USE_VCP
Expand Down Expand Up @@ -104,8 +114,8 @@
#define UART5_TX_PIN PC12

//#define USE_SOFTSERIAL1
//#define SOFTSERIAL1_RX_PIN PA15 // S5
//#define SOFTSERIAL1_TX_PIN PA8 // S6
//#define SOFTSERIAL_1_RX_PIN PA1 //RX4
//#define SOFTSERIAL_1_TX_PIN PA0 //TX4

#define SERIAL_PORT_COUNT 6

Expand All @@ -121,12 +131,12 @@
#define USE_I2C_DEVICE_EMULATED
#define I2C_DEVICE_EMULATED_SHARES_UART3
#define SOFT_I2C
#define SOFT_I2C_SCL PC10
#define SOFT_I2C_SDA PC11
#define SOFT_I2C_SCL PC10 //TX3 pad
#define SOFT_I2C_SDA PC11 //RX3 pad

#define DEFAULT_I2C_BUS BUS_I2C_EMULATED
#else
// AIO
// AIO / CTR / STD
#define USE_I2C
#define USE_I2C_DEVICE_1
#define I2C1_SCL PB6
Expand All @@ -137,17 +147,22 @@


#define USE_BARO
#define BARO_I2C_BUS DEFAULT_I2C_BUS
#define BARO_I2C_BUS DEFAULT_I2C_BUS
#define USE_BARO_BMP280
#define USE_BARO_MS5611
#define USE_BARO_BMP085

#define USE_MAG
#define MAG_I2C_BUS DEFAULT_I2C_BUS
#define MAG_I2C_BUS DEFAULT_I2C_BUS
#define USE_MAG_MAG3110 // External
#define USE_MAG_HMC5883 // External
#define USE_MAG_AK8963 // External
#define USE_MAG_AK8975 // External
#define USE_MAG_QMC5883 // External

#define USE_PITOT_MS4525
#define PITOT_I2C_BUS DEFAULT_I2C_BUS

// *************** ADC *****************************
#define USE_ADC
#define ADC_INSTANCE ADC1
Expand All @@ -159,16 +174,17 @@
#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
#define RSSI_ADC_CHANNEL ADC_CHN_3

#define DEFAULT_FEATURES (FEATURE_OSD )
#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TELEMETRY )
#define CURRENT_METER_SCALE 179

#define USE_LED_STRIP
#define WS2811_PIN PA15 // S5 pad for iNav
#define WS2811_DMA_HANDLER_IDENTIFER DMA1_ST5_HANDLER
#define WS2811_DMA_STREAM DMA1_Stream5
#define WS2811_DMA_CHANNEL DMA_Channel_3 // ???
#define WS2811_DMA_CHANNEL DMA_Channel_3

#define USE_SPEKTRUM_BIND
#define BIND_PIN PA1 // USART4 RX
#define BIND_PIN PA3 // RX2

#define USE_SERIAL_4WAY_BLHELI_INTERFACE

Expand All @@ -177,6 +193,6 @@
#define TARGET_IO_PORTC 0xffff
#define TARGET_IO_PORTD (BIT(2))

#define USABLE_TIMER_CHANNEL_COUNT 7
#define USABLE_TIMER_CHANNEL_COUNT 9
#define MAX_PWM_OUTPUT_PORTS 6
#define USED_TIMERS (TIM_N(1)|TIM_N(2)|TIM_N(3)|TIM_N(4)|TIM_N(5)|TIM_N(8))
#define USED_TIMERS (TIM_N(1)|TIM_N(2)|TIM_N(3)|TIM_N(4)|TIM_N(5)|TIM_N(8)|TIM_N(9))
5 changes: 5 additions & 0 deletions src/main/target/MATEKF405/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ FEATURES += SDCARD VCP

TARGET_SRC = \
drivers/accgyro/accgyro_mpu6500.c \
drivers/accgyro/accgyro_mpu6000.c \
drivers/barometer/barometer_bmp085.c \
drivers/barometer/barometer_bmp280.c \
drivers/barometer/barometer_ms56xx.c \
drivers/compass/compass_ak8963.c \
drivers/compass/compass_ak8975.c \
drivers/compass/compass_hmc5883l.c \
drivers/compass/compass_mag3110.c \
drivers/compass/compass_qmc5883l.c \
drivers/pitotmeter_ms4525.c \
drivers/pitotmeter_adc.c \
drivers/light_ws2811strip.c \
drivers/light_ws2811strip_stdperiph.c \
drivers/max7456.c