Giter Site home page Giter Site logo

fishpepper / opensky Goto Github PK

View Code? Open in Web Editor NEW
154.0 40.0 70.0 889 KB

opensource implementation of the frsky protocol for multiple targets (D4R-ii, VD5M)

Home Page: http://fishpepper.de/projects/opensky/

License: GNU General Public License v3.0

Makefile 0.65% C 87.82% C++ 0.88% HTML 1.21% Shell 0.01% Python 9.44%

opensky's Introduction

OpenSky

Build Status

This is an open source implementation for the pololar frsky protocol using a cc25xx transceiver chip. This software can be flashed on a DIY RX, a FrSky VD5M, or a FrSky D4R-ii receiver. Support for other FrSky receivers could be added. E.g. porting this to a X4R should be really easy.

This custom firmware implementation will give you full 8-Channel SBUS or CPPM output, full telemetry (2Channels Analog + RSSI) and much more :)

Warning

THIS SOFTWARE IS FOR EDUCATIONAL USE ONLY
DO NOT use this software to control real planes/quadrocopters.

This is for educational use only, bad things could happen if you run this on a real vehicle. Its meant to be used on indoor and/or small vehicles.

Using this code will probably void its FCC compliance and might void any transmission laws depending on your country!

I AM NOT RESPONSIBLE FOR ANY DAMAGE/INJURIES CAUSED BY USING THIS CODE!

Additionally: Do not blame me if you brick your RX during the flash upgrade. There is currently no way back to the original stock firmware once you erase/flash the devcie with my code.

Features

  • completely open source (compiles with the opensource arm gcc or sdcc compiler)
  • fully compatible to frsky 2-way protocol
  • 8 Channel CPPM output OR digital SBUS output (INVERTED or non-INVERTED mode!)
  • failsafe (constant, stopped ppm output)
  • 2 analog telemetry channels
  • RSSI telemetry
  • builtin APA102 Led control (maps to any a ppm channel)

Supported platforms

Debugging

When debug is enabled during build (default for now) you will get a vast amount of debug info on the serial port (CH5 on VD5M, CH4 on D4R-ii). Hook this up to a 3.3V serial to usb connector in order to see the debug information on a terminal

Connections

The connection depends on the receiver and the firmware configuration (main.h)

VD5M:

(CH1 is at the same side as the LEDs)
CH1 = BIND MODE (short to GND on startup to enter bind mode) / hub telemetry input (9600)
CH2 = ADC0
CH3 = ADC1
CH4 = CPPM OUT or SBUS (inverted or non-inverted, see main.h)
CH5 = Debug UART @115200 8N1 (if compiled with debug enabled)

You can connect 6 APA102 LEDs to Pins 2 (P2_1 = APA CLOCK) and 3 (P2_2 = APA DATA). NOTE: you can not flash the target as long as the APA leds are connected to P2_1,P2_2!

D4R-ii

Servo Port:

CH1 = PPM out (if sbus is disabled)
CH2 = APA102 DATA
CH3 = APA102 CLK
CH4 = Debug UART @115200 8N1 OR non-inverted SBUS (see main.h)

Serial Port:

(Pin 1 = left = the same side as the LEDs)
[1] = GND
[2] = AD2 input (max 3.3V!)
[3] = inverted SBUS (if enabled in main.h) or Debug UART if debug on
[4] = inverted Hub Telemetry (either inverted 9600 baud or inverted sbus baudrate)

rasp

Raspberry Pi V2        CC2500

16 GPIO23              GDO2
17 VCC                 VCC
19 MOSI                SI
21 MISO                SO
23 SCLK                SCLK
25 GND                 GND

03 GPIO02              LNA (Optional, if your chip have LNA)
05 GPIO03              PA  (Optional, if your chip have PA)

37 GPIO26              BIND (pull up to enter bind mode)
08 TXD                 SBUS (output using hardware uart)
40 GPIO21              PPM  (software bit banged, low quality)

BUGS

There are probably thousands of bugs. Again: DO NOT USE THIS ON A REAL PLANE/QUADROCOPTER! Please report any bugs!

Flashing

Depending on your target you will need a programmer or a serial converter to flash the software

VD5M:

You will need a CC debugger or an arduino flashed with this code in order to program the cc2510: https://github.com/fishpepper/CC2510Lib (theres a python script to flash the cc2510 in that repo as well)

Alternatively, you can use a raspberry pi to flash. This does not require any voltage dividers: https://github.com/jimmyw/CC2510Lib

Connections:

