Skip to content

Commit

Permalink
AlienFligth F3 V2 support
Browse files Browse the repository at this point in the history
Updated SPI driver (SPI3 on F3 targets)
AK8963 Mag support (part of MPU9250)
MPU9250 SPI support via MPU6500 driver
Updated LED driver for alternative LED sets
Enable gyro intterupt for AlienFlight F3 targets
Update AlienWii/AlienFlight documentation
Rename AlienWii to AlienFlight
  • Loading branch information
MJ666 authored and borisbstyle committed Feb 2, 2016
1 parent b1476c0 commit 7634e4c
Show file tree
Hide file tree
Showing 36 changed files with 766 additions and 242 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ env:
- TARGET=PORT103R
- TARGET=SPARKY
- TARGET=STM32F3DISCOVERY
- TARGET=ALIENWIIF1
- TARGET=ALIENWIIF3
- TARGET=ALIENFLIGHTF1
- TARGET=ALIENFLIGHTF3

# use new docker environment
sudo: false
Expand Down
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ FORKNAME = betaflight

CC3D_TARGETS = CC3D CC3D_OPBL

VALID_TARGETS = NAZE NAZE32PRO OLIMEXINO STM32F3DISCOVERY CHEBUZZF3 $(CC3D_TARGETS) CJMCU EUSTM32F103RC SPRACINGF3 PORT103R SPARKY ALIENWIIF1 ALIENWIIF3 COLIBRI_RACE LUX_RACE MOTOLAB RMDO IRCFUSIONF3 AFROMINI
VALID_TARGETS = NAZE NAZE32PRO OLIMEXINO STM32F3DISCOVERY CHEBUZZF3 $(CC3D_TARGETS) CJMCU EUSTM32F103RC SPRACINGF3 PORT103R SPARKY ALIENFLIGHTF1 ALIENFLIGHTF3 COLIBRI_RACE LUX_RACE MOTOLAB RMDO IRCFUSIONF3 AFROMINI

# Valid targets for OP VCP support
VCP_VALID_TARGETS = $(CC3D_TARGETS)
Expand All @@ -51,10 +51,10 @@ VCP_VALID_TARGETS = $(CC3D_TARGETS)
OPBL_VALID_TARGETS = CC3D_OPBL

64K_TARGETS = CJMCU
128K_TARGETS = ALIENWIIF1 $(CC3D_TARGETS) NAZE OLIMEXINO RMDO AFROMINI
256K_TARGETS = EUSTM32F103RC PORT103R STM32F3DISCOVERY CHEBUZZF3 NAZE32PRO SPRACINGF3 IRCFUSIONF3 SPARKY ALIENWIIF3 COLIBRI_RACE LUX_RACE MOTOLAB
128K_TARGETS = ALIENFLIGHTF1 $(CC3D_TARGETS) NAZE OLIMEXINO RMDO AFROMINI
256K_TARGETS = EUSTM32F103RC PORT103R STM32F3DISCOVERY CHEBUZZF3 NAZE32PRO SPRACINGF3 IRCFUSIONF3 SPARKY ALIENFLIGHTF3 COLIBRI_RACE LUX_RACE MOTOLAB

F3_TARGETS = STM32F3DISCOVERY CHEBUZZF3 NAZE32PRO SPRACINGF3 IRCFUSIONF3 SPARKY ALIENWIIF3 COLIBRI_RACE LUX_RACE MOTOLAB RMDO
F3_TARGETS = STM32F3DISCOVERY CHEBUZZF3 NAZE32PRO SPRACINGF3 IRCFUSIONF3 SPARKY ALIENFLIGHTF3 COLIBRI_RACE LUX_RACE MOTOLAB RMDO


