WIP WIP WIP  manual being revamped  WIP WIP WIP

Open Flight Stabilizer (FlightStab)

updated 07/072013

rcgroups thread http://www.rcgroups.com/forums/showthread.php?t=1794672

source code https://github.com/noobee/FlightStab

build images https://github.com/noobee/FlightStab/tree/master/Builds

Key Features

note that some features are currently only in the dev/beta image.

Supported Devices

Flashing the Firmware (for non Arduino-based boards)

Flash using eXtreme Burner

Setting up eXtremeBurner (first time)

        <CHIP>

                <NAME>ATmega168PA</NAME>

                <FLASH>16384</FLASH>

                <EEPROM>512</EEPROM>

                <SIG>0x000B941E</SIG>

                <PAGE>128</PAGE>

                <LFUSE layout="2">YES</LFUSE>

                <HFUSE layout="3">YES</HFUSE>

                <EFUSE layout="2">YES</EFUSE>

                <LOCK>YES</LOCK>

                <CALIB>YES</CALIB>

                <PLACEMENT>.\Images\Placements\ZIF_DIP_40.bmp</PLACEMENT>

        </CHIP>

        Checking and erasing the device before flashing for the first time

    lo=0xf7

    hi=0xdf

    ext=0xf9

    lock=0xfc

        Flashing the device (each time you want to upgrade the firmware)

Flash using avrdude

avrdude -C "C:\Program Files\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf" -c usbasp -p m168p -U flash:w:<filename>.hex

Flash using avrdude on NanoWii (which has the arduino/leonardo bootloader)

avrdude -p m32u4 -P COM7 -c avr109 -b 1200

TIMEOUT 3
avrdude -p m32u4 -P
COM5 -c avr109 -D -Uflash:w:%1:i

TIMEOUT 3

Save above code to a Text file and rename something handy for you, example NanoFlash.bat. Open Explorer and type into address bar '%APPDATA%\Microsoft\Windows\SendTo' and put NanoFlash.bat in that folder.

You'll need to swap details in Blue/Red to suit your FC.

How to find Trigger and Active Comports:

How to use

Optional: Flashing the AVRootloader

It is possible to flash a bootloader via usbasp on the RX3S. If the bootloader is installed, then flashing the main stabilizer firmware does not require the usbasp. Instead, an FTDI USB-serial adapter with a small circuit mod connects to the AILR_OUT channel, which is more convenient than opening up the device to upgrade the firmware via the usbasp ISP connector. The circuit mod follows:

https://docs.google.com/drawings/d/1WhYAdw_9QpfYJWmOuu2IhCJNw6rNNagTw_OZEqriTo8/pub?w=867&h=439

Steps to flash the bootloader (note: for RX3S only):

Steps to flash the stabilizer image with a bootloader-enabled device:

OPTIONAL: Building the firmware image from source code

Building firmware from sources is optional, you can also use prebuilt firmware in .\FlightStab\Builds\*.hex

Building the firmware via arduino IDE

C:\users\<user>\My Documents\Arduino\Libraries\_Stub

C:\users\<user>\My Documents\Arduino\Libraries\I2Cdev

C:\users\<user>\My Documents\Arduino\Libraries\ITG3200

...

Building the Firmware via cmake (recommended)

cd ./Builds

rd /s .  (this optional step wipes out all intermediate files)

cmake [-DTODAY=yyyymmdd] -G"MSYS Makefiles" ..  (-DTODAY is optional to override the system date)

make [VERBOSE=1]


Connecting the RX3S V1

https://docs.google.com/drawings/d/1UIpZlqXQydiNrwG9xPUMn7-c8fgz9dmPhzMvmBZxM3g/pub?w=1036&h=1138


Connecting the RX3S V1 with CPPM

https://docs.google.com/drawings/d/1OSFdJhFkyxzuxppBQuRJt8MLZkH4-uPX9_TsbjsJbFA/pub?w=1036&h=1138


Connecting the RX3S V2


Connecting the RX3S V2 with CPPM

