Skip to content

Commit

Permalink
Merge pull request #1316 from bitcraze/tobba/bolt11_brushed
Browse files Browse the repository at this point in the history
Added brushed support for Bolt 1.1 (HW mod required)
  • Loading branch information
krichardsson authored Sep 19, 2023
2 parents 29f2cd6 + e8f0b1f commit 89ed322
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ config PLATFORM_FLAPPER

endchoice

config BOLT11_BRUSHED
bool "Bolt 1.1: Use brushed motor driver (HW mod required)"
depends on PLATFORM_BOLT
default n
help
0R resistors 0402 (or simple wire to short) should be mounted at
R19, R22, R33, R34 and motor override signals will be disabled (high impedance).
Brushed motor should be connected + and - at motor connector (not S).

endmenu

menu "IMU configuration"
Expand Down
1 change: 1 addition & 0 deletions src/drivers/interface/motors.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ extern const MotorPerifDef* motorMapDefaltConBrushless[NBR_OF_MOTORS];
extern const MotorPerifDef* motorMapBigQuadDeck[NBR_OF_MOTORS];
extern const MotorPerifDef* motorMapBoltBrushless[NBR_OF_MOTORS];
extern const MotorPerifDef* motorMapBolt11Brushless[NBR_OF_MOTORS];
extern const MotorPerifDef* motorMapBolt11Brushed[NBR_OF_MOTORS];
extern const MotorPerifDef* motorMapCF21Brushless[NBR_OF_MOTORS];

/**
Expand Down
34 changes: 34 additions & 0 deletions src/drivers/src/motors_def.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,27 @@ static const MotorPerifDef MOTORS_PB9_TIM4_CH4_BRUSHED =
.ocInit = TIM_OC4Init,
.preloadConfig = TIM_OC4PreloadConfig,
};
// Bolt 1.1 M4, PB10, TIM2_CH3, Brushed config
static const MotorPerifDef MOTORS_PB10_TIM2_CH3_BRUSHED =
{
.drvType = BRUSHED,
.gpioPerif = RCC_AHB1Periph_GPIOB,
.gpioPort = GPIOB,
.gpioPin = GPIO_Pin_10,
.gpioPinSource = GPIO_PinSource10,
.gpioOType = GPIO_OType_PP,
.gpioAF = GPIO_AF_TIM2,
.timPerif = RCC_APB1Periph_TIM2,
.tim = TIM2,
.timPolarity = TIM_OCPolarity_High,
.timDbgStop = DBGMCU_TIM2_STOP,
.timPeriod = MOTORS_PWM_PERIOD,
.timPrescaler = MOTORS_PWM_PRESCALE,
.setCompare = TIM_SetCompare3,
.getCompare = TIM_GetCapture3,
.ocInit = TIM_OC3Init,
.preloadConfig = TIM_OC3PreloadConfig,
};

// CF2.X connector M1, PA1, TIM2_CH2, Brushless config, inversed
static const MotorPerifDef MOTORS_PA1_TIM2_CH2_BRUSHLESS_INV_PP =
Expand Down Expand Up @@ -760,6 +781,19 @@ const MotorPerifDef* motorMapBolt11Brushless[NBR_OF_MOTORS] =
&MOTORS_PB10_TIM2_CH3_BRUSHLESS_PP
};

/**
* Brushed motors mapped to the Bolt 1.1 PWM outputs.
* 0R resistors 0402 should be mounted at R19, R22, R33, R34 and
* motor override signals will be disabled (high impedance).
*/
const MotorPerifDef* motorMapBolt11Brushed[NBR_OF_MOTORS] =
{
&MOTORS_PA1_TIM2_CH2_BRUSHED,
&MOTORS_PB11_TIM2_CH4_BRUSHED,
&MOTORS_PA15_TIM2_CH1_BRUSHED,
&MOTORS_PB10_TIM2_CH3_BRUSHED
};

/**
* Brushless motors mapped to the Bolt Rev.F PWM outputs.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/modules/src/controller/position_controller_pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ PARAM_GROUP_START(posCtlPid)
*/
PARAM_ADD(PARAM_FLOAT | PARAM_PERSISTENT, xKp, &this.pidX.pid.kp)
/**
* @brief Proportional gain for the position PID in the body-yaw-aligned X direction
* @brief Integral gain for the position PID in the body-yaw-aligned X direction
*/
PARAM_ADD(PARAM_FLOAT | PARAM_PERSISTENT, xKi, &this.pidX.pid.ki)
/**
Expand Down
4 changes: 4 additions & 0 deletions src/platform/src/platform_bolt.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ static platformConfig_t configs[] = {
.deviceTypeName = "Crazyflie Bolt 1.1",
.sensorImplementation = SensorImplementation_bmi088_spi_bmp388,
.physicalLayoutAntennasAreClose = false,
#ifdef CONFIG_BOLT11_BRUSHED
.motorMap = motorMapBolt11Brushed,
#else
.motorMap = motorMapBolt11Brushless,
#endif
}
#endif
};
Expand Down

0 comments on commit 89ed322

Please sign in to comment.