# Configure default flash sizes for the targets
Expand Down Expand Up @@ -221,9 +221,9 @@ endif
TARGET_DIR = $(ROOT)/src/main/target/$(TARGET)
TARGET_SRC = $(notdir $(wildcard $(TARGET_DIR)/*.c))

ifeq ($(TARGET),ALIENWIIF1)
# ALIENWIIF1 is a VARIANT of NAZE
TARGET_FLAGS := $(TARGET_FLAGS) -DNAZE -DALIENWII32
ifeq ($(TARGET),ALIENFLIGHTF1)
# ALIENFLIGHTF1 is a VARIANT of NAZE
TARGET_FLAGS := $(TARGET_FLAGS) -DNAZE -DALIENFLIGHT
TARGET_DIR = $(ROOT)/src/main/target/NAZE
endif

Expand Down Expand Up @@ -378,7 +378,7 @@ NAZE_SRC = startup_stm32f10x_md_gcc.S \
$(HIGHEND_SRC) \
$(COMMON_SRC)

ALIENWIIF1_SRC = $(NAZE_SRC)
ALIENFLIGHTF1_SRC = $(NAZE_SRC)

AFROMINI_SRC = $(NAZE_SRC)

Expand Down Expand Up @@ -612,8 +612,12 @@ SPARKY_SRC = \
$(COMMON_SRC) \
$(VCP_SRC)

ALIENWIIF3_SRC = \
$(SPARKY_SRC)
ALIENFLIGHTF3_SRC = \
$(SPARKY_SRC) \
drivers/accgyro_mpu6500.c \
drivers/accgyro_spi_mpu6500.c \
drivers/compass_ak8963.c \
hardware_revision.c

RMDO_SRC = \
$(STM32F30x_COMMON_SRC) \
Expand Down
2 changes: 1 addition & 1 deletion build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ doc_files=(
'Blackbox.md'
'Migrating from baseflight.md'
'Boards.md'
'Board - AlienWii32.md'
'Board - AlienFlight.md'
'Board - CC3D.md'
'Board - CJMCU.md'
'Board - Naze32.md'
Expand Down
45 changes: 45 additions & 0 deletions docs/Board - AlienFlight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Board - AlienFlight (ALIENFLIGHTF1 and ALIENFLIGHTF3 target)

AlienWii is now AlienFlight. This target supports various variants of brushed and brusless flight controllers. The designs for them are released for public use at:

http://www.alienflight.com

All published designs are flight tested by various people. The intention here is to make this flight controllers available and enable skilled users or RC vendors to build this designs.

Here are the general hardware specifications for this boards:

- STM32F103CBT6 MCU (ALIENFLIGHTF1)
- STM32F303CCT6 MCU (ALIENFLIGHTF3)
- MPU6050/6500/9250 accelerometer/gyro(/mag) sensor unit
- The MPU sensor interrupt is connected to the MCU for all new F3 designs and enabled in the firmware
- 4-8 x 4.2A to 9.5A brushed ESCs, integrated, to run the strongest micro motors
- extra-wide traces on the PCB, for maximum power throughput
- USB port, integrated
- (*) serial connection for external DSM2/DSMX sat receiver (e.g. Spektrum SAT, OrangeRx R100, Lemon RX or Deltang Rx31)
- CPPM input
- ground and 3.3V for the receiver
- hardware bind plug for easy binding
- motor connections are at the corners for a clean look with reduced wiring
- small footprint
- direct operation from an single cell lipoly battery
- 3.3V LDO power regulator (older prototypes)
- 3.3V buck-boost power converter (all new versions)
- 5V buck-boost power converter for FPV (some versions)
- battery monitoring with an LED for buzzer functionality (actually for some ALIENFLIGHTF3 variants only)

(*) Spektrum Compatible DSM2 satellites are supported out of the box. DSMX sat will work with DSM2 protocol with default settings (DSM2, 11bit, 11ms is preset). This is chosen for maximum compatibility. For optimal connection it is recommended to adjust settings to match the capabilities of your transmitter and satellite receiver. If possible it is recommended to use the DSMX protocol since it is known as more reliable. Also to make use of additional channels you should adjust the following two parameters with the Cleanflight Configurator.

set serialrx_provider = 1 (0 for 1024bit, 1 for 2048bit)
set spektrum_sat_bind = 5

For more detail of the different bind modes please refer the [Spektrum Bind](Spektrum bind.md) document

Deltang receivers in serial mode will work like any other Spektrum satellite receiver (10bit, 22ms) only the bind process will be different.

The pin layout for the ALIENFLIGHTF1 is very similar to NAZE32 or the related clones (MW32, Flip32, etc.). The hardware bind pin is connected to pin 41 (PB5). The pin layout for the ALIENFLIGHTF3 is similar to Sparky. The hardware bind pin is connected to pin 25 (PB12). The new AlienFlightF3 V2 design have the sensor connected via SPI and some slightly different pin layout. All AlienFlight/AlienWii F3 layouts running the same firmware which takes care on the differences with an hardware detection.

The AlienFlight firmware will be built as target ALIENFLIGHTF1 or ALIENFLIGHTF3. The firmware image will come with alternative default settings which will give the user a plug and play experience. There is no computer needed to get this into the air with an small Quadcopter. An preconfigured custom mixer for an Octocopter is part of the default settings to allow clean straight wiring with the AlienFlight. The mixer can be activated with "mixer custom" in the CLI. To use the AlienFlight in an Hexa- or Octocopter or to do some more tuning. Additional configuration changes can be done as usual in the CLI or the Cleanflight configurator.

## Flashing the firmware

The firmware can be updated with the Cleanflight configurator as for any other target. All AlienFlight boards have an boot jumper which need to be closed for the initial flashing or for recovery from an broken firmware.
38 changes: 0 additions & 38 deletions docs/Board - AlienWii32.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/Boards.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The current focus is geared towards flight controller hardware that use the STM3

The core set of supported flyable boards are:

* AlienWii32
* AlienFlight
* CC3D
* CJMCU
* Flip32+
Expand Down
14 changes: 7 additions & 7 deletions docs/Spektrum bind.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This is to activate the hardware bind plug feature

## Hardware

The hardware bind plug will be enabled via defining HARDWARE_BIND_PLUG during building of the firmware. BINDPLUG_PORT and BINDPLUG_PIN also need to be defined (please see above). This is done automatically if the AlienWii32 firmware is built. The hardware bind plug is expected between the defined bind pin and ground.
The hardware bind plug will be enabled via defining HARDWARE_BIND_PLUG during building of the firmware. BINDPLUG_PORT and BINDPLUG_PIN also need to be defined (please see above). This is done automatically if the AlienFlight firmware is built. The hardware bind plug is expected between the defined bind pin and ground.

## Function

Expand All @@ -34,12 +34,12 @@ Please refer to the satellite receiver documentation for more details of the spe

## Table with spektrum_sat_bind parameter value

| Value | Receiver mode | Notes |
| ----- | ------------------| -------------------|
| 3 | DSM2 1024bit/22ms | |
| 5 | DSM2 2048bit/11ms | default AlienWii32 |
| 7 | DSMX 1024bit/22ms | |
| 9 | DSMX 2048bit/11ms | |
| Value | Receiver mode | Notes |
| ----- | ------------------| --------------------|
| 3 | DSM2 1024bit/22ms | |
| 5 | DSM2 2048bit/11ms | default AlienFlight |
| 7 | DSMX 1024bit/22ms | |
| 9 | DSMX 2048bit/11ms | |

More detailed information regarding the satellite binding process can be found here:
http://wiki.openpilot.org/display/Doc/Spektrum+Satellite
Expand Down
4 changes: 2 additions & 2 deletions fake_travis_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ targets=("PUBLISHMETA=True" \
"TARGET=RMDO" \
"TARGET=SPARKY" \
"TARGET=STM32F3DISCOVERY" \
"TARGET=ALIENWIIF1" \
"TARGET=ALIENWIIF3")
"TARGET=ALIENFLIGHTF1" \
"TARGET=ALIENFLIGHTF3")

#fake a travis build environment
export TRAVIS_BUILD_NUMBER=$(date +%s)
Expand Down
15 changes: 7 additions & 8 deletions src/main/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,12 @@ static void resetConf(void)
featureSet(FEATURE_FAILSAFE);
#endif

// alternative defaults settings for ALIENWIIF1 and ALIENWIIF3 targets
#ifdef ALIENWII32
// alternative defaults settings for ALIENFLIGHTF1 and ALIENFLIGHTF3 targets
#ifdef ALIENFLIGHT
featureSet(FEATURE_RX_SERIAL);
featureSet(FEATURE_MOTOR_STOP);
#ifdef ALIENWIIF3
featureClear(FEATURE_ONESHOT125);
#ifdef ALIENFLIGHTF3
masterConfig.serialConfig.portConfigs[2].functionMask = FUNCTION_RX_SERIAL;
masterConfig.batteryConfig.vbatscale = 20;
#else
Expand All @@ -621,15 +622,13 @@ static void resetConf(void)
masterConfig.escAndServoConfig.minthrottle = 1000;
masterConfig.escAndServoConfig.maxthrottle = 2000;
masterConfig.motor_pwm_rate = 32000;
currentProfile->pidProfile.pidController = 3;
currentProfile->pidProfile.P8[ROLL] = 36;
currentProfile->pidProfile.P8[PITCH] = 36;
currentProfile->pidProfile.pidController = 2;
masterConfig.failsafeConfig.failsafe_delay = 2;
masterConfig.failsafeConfig.failsafe_off_delay = 0;
currentControlRateProfile->rcRate8 = 130;
currentControlRateProfile->rcRate8 = 100;
currentControlRateProfile->rates[FD_PITCH] = 20;
currentControlRateProfile->rates[FD_ROLL] = 20;
currentControlRateProfile->rates[FD_YAW] = 100;
currentControlRateProfile->rates[FD_YAW] = 20;
parseRcChannels("TAER1234", &masterConfig.rxConfig);

// { 1.0f, -0.414178f, 1.0f, -1.0f }, // REAR_R
Expand Down
1 change: 1 addition & 0 deletions src/main/drivers/accgyro_mpu6500.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#define MPU6500_WHO_AM_I_CONST (0x70)
#define MPU9250_WHO_AM_I_CONST (0x71)

#define MPU6500_BIT_RESET (0x80)

Expand Down
7 changes: 4 additions & 3 deletions src/main/drivers/accgyro_spi_mpu6500.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ bool mpu6500SpiDetect(void)

mpu6500ReadRegister(MPU_RA_WHO_AM_I, 1, &tmp);

if (tmp != MPU6500_WHO_AM_I_CONST)
return false;
if (tmp == MPU6500_WHO_AM_I_CONST || tmp == MPU9250_WHO_AM_I_CONST) {
return true;
}

return true;
return false;
}

bool mpu6500SpiAccDetect(acc_t *acc)
Expand Down
Loading

0 comments on commit 7634e4c

Please sign in to comment.