Skip to content

Commit

Permalink
New target: F3FC Racing
Browse files Browse the repository at this point in the history
F3FC Racing board from RCExplorer.se.

Upcoming standalone board (not the Tricopter integrated).
  • Loading branch information
lkaino committed Jul 7, 2016
1 parent 884ac0b commit e376f37
Show file tree
Hide file tree
Showing 10 changed files with 798 additions and 5 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ env:
- TARGET=CHEBUZZF3
- TARGET=OLIMEXINO
- TARGET=IRCFUSIONF3
- TARGET=F3FCRACING

# use new docker environment
sudo: false
Expand Down
26 changes: 23 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ FORKNAME = cleanflight

64K_TARGETS = CJMCU
128K_TARGETS = ALIENFLIGHTF1 CC3D NAZE OLIMEXINO RMDO SPRACINGF1OSD
256K_TARGETS = ALIENFLIGHTF3 CHEBUZZF3 COLIBRI_RACE EUSTM32F103RC IRCFUSIONF3 LUX_RACE MOTOLAB PORT103R SPARKY SPRACINGF3 SPRACINGF3EVO SPRACINGF3MINI STM32F3DISCOVERY SPRACINGF3OSD
256K_TARGETS = ALIENFLIGHTF3 CHEBUZZF3 COLIBRI_RACE EUSTM32F103RC IRCFUSIONF3 LUX_RACE MOTOLAB PORT103R SPARKY SPRACINGF3 SPRACINGF3EVO SPRACINGF3MINI STM32F3DISCOVERY SPRACINGF3OSD F3FCRACING

F3_TARGETS = ALIENFLIGHTF3 CHEBUZZF3 COLIBRI_RACE IRCFUSIONF3 LUX_RACE MOTOLAB RMDO SPARKY SPRACINGF3 SPRACINGF3EVO SPRACINGF3MINI STM32F3DISCOVERY SPRACINGF3OSD
F3_TARGETS = ALIENFLIGHTF3 CHEBUZZF3 COLIBRI_RACE IRCFUSIONF3 LUX_RACE MOTOLAB RMDO SPARKY SPRACINGF3 SPRACINGF3EVO SPRACINGF3MINI STM32F3DISCOVERY SPRACINGF3OSD F3FCRACING

VALID_TARGETS = $(64K_TARGETS) $(128K_TARGETS) $(256K_TARGETS)

VCP_TARGETS = CC3D ALIENFLIGHTF3 CHEBUZZF3 COLIBRI_RACE LUX_RACE MOTOLAB SPARKY SPRACINGF3EVO SPRACINGF3MINI STM32F3DISCOVERY SPRACINGF1OSD SPRACINGF3OSD
VCP_TARGETS = CC3D ALIENFLIGHTF3 CHEBUZZF3 COLIBRI_RACE LUX_RACE MOTOLAB SPARKY SPRACINGF3EVO SPRACINGF3MINI STM32F3DISCOVERY SPRACINGF1OSD SPRACINGF3OSD F3FCRACING
OSD_TARGETS = SPRACINGF1OSD SPRACINGF3OSD

# Configure default flash sizes for the targets
Expand Down Expand Up @@ -631,6 +631,26 @@ ALIENFLIGHTF3_SRC = \
$(FC_COMMON_SRC) \
$(SYSTEM_SRC) \
$(VCP_SRC)

F3FCRACING_SRC = \
$(STM32F30x_COMMON_SRC) \
$(STM32F30x_FC_COMMON_SRC) \
drivers/accgyro_mpu.c \
drivers/accgyro_spi_mpu6000.c \
drivers/barometer_ms5611.c \
drivers/compass_hmc5883l.c \
drivers/compass_ak8975.c \
drivers/display_ug2864hsweg01.c \
drivers/serial_usb_vcp.c \
drivers/flash_m25p16.c \
drivers/light_ws2811strip.c \
drivers/light_ws2811strip_stm32f30x.c \
drivers/sonar_hcsr04.c \
io/flashfs.c \
$(HIGHEND_SRC) \
$(FC_COMMON_SRC) \
$(SYSTEM_SRC) \
$(VCP_SRC)

