From 77d4c028f918b4e1f574be569172de69c228b6cc Mon Sep 17 00:00:00 2001 From: Cheng Lin Date: Mon, 29 May 2017 00:57:21 -0400 Subject: [PATCH 1/4] Add ICM20689 support for clracingf7 --- src/main/target/CLRACINGF7/CL_RACINGF7.md | 3 +-- src/main/target/CLRACINGF7/target.c | 5 +++-- src/main/target/CLRACINGF7/target.h | 25 +++++++++++++++-------- src/main/target/CLRACINGF7/target.mk | 6 ++++-- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/main/target/CLRACINGF7/CL_RACINGF7.md b/src/main/target/CLRACINGF7/CL_RACINGF7.md index 7c2e8195a..ac36ef743 100644 --- a/src/main/target/CLRACINGF7/CL_RACINGF7.md +++ b/src/main/target/CLRACINGF7/CL_RACINGF7.md @@ -9,6 +9,5 @@ Blackbox: SD Card PPM/UART NOT Shared: YES Battery Voltage Sensor: 10:1 Current sensor: 0.5 mOhm, 250 Current scale in the setting -Integrated Voltage Regulator: 1.2A 5v -Integrated Volrage Regulator: 1.2A 7.8V for clean vtx and camera power +Integrated Voltage Regulator: 3 A 5v 120A Current sensing PDB and 150A burst current for 10S on the current sensing Resistor diff --git a/src/main/target/CLRACINGF7/target.c b/src/main/target/CLRACINGF7/target.c index a811d5663..8a7b833b9 100644 --- a/src/main/target/CLRACINGF7/target.c +++ b/src/main/target/CLRACINGF7/target.c @@ -28,15 +28,16 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { - DEF_TIM(TIM4, CH3, PB8, TIM_USE_PPM | TIM_USE_LED, TIMER_INPUT_ENABLED, 0), // PPM -DMA1_ST7 + DEF_TIM(TIM4, CH3, PB8, TIM_USE_PPM, TIMER_INPUT_ENABLED, 0), // PPM -DMA1_ST7 DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // PWM1 - DMA1_ST6 DEF_TIM(TIM8, CH3, PC8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // PWM2 - DMA2_ST2 - DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM3 - DMA1_ST1 + DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM3 - DMA1_ST1 DEF_TIM(TIM3, CH4, PC9, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM4 - DMA1_ST2 DEF_TIM(TIM1, CH1, PA8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 2), // PWM5 - DMA2_ST3 DEF_TIM(TIM4, CH1, PB6, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM6 - DMA1_ST0 DEF_TIM(TIM1, CH3N, PB1, TIM_USE_MOTOR | TIM_USE_LED, TIMER_OUTPUT_ENABLED | TIMER_OUTPUT_INVERTED, 0), // S5_OUT - DMA2_ST6 + }; diff --git a/src/main/target/CLRACINGF7/target.h b/src/main/target/CLRACINGF7/target.h index 220df0107..656991c49 100644 --- a/src/main/target/CLRACINGF7/target.h +++ b/src/main/target/CLRACINGF7/target.h @@ -18,25 +18,34 @@ #pragma once #define TARGET_BOARD_IDENTIFIER "CLR7" -#define USBD_PRODUCT_STRING "CL_RACING F7" +#define USBD_PRODUCT_STRING "CLRACINGF7" #define LED0 PB0 #define BEEPER PB4 #define BEEPER_INVERTED -#define MPU6000_CS_PIN PA4 -#define MPU6000_SPI_INSTANCE SPI1 +#define USE_EXTI +#define MPU_INT_EXTI PC4 +#define USE_MPU_DATA_READY_SIGNAL +//ICM20689 +#define ICM20689_CS_PIN PA4 +#define ICM20689_SPI_INSTANCE SPI1 +#define GYRO +#define USE_GYRO_SPI_ICM20689 +#define GYRO_ICM20689_ALIGN CW0_DEG +#define ACC +#define USE_ACC_SPI_ICM20689 +#define ACC_ICM20689_ALIGN CW0_DEG + +//MPU-6000 #define ACC #define USE_ACC_SPI_MPU6000 #define GYRO #define USE_GYRO_SPI_MPU6000 - -// MPU6000 interrupts -#define USE_EXTI -#define MPU_INT_EXTI PC4 -#define USE_MPU_DATA_READY_SIGNAL #define GYRO_MPU6000_ALIGN CW0_DEG #define ACC_MPU6000_ALIGN CW0_DEG +#define MPU6000_CS_PIN PA4 +#define MPU6000_SPI_INSTANCE SPI1 #define OSD #define USE_MAX7456 diff --git a/src/main/target/CLRACINGF7/target.mk b/src/main/target/CLRACINGF7/target.mk index 980fad005..719339dc7 100644 --- a/src/main/target/CLRACINGF7/target.mk +++ b/src/main/target/CLRACINGF7/target.mk @@ -1,6 +1,8 @@ F7X2RE_TARGETS += $(TARGET) FEATURES += SDCARD VCP - TARGET_SRC = \ - drivers/accgyro/accgyro_spi_mpu6000.c\ + drivers/accgyro/accgyro_spi_icm20689.c\ + drivers/accgyro/accgyro_spi_mpu6000.c \ + drivers/light_ws2811strip.c \ + drivers/light_ws2811strip_hal.c \ drivers/max7456.c From 492e863814a38b535418e565c9f11b8f7cc870a2 Mon Sep 17 00:00:00 2001 From: Cheng Lin Date: Mon, 29 May 2017 10:07:03 -0400 Subject: [PATCH 2/4] Fix tab aliment problem in target.c --- src/main/target/CLRACINGF7/target.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/target/CLRACINGF7/target.c b/src/main/target/CLRACINGF7/target.c index 8a7b833b9..a565b31af 100644 --- a/src/main/target/CLRACINGF7/target.c +++ b/src/main/target/CLRACINGF7/target.c @@ -30,14 +30,14 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { DEF_TIM(TIM4, CH3, PB8, TIM_USE_PPM, TIMER_INPUT_ENABLED, 0), // PPM -DMA1_ST7 - DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // PWM1 - DMA1_ST6 - DEF_TIM(TIM8, CH3, PC8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // PWM2 - DMA2_ST2 - DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM3 - DMA1_ST1 - DEF_TIM(TIM3, CH4, PC9, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM4 - DMA1_ST2 - DEF_TIM(TIM1, CH1, PA8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 2), // PWM5 - DMA2_ST3 - DEF_TIM(TIM4, CH1, PB6, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM6 - DMA1_ST0 + DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // PWM1 - DMA1_ST6 + DEF_TIM(TIM8, CH3, PC8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // PWM2 - DMA2_ST2 + DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM3 - DMA1_ST1 + DEF_TIM(TIM3, CH4, PC9, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM4 - DMA1_ST2 + DEF_TIM(TIM1, CH1, PA8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 2), // PWM5 - DMA2_ST3 + DEF_TIM(TIM4, CH1, PB6, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM6 - DMA1_ST0 - DEF_TIM(TIM1, CH3N, PB1, TIM_USE_MOTOR | TIM_USE_LED, TIMER_OUTPUT_ENABLED | TIMER_OUTPUT_INVERTED, 0), // S5_OUT - DMA2_ST6 + DEF_TIM(TIM1, CH3N, PB1, TIM_USE_MOTOR | TIM_USE_LED, TIMER_OUTPUT_ENABLED | TIMER_OUTPUT_INVERTED, 0), // S5_OUT - DMA2_ST6 }; From 57f5ea8993de84d88ace1a176edffede935d193a Mon Sep 17 00:00:00 2001 From: Cheng Lin Date: Mon, 29 May 2017 10:08:26 -0400 Subject: [PATCH 3/4] Update target.c --- src/main/target/CLRACINGF7/target.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/target/CLRACINGF7/target.c b/src/main/target/CLRACINGF7/target.c index a565b31af..1ff2591a0 100644 --- a/src/main/target/CLRACINGF7/target.c +++ b/src/main/target/CLRACINGF7/target.c @@ -30,14 +30,14 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { DEF_TIM(TIM4, CH3, PB8, TIM_USE_PPM, TIMER_INPUT_ENABLED, 0), // PPM -DMA1_ST7 - DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // PWM1 - DMA1_ST6 - DEF_TIM(TIM8, CH3, PC8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // PWM2 - DMA2_ST2 - DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM3 - DMA1_ST1 - DEF_TIM(TIM3, CH4, PC9, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM4 - DMA1_ST2 - DEF_TIM(TIM1, CH1, PA8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 2), // PWM5 - DMA2_ST3 - DEF_TIM(TIM4, CH1, PB6, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM6 - DMA1_ST0 + DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // PWM1 - DMA1_ST6 + DEF_TIM(TIM8, CH3, PC8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // PWM2 - DMA2_ST2 + DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM3 - DMA1_ST1 + DEF_TIM(TIM3, CH4, PC9, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM4 - DMA1_ST2 + DEF_TIM(TIM1, CH1, PA8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 2), // PWM5 - DMA2_ST3 + DEF_TIM(TIM4, CH1, PB6, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // PWM6 - DMA1_ST0 - DEF_TIM(TIM1, CH3N, PB1, TIM_USE_MOTOR | TIM_USE_LED, TIMER_OUTPUT_ENABLED | TIMER_OUTPUT_INVERTED, 0), // S5_OUT - DMA2_ST6 + DEF_TIM(TIM1, CH3N, PB1, TIM_USE_MOTOR | TIM_USE_LED, TIMER_OUTPUT_ENABLED | TIMER_OUTPUT_INVERTED, 0), // S5_OUT - DMA2_ST6 }; From 6412cb3be7d6d9322ebdfc74f50ba421755def92 Mon Sep 17 00:00:00 2001 From: Cheng Lin Date: Mon, 29 May 2017 10:09:22 -0400 Subject: [PATCH 4/4] Update target.h --- src/main/target/CLRACINGF7/target.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/main/target/CLRACINGF7/target.h b/src/main/target/CLRACINGF7/target.h index 656991c49..7d025fd3e 100644 --- a/src/main/target/CLRACINGF7/target.h +++ b/src/main/target/CLRACINGF7/target.h @@ -68,7 +68,6 @@ #define SDCARD_DMA_CLK RCC_AHB1Periph_DMA2 #define SDCARD_DMA_CHANNEL DMA_CHANNEL_0 - #define USE_VCP #define USE_UART1 #define UART1_RX_PIN PA10 @@ -110,28 +109,22 @@ #define SPI3_MISO_PIN PC11 #define SPI3_MOSI_PIN PC12 - #define USE_ADC #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC #define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC #define CURRENT_METER_ADC_PIN PC1 #define VBAT_ADC_PIN PC2 #define RSSI_ADC_PIN PC3 - #define CURRENT_METER_SCALE_DEFAULT 250 // 3/120A = 25mv/A // LED strip configuration. #define LED_STRIP #define SPEKTRUM_BIND_PIN UART6_RX_PIN #define BINDPLUG_PIN PB2 - #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT - #define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL #define SERIALRX_UART SERIAL_PORT_USART6 - #define TELEMETRY_UART SERIAL_PORT_USART1 - #define USE_SERIAL_4WAY_BLHELI_INTERFACE #define TARGET_IO_PORTA 0xffff