From afd848e42522b42a49396db072e908b7d61ba767 Mon Sep 17 00:00:00 2001 From: Bas Delfos Date: Sun, 15 Jan 2017 22:28:47 +0100 Subject: [PATCH 1/4] Enabled REMAP_TIM17_DMA for KISS FC to use PWM6 as spare motor output --- src/main/target/KISSFC/target.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/target/KISSFC/target.h b/src/main/target/KISSFC/target.h index 1064e34e2..90e32cf6d 100644 --- a/src/main/target/KISSFC/target.h +++ b/src/main/target/KISSFC/target.h @@ -27,6 +27,7 @@ #define USE_ESCSERIAL #define ESCSERIAL_TIMER_TX_HARDWARE 6 +#define REMAP_TIM17_DMA #define LED0 PB1 From 5b3ac004b065d415f1524851a39772165cf98600 Mon Sep 17 00:00:00 2001 From: Anders Hoglund Date: Wed, 18 Jan 2017 15:24:41 +0100 Subject: [PATCH 2/4] CC3D_OPBL did not start, spurious interrupts during init. Made sure NVIC is disabled early --- src/main/vcp/hw_config.c | 21 +++++++++++++++++++++ src/main/vcp/hw_config.h | 1 + src/main/vcp/usb_prop.c | 2 ++ 3 files changed, 24 insertions(+) diff --git a/src/main/vcp/hw_config.c b/src/main/vcp/hw_config.c index 84d9efc58..97e8c1a98 100644 --- a/src/main/vcp/hw_config.c +++ b/src/main/vcp/hw_config.c @@ -217,6 +217,27 @@ void USB_Interrupts_Config(void) NVIC_Init(&NVIC_InitStructure); } +/******************************************************************************* + * Function Name : USB_Interrupts_Disable + * Description : Disables the USB interrupts + * Input : None. + * Return : None. + *******************************************************************************/ +void USB_Interrupts_Disable(void) +{ + NVIC_InitTypeDef NVIC_InitStructure; + + /* Disable the USB interrupt */ + NVIC_InitStructure.NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn; + NVIC_InitStructure.NVIC_IRQChannelCmd = DISABLE; + NVIC_Init(&NVIC_InitStructure); + + /* Disable the USB Wake-up interrupt */ + NVIC_InitStructure.NVIC_IRQChannel = USBWakeUp_IRQn; + NVIC_InitStructure.NVIC_IRQChannelCmd = DISABLE; + NVIC_Init(&NVIC_InitStructure); +} + /******************************************************************************* * Function Name : USB_Cable_Config * Description : Software Connection/Disconnection of USB Cable diff --git a/src/main/vcp/hw_config.h b/src/main/vcp/hw_config.h index fefaebc04..6892e0037 100644 --- a/src/main/vcp/hw_config.h +++ b/src/main/vcp/hw_config.h @@ -53,6 +53,7 @@ void Set_USBClock(void); void Enter_LowPowerMode(void); void Leave_LowPowerMode(void); void USB_Interrupts_Config(void); +void USB_Interrupts_Disable(void); void USB_Cable_Config(FunctionalState NewState); void Get_SerialNum(void); uint32_t CDC_Send_DATA(const uint8_t *ptrBuffer, uint32_t sendLength); // HJI diff --git a/src/main/vcp/usb_prop.c b/src/main/vcp/usb_prop.c index c8558de34..e8487bc2a 100644 --- a/src/main/vcp/usb_prop.c +++ b/src/main/vcp/usb_prop.c @@ -87,6 +87,8 @@ ONE_DESCRIPTOR String_Descriptor[4] = { { (uint8_t*)Virtual_Com_Port_StringLangI *******************************************************************************/ void Virtual_Com_Port_init(void) { + /* Make absolutly sure interrupts are disabled. */ + USB_Interrupts_Disable(); /* Update the serial number string descriptor with the data from the unique ID*/ From 6f6fe4ad6fbde8921b937171f6a216a988cefdce Mon Sep 17 00:00:00 2001 From: blckmn Date: Thu, 19 Jan 2017 04:24:21 +1100 Subject: [PATCH 3/4] Added target default mixer, and updated REVOLT Motors tested and correct motor spins on motors tab in configurator. --- src/main/fc/config.c | 6 +++++- src/main/target/REVO/target.c | 6 +++--- src/main/target/REVO/target.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/fc/config.c b/src/main/fc/config.c index 10d5be8de..abf357b63 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -464,6 +464,11 @@ void resetRcControlsConfig(rcControlsConfig_t *rcControlsConfig) void resetMixerConfig(mixerConfig_t *mixerConfig) { +#ifdef TARGET_DEFAULT_MIXER + mixerConfig->mixerMode = TARGET_DEFAULT_MIXER; +#else + mixerConfig->mixerMode = MIXER_QUADX; +#endif mixerConfig->yaw_motor_direction = 1; } @@ -602,7 +607,6 @@ void createDefaultConfig(master_t *config) #endif config->version = EEPROM_CONF_VERSION; - config->mixerConfig.mixerMode = MIXER_QUADX; // global settings config->current_profile_index = 0; // default profile diff --git a/src/main/target/REVO/target.c b/src/main/target/REVO/target.c index 36d970812..ee60c575c 100644 --- a/src/main/target/REVO/target.c +++ b/src/main/target/REVO/target.c @@ -32,10 +32,10 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { DEF_TIM(TIM8, CH3, PC8, TIM_USE_PWM, 0, 0), // S5_IN DEF_TIM(TIM8, CH4, PC9, TIM_USE_PWM, 0, 0), // S6_IN #ifdef REVOLT - DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, 1, 1), // S3_OUT D1_ST6 - DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, 1, 0), // S2_OUT D1_ST2 - DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, 1, 0), // S4_OUT D1_ST1 DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, 1, 0), // S1_OUT D1_ST7 + DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, 1, 0), // S2_OUT D1_ST2 + DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, 1, 1), // S3_OUT D1_ST6 + DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, 1, 0), // S4_OUT D1_ST1 DEF_TIM(TIM4, CH1, PB6, TIM_USE_LED, 0, 0), // LED for REVOLT D1_ST0 #else DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, 1, 0), // S1_OUT D1_ST7 diff --git a/src/main/target/REVO/target.h b/src/main/target/REVO/target.h index fe7dc33dc..a93fdc381 100644 --- a/src/main/target/REVO/target.h +++ b/src/main/target/REVO/target.h @@ -26,6 +26,7 @@ #elif defined(REVOLT) #define TARGET_BOARD_IDENTIFIER "RVLT" #define USBD_PRODUCT_STRING "Revolt" +#define TARGET_DEFAULT_MIXER MIXER_QUADX_1234 #elif defined(SOULF4) #define TARGET_BOARD_IDENTIFIER "SOUL" From 1e80ff1c5b5b59f1d050833adb5c265a40e41fa6 Mon Sep 17 00:00:00 2001 From: blckmn Date: Thu, 19 Jan 2017 04:40:52 +1100 Subject: [PATCH 4/4] Simplified target.c condition for revolt as per suggestion --- src/main/target/REVO/target.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/target/REVO/target.c b/src/main/target/REVO/target.c index ee60c575c..e7a643fd2 100644 --- a/src/main/target/REVO/target.c +++ b/src/main/target/REVO/target.c @@ -31,22 +31,18 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { DEF_TIM(TIM8, CH2, PC7, TIM_USE_PWM, 0, 0), // S4_IN DEF_TIM(TIM8, CH3, PC8, TIM_USE_PWM, 0, 0), // S5_IN DEF_TIM(TIM8, CH4, PC9, TIM_USE_PWM, 0, 0), // S6_IN -#ifdef REVOLT DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, 1, 0), // S1_OUT D1_ST7 DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, 1, 0), // S2_OUT D1_ST2 DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, 1, 1), // S3_OUT D1_ST6 DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, 1, 0), // S4_OUT D1_ST1 +#ifdef REVOLT DEF_TIM(TIM4, CH1, PB6, TIM_USE_LED, 0, 0), // LED for REVOLT D1_ST0 #else - DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, 1, 0), // S1_OUT D1_ST7 - DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, 1, 0), // S2_OUT D1_ST2 - DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, 1, 1), // S3_OUT D1_ST6 - DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, 1, 0), // S4_OUT D1_ST1 DEF_TIM(TIM5, CH2, PA1, TIM_USE_MOTOR | TIM_USE_LED, 1, 0), // S5_OUT / LED for REVO D1_ST4 #ifdef AIRBOTF4 DEF_TIM(TIM1, CH1, PA8, TIM_USE_MOTOR, 1, 0), // S6_OUT #else DEF_TIM(TIM5, CH1, PA0, TIM_USE_MOTOR, 1, 0), // S6_OUT D1_ST2 -#endif -#endif +#endif /* AIRBOTF4 */ +#endif /* REVOLT */ };