https://docs.google.com/drawings/d/17n4bOpNZL-B_cwbcNCIPpM4CLkEAdrxoobJhFI5-300/pub?w=1086&h=1272


Connecting the NanoWii

https://docs.google.com/drawings/d/10f_17nVnECrE8oCDNfB_Dw8DAffwjvNOaXWew73Y3qs/pub?w=739&h=637


Basic Instructions

LED Status

LED pulses

Message

2 LONG

WING mode = single aileron

3 LONG

WING mode = delta

4 LONG

WING mode = vtail

5 LONG

WING mode = dual ailerons (flapperons)

1 SHORT

RX calibrating

2 SHORT

IMU calibrating

3 SHORT

both RX and IMU calibrating

4 SHORT

HOLD stabilization mode (otherwise RATE stabilization mode)

5 SHORT

device init error (gyro)

20 VERY SHORT

low SRAM

50 VERY SHORT

EEPROM has reset, power cycle device now

RX and IMU Calibration on Startup

Mixer EPA Mode

Mixer EPA mode

Notes

FULL (default)

1000-2000 us

NORMAL

1100-1900 us

TRACKING

start with 1250-1750us, then track and never exceed the RX

CPPM Mode

Attitude Hold

Side Mounting

Stick Configuration Mode

1

2

3

4

5

6

7

8

9

Config Item

ELE servo

toggles

AIL servo
toggles

Notes

WING mode

1

1 = single aileron [default]

2 = delta

3 = vtail

4 = dual ailerons (flapperons)

NanoWii only

Roll Gain

2

-4 to 0 to +4 [+4 default]

NanoWii only

Pitch Gain

3

-4 to 0 to +4 [+4 default]

NanoWii only

Yaw Gain

4

-4 to 0 to +4 [+4 default]

NanoWii only

Mixer EPA

mode

5

1 = full (1000-2000)us [default]

2 = normal (1100-1900)us

3 = tracking the RX

CPPM Mode

6

1 = No CPPM [default]

2 = RETA1a2F order

Mount Orientation

7

1 = Normal (flat) mounting

2 = Roll 90° left and mount on left side

3 = Roll 90° right and mount on right side

Exit

8

1 = no-op

2 = write EEPROM and reboot

Resetting the EEPROM

Device

Pin pair to apply jumper

RX3S

AIL_OUT and ELE_OUT

NanoWii

D6 and D5 (in the Motor Output group)


Programming Box Support

FlightStab supports configuration through the Aquastar or DLUX programming boxes. Using the programming box is more convenient and will allow more options that using the stick configuration.

The steps to enable programming box support are:

Flashing the Aquastar/DLUX with AVRrootloader

On the Aquastar, the CPU is exposed, so it is highly recommended to use the HK chip adapter for the ISP cable to the USBasp. The ISP pads are also exposed on the PCB if you want to solder the signals instead.

On the DLUX, the CPU is hidden behind the LCD board, but the pads are exposed just above the 3rd and 4th buttons. The ISP pads have the following definitions (from left to right):

GND

29

VCC

17

16

15

GND

RESET

VCC

SCK

MISO

MOSI

After connecting the USBasp programmer to the program box via the ISP connector, the next step is to erase the chip and set the fuse for bootloader support.

Fuse

Aquastar

DLUX

LOW

0xAE

0xAE

HIGH

0xCF

0xCF

LOCK

0xFF

0xFC

On the Aquastar, the LOCK fuses are NOT set (0xFF), so you can read and save the flash image at this time in case you want to restore the factory functionality. On the DLUX, the LOCK fuses ARE set (0xFC), so you can only erase the chip to proceed.

DO NOT PROCEED if the values are unexpected.

Use the AVRootloader instructions to flash the main programming box firmware image (including using the “one-wire” serial connection). The Aquastar firmware is at  .\Builds\20130505_AQUASTAR.hex and the DLUX firmware is at .\Builds\20130505_DLUX.hex (dated 20130505 or later).

Using the Aquastar/DLUX Programming Box