It is handy to mount a 5pin Molex Picoblade connector to the 5pin ISP connection on the side of the vd5m. This way it is easy to upgrade firmware.

ISP Port connection on vd5m

[1] = VCC (3.3V)
(2) = P2_1 = DBG DATA
(3) = P2_2 = DBG CLOCK
(4) = GND
(5) = RESET

(pin 1 is on the same side as CH1-5)

The arduino code is rather slow (>30s) whereas the cc-tool flashes in 1s in fast mode!

Notes on using cc-tool on linux: make sure to use the patched version from here: https://github.com/dashesy/cc-tool (this fix is mandatory, otherwise you get a pipe error msg -> https://github.com/dashesy/cc-tool/commit/3ebc61763ff5d0dadbdc2f7163e85ca5d002bb0f)

D4R-ii

This target can be flashed using either a ST-Link V2 or by using the STM32 serial bootloader.

ST-Link

Connection:

GND    = GND
SWDIO  = R12 (the non-gnd side connected to STM32 pin 34)
SWDCLK = RP2, pin4 (connected to to STM32 pin 37)

Connect the STLink, power the target and run

make TARGET=D4RII unlock
make TARGET=D4RII flash

to program the device.

Serial bootloader

The STM32 series of chips has a ROM based un-brickable bootloader. In order to enter the bootloader temporarily short circuit the Jumperpad R19 to enter the boot loader. The D4R-ii has a signal inverter on board, thus the serial lines are inverted.

Connect an inverted serial cable to the 4pin connector (FTDI devices can be configured to invert rx and tx using mprog!)

(Pin 1 = left = the same side as the LEDs)
[1] = GND
[2] = AD2 = do not connect for flashing
[3] = inverted TX ---> connect to RX 
[4] = inverted RX ---> connect to TX

TODO: add flash command to makefile/doc

Random notes:

Just in case you need to mount a new antenna: My vd5m came with a 3.5cm antenna wire. However it should be 31.5mm long (1/4 wavelength at 2.4GHz)

Thanks

Thanks to midelic from rcgroups.com for the reverse engineering and code for the atmega implementation of the frsky protocol! Thanks to holger for the d4r-ii donation ;)

opensky's People

Contributors

blckmn avatar fishpepper avatar jimmyw avatar knockoutperformance avatar mj666 avatar packocrayons avatar sschulz16 avatar thiagohmoreira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opensky's Issues

rssi on sbus like xm

Hi,
short nooby question, what is needed to implement an artificial channel on sbus representing current rssi?
Like the XM is already doing, I guess the microcontroller somehow measures the rssi pad of the CC25XX chip and builds it into the sbus stream.
if the microcontroller communicates with the radio chip over spi, is it possible to read the rssi too?
I hope that this feature is possible just with just a small modification on x4r-ii

best regards!

Project files for CubeMX

Hello! This is not a issue!
First of all thank you some much for this really clean coded Software! I'm currently trying to add a new target. The STM32 Mini board is really common and shares the same MCU as the d4r-ii. It would make things way easier for me, if you could provide me with the project file for CubeMX you used for your implementation of the d4r-ii.
Thanks for your time!

Telemetry Broken on D4R-II

Can't seem to get telemetry to work on a D4R-II.

If I set DEBUG 1 and TELEMETRY_DO_TEST 1, I get the following no matter what baud rate I set the FC (Naze32 running BetaFlight 3.0.1) to, or if I switch between telemetry_inversion ON/OFF.

Log always just shows a bunch of S's when in this mode. S's stop when I pull the telemetry pin from the FC.

Telemetry works by swapping in a stock D4R-II.

OpenSky - BUILD_TARGET - (c) by github.com/fishpepper