RMDO_SRC = \
$(STM32F30x_COMMON_SRC) \
Expand Down
61 changes: 61 additions & 0 deletions docs/Board - F3FC Racing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Board - F3FC Racing

Designed by RCExplorer.se

Full details available on the website, here:

http://rcexplorer.se/product/f3fc-racing/

## Hardware Features

* STM32F303CC Processor
* MPU6000 connected via SPI (With interrupt pin connected)
* 3 UARTs
* VCP USB
* 6 PWM channels (PWM 6 used as PPM input when selected)
* Supports SBus, SumH, SumD, Spektrum1024/2048, XBus and PPM receivers. No external inverters required.
* Dedicated RGB LED control pin.
* Dedicated I2C port
* Integrated battery monitoring
* Current sensor input pin
* Buzzer/Beeper port
* Built in 5V BEC (500mA)
* Push button for entering DFU mode
* 3.3V pad available for spectrum satellite receivers.

## Serial Ports

| Value | Identifier | RX | TX | Notes |
| ----- | ------------ | ------------ | ------------ | ------------------------------------------------------------------------------------------- |
| 1 | VCP | PA11 | PA12 | Mini USB connector |
| 2 | USART1 | PB7 | PB6 | Marked as R1 and T1 on the board |
| 3 | USART2 | PA3 | PA2 | Marked as R2 and T2 on the board |
| 4 | USART3 | PB11 | PB10 | Marked as R3 and T3 on the board |

## Pinouts

Full pinout details are available in the manual, here:

http://rcexplorer.se/product/f3fc-racing/

### IOs

| Pad | Signal | Notes |
| ------ | -------------- | -------------------------------------------- |
| Isense | PB2 | Analog sensor |
| Vbat | PA5 | Voltage supplied to the built in BEC |
| LED | PB8 | RGB LED control |
| FB | PA6 | Servo position FeedBack / RSSI input |
| BZ- | PA0 | Buzzer output |
| 6 | PA1 | Used as PPM input when selected |
| SCLK | PA9 | SCLK I2C |
| SDA | PA10 | SDA I2C |


PWM’s are marked as 1-6

## Voltage and current monitoring

Voltage is measured on the “Vbat” (which also powers the built in BEC) pads through a voltage divider of 10k/1k connected to PA5.

Isense pad is connected straight to PB2 and expects an analog voltage between 0-3.3V
3 changes: 2 additions & 1 deletion fake_travis_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ targets=("PUBLISHMETA=True" \
"TARGET=EUSTM32F103RC" \
"TARGET=CHEBUZZF3" \
"TARGET=OLIMEXINO" \
"TARGET=IRCFUSIONF3" )
"TARGET=IRCFUSIONF3" \
"TARGET=F3FCRACING" )

#fake a travis build environment
export TRAVIS_BUILD_NUMBER=$(date +%s)
Expand Down
47 changes: 47 additions & 0 deletions src/main/drivers/pwm_mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,46 @@ static const uint16_t airPWM[] = {
};
#endif

#ifdef F3FCRACING
static const uint16_t multiPPM[] = {
PWM6 | (MAP_TO_PPM_INPUT << 8), // PPM input
PWM3 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
PWM2 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM17 - can be switched to servo
PWM4 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
PWM1 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM1
PWM5 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
0xFFFF
};

static const uint16_t multiPWM[] = {
PWM3 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
PWM2 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM17 - can be switched to servo
PWM4 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
PWM1 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM1
PWM5 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
0xFFFF
};

static const uint16_t airPPM[] = {
PWM6 | (MAP_TO_PPM_INPUT << 8), // PPM input
PWM3 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
PWM2 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM17 - can be switched to servo
PWM4 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
PWM1 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM1
PWM5 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
0xFFFF
};