Connect the programming box to the FlightStab device. The RX3S devices uses AILR_OUT as the default channel. Power them on at the same time (or the RX3S after the program box). If the device recognizes the program box, the program box will display the recognized device ID on the status page. Press left/right to change pages and up/down to change sub-options within the page.

The status page (first page) has several items. The device ID, device version, and EEPROM statistics (1/2/R). 1 means the number of times the device detected an error and reset copy #1 of the config. 2 is the same for the redundant copy. R is the number of times both copies have been reset, usually as an outcome of the jumper-based EEPROM reset procedure or by choosing “erase cfg” through the program box.

The eeprom page (last page) has several actions. Update cfg justs updates the Flighstab device with the config that you modified with the program box. Erase cfg invalidates the config so that the device will default to “factory settings” on the next restart, as if this was the first time it was booting up. Erase stats erases the 1/2/R stats.


20130702 dev onwards

https://github.com/noobee/FlightStab/tree/newcfg/Builds

20130702_RX3S_V1|2.hex

stick config

ail/ele toggles

WING_MODE

set WING mix mode

1 ail

USE_DIPSW *

based on DIP switches

1 ele

SINGLE_AIL

override to SINGLE AIL

2 ele

DELTA

override to DELTA

3 ele

V-TAIL

override to V-TAIL

4 ele

DUAL_AIL

override to DUAL AIL

5 ele

MIXER_EPA MODE

limit servo correction output to

2 ail

FULL *

1000-2000 us

1 ele

NORM

1100-1900 us

2 ele

TRACK

never exceed RX input

3 ele

CPPM_MODE

allow combined PPM input from RX

3 ail

NONE *

no CPPM, use separate RX (PWM) channels

1 ele

RETA1a2F

use CPPM with RETA1a2F

2 ele

TAER1a2F

use CPPM with TAER1a2F

3 ele

AETR1a2F

use CPPM with AETR1a2F

4 ele

MOUNT_ORIENT

support mounting sideways on flat fuselage

4 ail

NORMAL *

mount device flat “normally”

1 ele

ROLL_90_LEFT

roll device 90 deg left and mount on left side

2 ele

ROLL_90_RIGHT

roll device 90 deg right and mount on right side

3 ele

STICK_GAIN THROW

stick-position gain blends from max (1.0) to zero over

5 ail

FULL *

full stick range

1 ele

HALF

half stick range (ie. no correction from ½ stick onwards)

2 ele

QUARTER

quarter stick range

3 ele

MAX STICK_ROTATE

set stick-controlled rotation rate at full stick to

6 ail

49

49 deg/s

1 ele

98

98 deg/s

2 ele

196

196 deg/s

3 ele

391 *

391 deg/s

4 ele

782

782 deg/s

5 ele

RATE STICK_ROTATE

allow stick-controlled rotation rate in RATE mode

7 ail

DISABLE *

disabled

1 ele

ENABLE

enabled

2 ele

INFLIGHT CALIBRATE

toggle RATE/HOLD 3x within 0.5s to calibrate

8 ail

DISABLE

disable inflight RX calibration

1 ele

ENABLE *

enable inflight RX calibration

2 ele

VR_GAIN

TBD

AIL/ELE/RUD

POT = use device POT setting *

-127 to 127 = override POT setting

RATE_PID

P, I, D parameters (500, 0, 500) * for

NA

Ail P/I/D

ROLL axis P/I/D in RATE mode

Ele P/I/D

PITCH axis P/I/D in RATE mode

Rud P/I/D

YAW axis P/I/D in RATE mode

HOLD_PID

P, I, D parameters (500, 500, 500) * for

NA

Ail P/I/D

ROLL axis P/I/D in HOLD mode

Ele P/I/D

PITCH axis P/I/D in HOLD mode

Rud P/I/D

YAW axis P/I/D in HOLD mode

EEPROM

EEPROM Action

9 ail

Update Cfg

Write Config to EEPROM

2 ele

Erase Cfg

Erase Config in EEPROM  to Default

NA

Erase Stats

Erase 1/2/R Stats in EEPROM  to 0/0/0

NA