uart: init done
wdt: init
timeout: init
storage: init
hal_storage: freeing i2c bus with clock train
hal_storage: i2c free again
storage: reading
hal_storage: i2c read_buffer(0x0000, ..., 51)
hal_storage: reading 51bytes: 01 B9 BB 02 AC 6B 2A D4 93 52 11 BB 7A 39 E3 A2 61 20 CA 89 48 07 B3 70 31 D9 98 57 16 C0 7F 3E E8 A7 66 25 CF 8E 4D 0C B6 75 34 DE 9D 5C 1B C5 84 43 14 . done.
hal_storage: read done
storage: loaded hoptable[] = 02 AC 6B 2A D4 93 52 11 BB 7A 39 E3 A2 61 20 CA 89 48 07 B3 70 31 D9 98 57 16 C0 7F 3E E8 A7 66 25 CF 8E 4D 0C B6 75 34 DE 9D 5C 1B C5 84 43
frsky: init
cc25xx: init
frsky: cc25xx partnum 0x80 version 0x03
frsky: got valid part and version info
frsky: configure
frsky: configure done
frsky: BIND jumper set = NO -> no binding
frsky: using txid 0xB9BB
frsky: calib pll
frsky: tuning hop[] = 02 AC 6B 2A D4 93 52 11 BB 7A 39 E3 A2 61 20 CA 89 48 07 B3 70 31 D9 98 57 16 C0 7F 3E E8 A7 66 25 CF 8E 4D 0C B6 75 34 DE 9D 5C 1B C5 84 43
frsky: calib fscal0 = 20
frsky: calib fscal1 = 1A 23 20 1C 25 22 1F 1B 24 21 1D 26 23 1F 1C 25 22 1E 1A 24 20 1D 26 22 1F 1B 24 21 1E 26 23 20 1C 25 22 1E 1B 24 20 1D 26 23 1F 1C 25 21 1E
frsky: calib fscal2 = 0x0C
frsky: calib fscal3 = 0xAC
frsky: calib pll done
frsky: init done
adc: init
sbus: init
sbus: init done
failsafe: init
telemetry: init
soft_serial: init
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS

Run as a low power d8/d16 tx

Is there any way to config this to run as small transmitter?

Essentially a reflash.. With typical outcome being to receive a ppm signal from a head tracker... And bind to a multi protocol module as a trainer signal?

short range

hello Simon
About VERSIONS cc2510 ( tinyfish fc or usky )
i get short range < 30m even <20m when fly place many obstacles . Do you plan support version full range ?

help firmware D8

hello Simon
i have two RX xm + , after update some firmware from Frsky , now My RX can not work and can not flash firmware again by Taranis .
i check chip CC2510 bys martTI04 still can read Chip , mean stil alive. But now i do not have a firmware X to flash for CC2510 , but i think can use D8 on it ? right ? Can you support a firmware on XM + ?

thanks

Support for CRSF with Telemetry

This is possibly a completely out there idea and no idea if its possible or not but it would be great to see support for CRSF since it supports only requiring a single UART instead of one for serial and one for telemetry.

Eg. betaflight/betaflight#1504

D4R-II: SBUS and 2 ch PWM output?

Hello,

is it possible with this firmware to use SBUS and additionally have 2 channels with PWM output for Servos? If yes, what would I need to configure for that?

Thanks
Sebastian

Missing def on Preprocessor condition

Hello!
I had a minor issue while inverting the ppm output on the stm32f1 arch.
Line 83 in hal_ppm.c has to be modified from #if ... to #ifdef ...

#if PPM_INVERTED tim_oc_init.TIM_OCMode = TIM_OCMode_PWM2; #else tim_oc_init.TIM_OCMode=TIM_OCMode_PWM1; #endif // PPM_INVERTED

Thanks for the otherwise very nice Code!

Project status?

A couple of questions...

  1. was this project abandoned? or is it still active? If not, what was the last status of the source code? What works & what doesn't?

  2. was there any effort to try to convert this to the newer 16-channel D16 protocol, and possibly include features such as F.PORT?

I'm mainly interested in flashing a D4R-II rx with new firmware in order to have it bind to D16 & be able to do 16ch SBUS and FPORT (basically, converting it into something like an X4R with the upgraded FrSky FPORT firmware).

As you know, there's already a firmware project on rcgroups by user "Mike Blandford," but it's apparently closed-source / he's unwilling to share his src.

Support for WS2812 LED

Hi,

it is more a feature request. Is it possible to have WS2812 LED instead of the APA?

Best Christian

Connecting two receivers possible?

Hi,
I recently raised a feature request in the iNav community (iNavFlight/inav#3626). The target here is to capture telemetry data (S.PORT protocol) from the RX of plane 1 (XSR for example) and parse it to the iNav flight controller of plane 2 (serial data-stream) and vice versa.
This would allow iNav to calculate the position of another aircraft and guide you using OSD arrow.
One easy option would be to add some 433Mhz telemetry radios (https://goo.gl/BzbToL), most likely known from Ardupilot project. But this would add another transmitting and maybe interfering component to the aircraft. My question is, do you see an option to capture S.Port GPS telemtry data from an XSR using your custom firmware?
As far as my understanding goes, binding a RX to TX is being done sending a custom ID from TX to RX. RX saves ID and only reacts on this if data is being sent. How about the other way round, when a RX is sending telemetry data? Is there a way to catch this data and parse it on a serial port ?
Many thanks for your thoughts and assistance :)
Greetings,
Daniel.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.