static const uint16_t airPWM[] = {
PWM3 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
PWM2 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM17 - can be switched to servo
PWM4 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
PWM1 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM1
PWM5 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
0xFFFF
};
#endif

static const uint16_t * const hardwareMaps[] = {
multiPWM,
multiPPM,
Expand Down Expand Up @@ -809,6 +849,13 @@ pwmIOConfiguration_t *pwmInit(drv_pwm_config_t *init)
type = MAP_TO_SERVO_OUTPUT;
#endif

#if defined(F3FCRACING)
if (timerIndex == PWM2)
{
type = MAP_TO_SERVO_OUTPUT;
}
#endif

#if defined(NAZE32PRO) || (defined(STM32F3DISCOVERY) && !defined(CHEBUZZF3))
// remap PWM 5+6 or 9+10 as servos - softserial pin pairs require timer ports that use the same timer
if (init->useSoftSerial) {
Expand Down
17 changes: 17 additions & 0 deletions src/main/drivers/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,23 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
#define TIMER_APB1_PERIPHERALS (RCC_APB1Periph_TIM2 | RCC_APB1Periph_TIM3 | RCC_APB1Periph_TIM4)
#define TIMER_APB2_PERIPHERALS (RCC_APB2Periph_TIM1 | RCC_APB2Periph_TIM15 | RCC_APB2Periph_TIM16 | RCC_APB2Periph_TIM17)
#define TIMER_AHB_PERIPHERALS (RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB)
#endif

#if defined(F3FCRACING)
const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
{ TIM3, GPIOA, Pin_4, TIM_Channel_2, TIM3_IRQn, 1, Mode_AF_PP, GPIO_PinSource4, GPIO_AF_2}, // PWM1 - PA4
{ TIM17, GPIOA, Pin_7, TIM_Channel_1, TIM1_TRG_COM_TIM17_IRQn, 1, Mode_AF_PP, GPIO_PinSource7, GPIO_AF_1}, // PWM2 - PA7
{ TIM1, GPIOA, Pin_8, TIM_Channel_1, TIM1_CC_IRQn, 1, Mode_AF_PP, GPIO_PinSource8, GPIO_AF_6}, // PWM3 - PA8
{ TIM3, GPIOB, Pin_0, TIM_Channel_3, TIM3_IRQn, 1, Mode_AF_PP, GPIO_PinSource0, GPIO_AF_2}, // PWM4 - PB0
{ TIM3, GPIOB, Pin_1, TIM_Channel_4, TIM3_IRQn, 1, Mode_AF_PP, GPIO_PinSource1, GPIO_AF_2}, // PWM5 - PB1
{ TIM2, GPIOA, Pin_1, TIM_Channel_2, TIM2_IRQn, 0, Mode_AF_PP, GPIO_PinSource1, GPIO_AF_1}, // PWM6 - PPM
};

#define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(17))

#define TIMER_APB1_PERIPHERALS (RCC_APB1Periph_TIM2 | RCC_APB1Periph_TIM3)
#define TIMER_APB2_PERIPHERALS (RCC_APB2Periph_TIM1 | RCC_APB2Periph_TIM17)
#define TIMER_AHB_PERIPHERALS (RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB)

#endif

Expand Down
2 changes: 1 addition & 1 deletion src/main/sensors/initialisation.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const extiConfig_t *selectMPUIntExtiConfig(void)
return &cc3dMPUIntExtiConfig;
#endif

#ifdef MOTOLAB
#if defined(MOTOLAB) || defined(F3FCRACING)
static const extiConfig_t MotolabF3MPUIntExtiConfig = {
.gpioAHBPeripherals = RCC_AHBPeriph_GPIOA,
.gpioPort = GPIOA,
Expand Down
Loading

0 comments on commit e376f37

Please sign in to comment.