mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-11-25 21:39:39 +00:00
Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96bc4f7cdf | ||
|
|
6503469ddd | ||
|
|
61a1c3742c | ||
|
|
1fb2a38bc1 | ||
|
|
22a0d79315 | ||
|
|
0cc72772a3 | ||
|
|
11f4e636e3 | ||
|
|
fef1a2e041 | ||
|
|
41a9c8e013 | ||
|
|
c1ad02b792 | ||
|
|
ab2315c951 | ||
|
|
7948e33cbc | ||
|
|
2be2dce584 | ||
|
|
69bdfe3dba | ||
|
|
d73d163a58 | ||
|
|
48a52ae5b2 | ||
|
|
078dc2ab17 | ||
|
|
6f4522caa6 | ||
|
|
3c76ce9f39 | ||
|
|
8601149051 | ||
|
|
d7ef15d435 | ||
|
|
27e3645b56 | ||
|
|
95eb4e1a22 | ||
|
|
32ea07bf5a | ||
|
|
06272575c5 | ||
|
|
edd6432d4c | ||
|
|
303c4615e9 | ||
|
|
7d327c1622 | ||
|
|
6a74b83f98 | ||
|
|
c601c2dd98 | ||
|
|
c27b60749f | ||
|
|
b3cb286088 | ||
|
|
361903e8ec | ||
|
|
d72c69242d | ||
|
|
539819fa0c | ||
|
|
d80c218744 | ||
|
|
0603d220a9 | ||
|
|
e13fe56f47 | ||
|
|
acd7694485 | ||
|
|
7f50edacc8 | ||
|
|
5a4906c5b5 | ||
|
|
4e906757b9 | ||
|
|
1f0b21e351 | ||
|
|
2f3ea323c7 | ||
|
|
d4e77c6499 | ||
|
|
ffc56b049d | ||
|
|
ddac89d732 | ||
|
|
fecf2805c7 | ||
|
|
4dcc88ba32 | ||
|
|
084308d8a4 | ||
|
|
1ffb5c405b | ||
|
|
ad29409407 | ||
|
|
6f33abb25e | ||
|
|
2c9693389e | ||
|
|
d3c82c4da4 |
105
.travis.yml
105
.travis.yml
@@ -5,14 +5,15 @@ language: c
|
||||
#
|
||||
env:
|
||||
global:
|
||||
- IDE_VERSION=1.8.1
|
||||
- IDE_VERSION=1.8.9
|
||||
matrix:
|
||||
- BOARD="multi4in1:STM32F1:multistm32f103c:upload_method=serialMethod"
|
||||
- BOARD="multi4in1:STM32F1:multistm32f103c:upload_method=TxFlashMethod"
|
||||
- BOARD="multi4in1:avr:multixmega32d4"
|
||||
- BOARD="multi4in1:avr:multiatmega328p:bootloader=none"
|
||||
- BOARD="multi4in1:avr:multiatmega328p:bootloader=optiboot"
|
||||
#
|
||||
- BOARD="multi4in1:avr:multixmega32d4"
|
||||
- BOARD="multi4in1:STM32F1:multistm32f103c:debug_option=none"
|
||||
- BOARD="multi4in1:STM32F1:multistm32f103c:debug_option=native"
|
||||
- BOARD="multi4in1:STM32F1:multistm32f103c:debug_option=ftdi"
|
||||
#
|
||||
notifications:
|
||||
email: false
|
||||
#
|
||||
@@ -41,10 +42,18 @@ before_install:
|
||||
arduino --install-boards multi4in1:avr;
|
||||
fi
|
||||
#
|
||||
- buildMulti() { BUILDCMD="arduino --verify --board $BOARD Multiprotocol/Multiprotocol.ino --pref build.path=./build/"; echo $BUILDCMD; $BUILDCMD; echo; }
|
||||
- buildProtocol() { opt_disable $ALL_PROTOCOLS; opt_enable $1; buildMulti; }
|
||||
- buildMulti() { exitcode=0; BUILDCMD="arduino --verify --board $BOARD Multiprotocol/Multiprotocol.ino --pref build.path=./build/"; echo $BUILDCMD; $BUILDCMD; if [ $? -ne 0 ]; then exitcode=1; fi; echo; return $exitcode; }
|
||||
- buildProtocol() { exitcode=0; opt_disable $ALL_PROTOCOLS; opt_enable $1; buildMulti; if [ $? -ne 0 ]; then exitcode=1; fi; return $exitcode; }
|
||||
- buildEachProtocol() { exitcode=0; for PROTOCOL in $ALL_PROTOCOLS ; do echo Building $PROTOCOL; buildProtocol $PROTOCOL; if [ $? -ne 0 ]; then exitcode=1; fi; done; return $exitcode; }
|
||||
#
|
||||
# Arduino IDE adds a lot of noise caused by network traffic; firewall it
|
||||
- sudo iptables -P INPUT DROP
|
||||
- sudo iptables -P FORWARD DROP
|
||||
- sudo iptables -P OUTPUT ACCEPT
|
||||
- sudo iptables -A INPUT -i lo -j ACCEPT
|
||||
- sudo iptables -A OUTPUT -o lo -j ACCEPT
|
||||
- sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
|
||||
#
|
||||
install: true
|
||||
before_script:
|
||||
#
|
||||
@@ -66,9 +75,9 @@ before_script:
|
||||
fi
|
||||
- echo $ALL_PROTOCOLS
|
||||
#
|
||||
# Enable CHECK_FOR_BOOTLOADER when needed
|
||||
- if [[ "$BOARD" =~ ":upload_method=TxFlashMethod" ]] || [[ "$BOARD" =~ ":bootloader=optiboot" ]]; then
|
||||
opt_enable CHECK_FOR_BOOTLOADER;
|
||||
# Disable CHECK_FOR_BOOTLOADER when not needed
|
||||
- if [[ "$BOARD" == "multi4in1:avr:multiatmega328p:bootloader=none" ]]; then
|
||||
opt_disable CHECK_FOR_BOOTLOADER;
|
||||
fi
|
||||
#
|
||||
# Trim the build down for the Atmega328p board
|
||||
@@ -103,68 +112,92 @@ before_deploy:
|
||||
# Restore the default configuration
|
||||
- cp ./_Config.h.bak Multiprotocol/_Config.h
|
||||
# Build the release files for OrangeRX
|
||||
- if [[ "$BOARD" =~ "multi4in1:avr:multixmega32d4" ]]; then
|
||||
- if [[ "$BOARD" == "multi4in1:avr:multixmega32d4" ]]; then
|
||||
opt_enable $ALL_PROTOCOLS;
|
||||
opt_disable ORANGE_TX_BLUE;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/Multi-OrangeRX_Green_INV-$TRAVIS_TAG.hex;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/multi-orangerx-green-inv-$TRAVIS_TAG.hex;
|
||||
opt_enable ORANGE_TX_BLUE;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/Multi-OrangeRX_Blue_INV-$TRAVIS_TAG.hex;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/multi-orangerx-blue-inv-$TRAVIS_TAG.hex;
|
||||
fi
|
||||
# Build the release files for AVR without bootloader
|
||||
- if [[ "$BOARD" =~ "multi4in1:avr:multiatmega328p:bootloader=none" ]]; then
|
||||
- if [[ "$BOARD" == "multi4in1:avr:multiatmega328p:bootloader=none" ]]; then
|
||||
opt_disable CHECK_FOR_BOOTLOADER;
|
||||
opt_disable $ALL_PROTOCOLS;
|
||||
opt_enable $A7105_PROTOCOLS;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/Multi-AVR_USBASP_A7105_INV-$TRAVIS_TAG.hex;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/multi-avr-usbasp-A7105-inv-$TRAVIS_TAG.hex;
|
||||
opt_disable $ALL_PROTOCOLS;
|
||||
opt_enable $CC2500_PROTOCOLS;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/Multi-AVR_USBASP_CC2500_INV-$TRAVIS_TAG.hex;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/multi-avr-usbasp-CC2500-inv-$TRAVIS_TAG.hex;
|
||||
opt_disable $ALL_PROTOCOLS;
|
||||
opt_enable $CYRF6936_PROTOCOLS;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/Multi-AVR_USBASP_CYRF6936_INV-$TRAVIS_TAG.hex;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/multi-avr-usbasp-CYRF6936-inv-$TRAVIS_TAG.hex;
|
||||
fi
|
||||
# Build the release files for AVR with bootloader
|
||||
- if [[ "$BOARD" =~ "multi4in1:avr:multiatmega328p:bootloader=optiboot" ]]; then
|
||||
- if [[ "$BOARD" == "multi4in1:avr:multiatmega328p:bootloader=optiboot" ]]; then
|
||||
opt_enable CHECK_FOR_BOOTLOADER;
|
||||
opt_disable $ALL_PROTOCOLS;
|
||||
opt_enable $A7105_PROTOCOLS;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/Multi-AVR_TXFLASH_A7105_INV-$TRAVIS_TAG.hex;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/multi-avr-txflash-A7105-inv-$TRAVIS_TAG.hex;
|
||||
opt_disable $ALL_PROTOCOLS;
|
||||
opt_enable $CC2500_PROTOCOLS;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/Multi-AVR_TXFLASH_CC2500_INV-$TRAVIS_TAG.hex;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/multi-avr-txflash-CC2500-inv-$TRAVIS_TAG.hex;
|
||||
opt_disable $ALL_PROTOCOLS;
|
||||
opt_enable $CYRF6936_PROTOCOLS;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/Multi-AVR_TXFLASH_CYRF6936_INV-$TRAVIS_TAG.hex;
|
||||
mv build/Multiprotocol.ino.hex ./binaries/multi-avr-txflash-CYRF6936-inv-$TRAVIS_TAG.hex;
|
||||
fi
|
||||
# Build the release files for STM32 without bootloader
|
||||
- if [[ "$BOARD" =~ "multi4in1:STM32F1:multistm32f103c:upload_method=serialMethod" ]]; then
|
||||
opt_disable CHECK_FOR_BOOTLOADER;
|
||||
opt_enable $ALL_PROTOCOLS;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.bin ./binaries/Multi-STM_FTDI_INV-$TRAVIS_TAG.bin;
|
||||
opt_disable MULTI_STATUS;
|
||||
opt_enable MULTI_TELEMETRY;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.bin ./binaries/Multi-STM_FTDI_INV_OPENTX-$TRAVIS_TAG.bin;
|
||||
fi
|
||||
# Build the release files for STM32 with bootloader
|
||||
- if [[ "$BOARD" =~ "multi4in1:STM32F1:multistm32f103c:upload_method=TxFlashMethod" ]]; then
|
||||
# Build the release files for STM32 without debug
|
||||
- if [[ "$BOARD" == "multi4in1:STM32F1:multistm32f103c:debug_option=none" ]]; then
|
||||
opt_enable CHECK_FOR_BOOTLOADER;
|
||||
opt_enable $ALL_PROTOCOLS;
|
||||
opt_enable MULTI_STATUS;
|
||||
opt_disable MULTI_TELEMETRY;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.bin ./binaries/Multi-STM_TXFLASH_INV-$TRAVIS_TAG.bin;
|
||||
mv build/Multiprotocol.ino.bin ./binaries/multi-stm-erskytx-inv-$TRAVIS_TAG.bin;
|
||||
opt_disable INVERT_TELEMETRY;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.bin ./binaries/multi-stm-erskytx-noinv-$TRAVIS_TAG.bin;
|
||||
opt_disable MULTI_STATUS;
|
||||
opt_enable MULTI_TELEMETRY;
|
||||
opt_enable INVERT_TELEMETRY;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.bin ./binaries/multi-stm-opentx-inv-$TRAVIS_TAG.bin;
|
||||
opt_disable INVERT_TELEMETRY;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.bin ./binaries/multi-stm-opentx-noinv-$TRAVIS_TAG.bin;
|
||||
fi
|
||||
# Build the release files for STM32 with Native USB debugging
|
||||
- if [[ "$BOARD" == "multi4in1:STM32F1:multistm32f103c:debug_option=native" ]]; then
|
||||
opt_enable CHECK_FOR_BOOTLOADER;
|
||||
opt_enable $ALL_PROTOCOLS;
|
||||
opt_enable MULTI_STATUS;
|
||||
opt_disable MULTI_TELEMETRY;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.bin ./binaries/multi-stm-erskytx-inv-usbdebug-$TRAVIS_TAG.bin;
|
||||
opt_disable MULTI_STATUS;
|
||||
opt_enable MULTI_TELEMETRY;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.bin ./binaries/Multi-STM_TXFLASH_INV_OPENTX-$TRAVIS_TAG.bin;
|
||||
mv build/Multiprotocol.ino.bin ./binaries/multi-stm-opentx-inv-usbdebug-$TRAVIS_TAG.bin;
|
||||
fi
|
||||
# Build the release files for STM32 with FTDI USB debugging
|
||||
- if [[ "$BOARD" == "multi4in1:STM32F1:multistm32f103c:debug_option=ftdi" ]]; then
|
||||
opt_enable CHECK_FOR_BOOTLOADER;
|
||||
opt_enable $ALL_PROTOCOLS;
|
||||
opt_enable MULTI_STATUS;
|
||||
opt_disable MULTI_TELEMETRY;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.bin ./binaries/multi-stm-erskytx-inv-ftdidebug-$TRAVIS_TAG.bin;
|
||||
opt_disable MULTI_STATUS;
|
||||
opt_enable MULTI_TELEMETRY;
|
||||
buildMulti;
|
||||
mv build/Multiprotocol.ino.bin ./binaries/multi-stm-opentx-inv-ftdidebug-$TRAVIS_TAG.bin;
|
||||
fi
|
||||
deploy:
|
||||
provider: releases
|
||||
|
||||
@@ -116,6 +116,42 @@
|
||||
],
|
||||
"toolsDependencies": []
|
||||
},
|
||||
{
|
||||
"name": "Multi 4-in-1 AVR Boards",
|
||||
"architecture": "avr",
|
||||
"version": "1.0.8",
|
||||
"category": "Contributed",
|
||||
"help": {
|
||||
"online": "https://github.com/pascallanger/DIY-Multiprotocol-TX-Module"
|
||||
},
|
||||
"url": "https://github.com/pascallanger/DIY-Multiprotocol-TX-Module-Boards/raw/master/archives/package_multi_4in1_avr_board_v1.0.8.tar.gz",
|
||||
"archiveFileName": "package_multi_4in1_avr_board_v1.0.8.tar.gz",
|
||||
"checksum": "SHA-256:8e58b8733220d56155e10bf5bec0bfe6bf96f8460b3fd49a4b45c7f9fad776cb",
|
||||
"size": "293388",
|
||||
"boards": [
|
||||
{"name": "Multi 4-in-1 (Atmega328p, 3.3V, 16MHz)"},
|
||||
{"name": "Multi 4-in-1 (OrangeRX)"}
|
||||
],
|
||||
"toolsDependencies": []
|
||||
},
|
||||
{
|
||||
"name": "Multi 4-in-1 AVR Boards",
|
||||
"architecture": "avr",
|
||||
"version": "1.0.9",
|
||||
"category": "Contributed",
|
||||
"help": {
|
||||
"online": "https://github.com/pascallanger/DIY-Multiprotocol-TX-Module"
|
||||
},
|
||||
"url": "https://github.com/pascallanger/DIY-Multiprotocol-TX-Module-Boards/raw/master/archives/package_multi_4in1_avr_board_v1.0.9.tar.gz",
|
||||
"archiveFileName": "package_multi_4in1_avr_board_v1.0.9.tar.gz",
|
||||
"checksum": "SHA-256:269c4ddcb8018be2b31f5c9e9f0814d120af492e894b8d5098a814486d56faa5",
|
||||
"size": "318437",
|
||||
"boards": [
|
||||
{"name": "Multi 4-in-1 (Atmega328p, 3.3V, 16MHz)"},
|
||||
{"name": "Multi 4-in-1 (OrangeRX)"}
|
||||
],
|
||||
"toolsDependencies": []
|
||||
},
|
||||
{
|
||||
"name": "Multi 4-in-1 STM32 Board",
|
||||
"architecture": "STM32F1",
|
||||
@@ -410,6 +446,48 @@
|
||||
"version": "4.8.3-2014q1"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"name": "Multi 4-in-1 STM32 Board",
|
||||
"architecture": "STM32F1",
|
||||
"version": "1.1.5",
|
||||
"category": "Contributed",
|
||||
"help": {
|
||||
"online": "https://github.com/pascallanger/DIY-Multiprotocol-TX-Module"
|
||||
},
|
||||
"url": "https://github.com/pascallanger/DIY-Multiprotocol-TX-Module-Boards/raw/master/archives/package_multi_4in1_stm32_board_v1.1.5.tar.gz",
|
||||
"archiveFileName": "package_multi_4in1_stm32_board_v1.1.5.tar.gz",
|
||||
"checksum": "SHA-256:2d45c95f59b4fb9fc7f7bf8caca2dd8c13b4258141c20db6169e0c7faf72e5e4",
|
||||
"size": "7930904",
|
||||
"boards": [{
|
||||
"name": "Multi 4-in-1 (STM32F103C)"
|
||||
}],
|
||||
"toolsDependencies": [{
|
||||
"packager": "arduino",
|
||||
"name": "arm-none-eabi-gcc",
|
||||
"version": "4.8.3-2014q1"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"name": "Multi 4-in-1 STM32 Board",
|
||||
"architecture": "STM32F1",
|
||||
"version": "1.1.6",
|
||||
"category": "Contributed",
|
||||
"help": {
|
||||
"online": "https://github.com/pascallanger/DIY-Multiprotocol-TX-Module"
|
||||
},
|
||||
"url": "https://github.com/pascallanger/DIY-Multiprotocol-TX-Module-Boards/raw/master/archives/package_multi_4in1_stm32_board_v1.1.6.tar.gz",
|
||||
"archiveFileName": "package_multi_4in1_stm32_board_v1.1.6.tar.gz",
|
||||
"checksum": "SHA-256:d2d1ef721bbcdc3c680c6f98b4b8ab394478ac0f82d67af2f6c389a4a30789f4",
|
||||
"size": "7962942",
|
||||
"boards": [{
|
||||
"name": "Multi 4-in-1 (STM32F103C)"
|
||||
}],
|
||||
"toolsDependencies": [{
|
||||
"packager": "arduino",
|
||||
"name": "arm-none-eabi-gcc",
|
||||
"version": "4.8.3-2014q1"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"name": "Multi 4-in-1 OrangeRX Board - DEPRECATED, USE MULTI 4-IN-1 AVR BOARDS PACKAGE INSTEAD",
|
||||
"architecture": "orangerx",
|
||||
|
||||
@@ -183,8 +183,8 @@ void A7105_AdjustLOBaseFreq(uint8_t cmd)
|
||||
#endif
|
||||
break;
|
||||
case PROTO_BUGS:
|
||||
#ifdef FORCE_HUBSAN_TUNING
|
||||
offset=(int16_t)FORCE_HUBSAN_TUNING;
|
||||
#ifdef FORCE_BUGS_TUNING
|
||||
offset=(int16_t)FORCE_BUGS_TUNING;
|
||||
#endif
|
||||
break;
|
||||
case PROTO_FLYSKY:
|
||||
@@ -192,6 +192,11 @@ void A7105_AdjustLOBaseFreq(uint8_t cmd)
|
||||
offset=(int16_t)FORCE_FLYSKY_TUNING;
|
||||
#endif
|
||||
break;
|
||||
case PROTO_FLYZONE:
|
||||
#ifdef FORCE_FLYZONE_TUNING
|
||||
offset=(int16_t)FORCE_FLYZONE_TUNING;
|
||||
#endif
|
||||
break;
|
||||
case PROTO_AFHDS2A:
|
||||
#ifdef FORCE_AFHDS2A_TUNING
|
||||
offset=(int16_t)FORCE_AFHDS2A_TUNING;
|
||||
@@ -247,22 +252,6 @@ static void __attribute__((unused)) A7105_SetVCOBand(uint8_t vb1, uint8_t vb2)
|
||||
A7105_WriteReg(A7105_25_VCO_SBCAL_I, vb2 | 0x08);
|
||||
}
|
||||
|
||||
#ifdef HUBSAN_A7105_INO
|
||||
const uint8_t PROGMEM HUBSAN_A7105_regs[] = {
|
||||
0xFF, 0x63, 0xFF, 0x0F, 0xFF, 0xFF, 0xFF ,0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0x04, 0xFF, // 00 - 0f
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x2B, 0xFF, 0xFF, 0x62, 0x80, 0xFF, 0xFF, 0x0A, 0xFF, 0xFF, 0x07, // 10 - 1f
|
||||
0x17, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 20 - 2f
|
||||
0xFF, 0xFF // 30 - 31
|
||||
};
|
||||
#endif
|
||||
#ifdef FLYSKY_A7105_INO
|
||||
const uint8_t PROGMEM FLYSKY_A7105_regs[] = {
|
||||
0xff, 0x42, 0x00, 0x14, 0x00, 0xff, 0xff ,0x00, 0x00, 0x00, 0x00, 0x01, 0x21, 0x05, 0x00, 0x50, // 00 - 0f
|
||||
0x9e, 0x4b, 0x00, 0x02, 0x16, 0x2b, 0x12, 0x00, 0x62, 0x80, 0x80, 0x00, 0x0a, 0x32, 0xc3, 0x0f, // 10 - 1f
|
||||
0x13, 0xc3, 0x00, 0xff, 0x00, 0x00, 0x3b, 0x00, 0x17, 0x47, 0x80, 0x03, 0x01, 0x45, 0x18, 0x00, // 20 - 2f
|
||||
0x01, 0x0f // 30 - 31
|
||||
};
|
||||
#endif
|
||||
#ifdef AFHDS2A_A7105_INO
|
||||
const uint8_t PROGMEM AFHDS2A_A7105_regs[] = {
|
||||
0xFF, 0x42 | (1<<5), 0x00, 0x25, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3c, 0x05, 0x00, 0x50, // 00 - 0f
|
||||
@@ -279,6 +268,30 @@ const uint8_t PROGMEM BUGS_A7105_regs[] = {
|
||||
0x01, 0x0f // 30 - 31
|
||||
};
|
||||
#endif
|
||||
#ifdef FLYSKY_A7105_INO
|
||||
const uint8_t PROGMEM FLYSKY_A7105_regs[] = {
|
||||
0xff, 0x42, 0x00, 0x14, 0x00, 0xff, 0xff ,0x00, 0x00, 0x00, 0x00, 0x01, 0x21, 0x05, 0x00, 0x50, // 00 - 0f
|
||||
0x9e, 0x4b, 0x00, 0x02, 0x16, 0x2b, 0x12, 0x00, 0x62, 0x80, 0x80, 0x00, 0x0a, 0x32, 0xc3, 0x0f, // 10 - 1f
|
||||
0x13, 0xc3, 0x00, 0xff, 0x00, 0x00, 0x3b, 0x00, 0x17, 0x47, 0x80, 0x03, 0x01, 0x45, 0x18, 0x00, // 20 - 2f
|
||||
0x01, 0x0f // 30 - 31
|
||||
};
|
||||
#endif
|
||||
#ifdef FLYZONE_A7105_INO
|
||||
const uint8_t PROGMEM FLYZONE_A7105_regs[] = {
|
||||
0xff, 0x42, 0x00, 0x07, 0x00, 0xff, 0xff ,0x00, 0x00, 0x00, 0x00, 0x01, 0x21, 0x05, 0x01, 0x50, // 00 - 0f
|
||||
0x9e, 0x4b, 0x00, 0x02, 0x16, 0x2b, 0x12, 0x00, 0x62, 0x80, 0x80, 0x00, 0x0a, 0x32, 0xc3, 0x1f, // 10 - 1f
|
||||
0x12, 0x00, 0x00, 0xff, 0x00, 0x00, 0x3a, 0x00, 0x3f, 0x47, 0x80, 0x03, 0x01, 0x45, 0x18, 0x00, // 20 - 2f
|
||||
0x01, 0x0f // 30 - 31
|
||||
};
|
||||
#endif
|
||||
#ifdef HUBSAN_A7105_INO
|
||||
const uint8_t PROGMEM HUBSAN_A7105_regs[] = {
|
||||
0xFF, 0x63, 0xFF, 0x0F, 0xFF, 0xFF, 0xFF ,0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0x04, 0xFF, // 00 - 0f
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x2B, 0xFF, 0xFF, 0x62, 0x80, 0xFF, 0xFF, 0x0A, 0xFF, 0xFF, 0x07, // 10 - 1f
|
||||
0x17, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 20 - 2f
|
||||
0xFF, 0xFF // 30 - 31
|
||||
};
|
||||
#endif
|
||||
|
||||
#define ID_NORMAL 0x55201041
|
||||
#define ID_PLUS 0xAA201041
|
||||
@@ -287,6 +300,14 @@ void A7105_Init(void)
|
||||
uint8_t *A7105_Regs=0;
|
||||
uint8_t vco_calibration0, vco_calibration1;
|
||||
|
||||
#ifdef FLYZONE_A7105_INO
|
||||
if(protocol==PROTO_FLYZONE)
|
||||
{
|
||||
A7105_Regs=(uint8_t*)FLYZONE_A7105_regs;
|
||||
A7105_WriteID(0x25A53C45);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef BUGS_A7105_INO
|
||||
if(protocol==PROTO_BUGS)
|
||||
A7105_Regs=(uint8_t*)BUGS_A7105_regs;
|
||||
@@ -360,7 +381,21 @@ void A7105_Init(void)
|
||||
A7105_SetVCOBand(vco_calibration0 & 0x07, vco_calibration1 & 0x07); // Set calibration band value to best match
|
||||
else
|
||||
if(protocol!=PROTO_HUBSAN)
|
||||
A7105_WriteReg(A7105_25_VCO_SBCAL_I,protocol==PROTO_FLYSKY?0x08:0x0A); //Reset VCO Band calibration
|
||||
{
|
||||
switch(protocol)
|
||||
{
|
||||
case PROTO_FLYSKY:
|
||||
vco_calibration1=0x08;
|
||||
break;
|
||||
case PROTO_FLYZONE:
|
||||
vco_calibration1=0x02;
|
||||
break;
|
||||
default:
|
||||
vco_calibration1=0x0A;
|
||||
break;
|
||||
}
|
||||
A7105_WriteReg(A7105_25_VCO_SBCAL_I,vco_calibration1); //Reset VCO Band calibration
|
||||
}
|
||||
|
||||
A7105_SetTxRxMode(TX_EN);
|
||||
A7105_SetPower();
|
||||
|
||||
@@ -78,23 +78,26 @@ enum{
|
||||
|
||||
static void AFHDS2A_update_telemetry()
|
||||
{
|
||||
if(packet[0]==0xAA && packet[9]==0xFD)
|
||||
return; // ignore packets which contain the RX configuration: FD FF 32 00 01 00 FF FF FF 05 DC 05 DE FA FF FF FF FF FF FF FF FF FF FF FF FF FF FF
|
||||
// Read TX RSSI
|
||||
int16_t temp=256-(A7105_ReadReg(A7105_1D_RSSI_THOLD)*8)/5; // value from A7105 is between 8 for maximum signal strength to 160 or less
|
||||
if(temp<0) temp=0;
|
||||
else if(temp>255) temp=255;
|
||||
TX_RSSI=temp;
|
||||
// AA | TXID | rx_id | sensor id | sensor # | value 16 bit big endian | sensor id ......
|
||||
// max 7 sensors per packet
|
||||
// AC | TXID | rx_id | sensor id | sensor # | length | bytes | sensor id ......
|
||||
#ifdef AFHDS2A_FW_TELEMETRY
|
||||
if (option & 0x80)
|
||||
{// forward 0xAA and 0xAC telemetry to TX, skip rx and tx id to save space
|
||||
pkt[0]= TX_RSSI;
|
||||
debug("T=");
|
||||
for(int i=9;i < AFHDS2A_RXPACKET_SIZE; i++)
|
||||
debug("T(%02X)=",packet[0]);
|
||||
for(uint8_t i=9;i < AFHDS2A_RXPACKET_SIZE; i++)
|
||||
{
|
||||
pkt[i-8]=packet[i];
|
||||
debug(" %02X",packet[i]);
|
||||
}
|
||||
pkt[29]=packet[0]; // 0xAA Normal telemetry, 0xAC Extended telemetry
|
||||
telemetry_link=2;
|
||||
debugln("");
|
||||
return;
|
||||
|
||||
@@ -152,6 +152,17 @@ void CYRF_SetPower(uint8_t val)
|
||||
CYRF_WriteRegister(CYRF_03_TX_CFG,power);
|
||||
prev_power=power;
|
||||
}
|
||||
|
||||
#ifdef USE_CYRF6936_CH15_TUNING
|
||||
static uint16_t Channel15=1024;
|
||||
if(Channel15!=Channel_data[CH15])
|
||||
{ // adjust frequency
|
||||
Channel15=Channel_data[CH15]+0x155; // default value is 0x555 = 0x400 + 0x155
|
||||
CYRF_WriteRegister(CYRF_1B_TX_OFFSET_LSB, Channel15&0xFF);
|
||||
CYRF_WriteRegister(CYRF_1C_TX_OFFSET_MSB, Channel15>>8);
|
||||
Channel15-=0x155;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -70,7 +70,7 @@ uint8_t convert_channel_8b_limit_deadband(uint8_t num,uint8_t min,uint8_t mid, u
|
||||
return val;
|
||||
}
|
||||
|
||||
// Revert a channel and store it
|
||||
// Reverse a channel and store it
|
||||
void reverse_channel(uint8_t num)
|
||||
{
|
||||
uint16_t val=2048-Channel_data[num];
|
||||
@@ -163,6 +163,29 @@ uint16_t convert_channel_frsky(uint8_t num)
|
||||
/******************************/
|
||||
/** FrSky D and X routines **/
|
||||
/******************************/
|
||||
|
||||
#if defined(FRSKYX_CC2500_INO) || defined(FRSKYX_RX_CC2500_INO)
|
||||
//**CRC**
|
||||
const uint16_t PROGMEM frskyX_CRC_Short[]={
|
||||
0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
|
||||
0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7 };
|
||||
static uint16_t __attribute__((unused)) frskyX_CRCTable(uint8_t val)
|
||||
{
|
||||
uint16_t word ;
|
||||
word = pgm_read_word(&frskyX_CRC_Short[val&0x0F]) ;
|
||||
val /= 16 ;
|
||||
return word ^ (0x1081 * val) ;
|
||||
}
|
||||
uint16_t frskyX_crc_x(uint8_t *data, uint8_t len)
|
||||
{
|
||||
uint16_t crc = 0;
|
||||
for(uint8_t i=0; i < len; i++)
|
||||
crc = (crc<<8) ^ frskyX_CRCTable((uint8_t)(crc>>8) ^ *data++);
|
||||
return crc;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(FRSKYD_CC2500_INO) || defined(FRSKYX_CC2500_INO)
|
||||
enum {
|
||||
FRSKY_BIND = 0,
|
||||
|
||||
@@ -375,9 +375,13 @@ static uint8_t __attribute__((unused)) DSM_Check_RX_packet()
|
||||
|
||||
uint16_t ReadDsm()
|
||||
{
|
||||
#define DSM_CH1_CH2_DELAY 4010 // Time between write of channel 1 and channel 2
|
||||
#define DSM_WRITE_DELAY 1950 // Time after write to verify write complete
|
||||
#define DSM_READ_DELAY 600 // Time before write to check read phase, and switch channels. Was 400 but 600 seems what the 328p needs to read a packet
|
||||
#define DSM_CH1_CH2_DELAY 4010 // Time between write of channel 1 and channel 2
|
||||
#ifdef STM32_BOARD
|
||||
#define DSM_WRITE_DELAY 1500 // Time after write to verify write complete
|
||||
#else
|
||||
#define DSM_WRITE_DELAY 1950 // Time after write to verify write complete
|
||||
#endif
|
||||
#define DSM_READ_DELAY 600 // Time before write to check read phase, and switch channels. Was 400 but 600 seems what the 328p needs to read a packet
|
||||
#if defined DSM_TELEMETRY
|
||||
uint8_t rx_phase;
|
||||
uint8_t len;
|
||||
@@ -464,6 +468,7 @@ uint16_t ReadDsm()
|
||||
while ((uint8_t)((uint8_t)micros()-(uint8_t)start) < 100) // Wait max 100µs, max I've seen is 50µs
|
||||
if((CYRF_ReadRegister(CYRF_02_TX_CTRL) & 0x80) == 0x00)
|
||||
break;
|
||||
|
||||
if(phase==DSM_CH1_CHECK_A || phase==DSM_CH1_CHECK_B)
|
||||
{
|
||||
#if defined DSM_TELEMETRY
|
||||
|
||||
103
Multiprotocol/Flyzone_a7105.ino
Normal file
103
Multiprotocol/Flyzone_a7105.ino
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
This project is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Multiprotocol is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// Compatible with FZ-410 TX
|
||||
|
||||
#if defined(FLYZONE_A7105_INO)
|
||||
|
||||
#include "iface_a7105.h"
|
||||
|
||||
//#define FLYZONE_FORCEID
|
||||
|
||||
#define FLYZONE_BIND_COUNT 220 // 5 sec
|
||||
#define FLYZONE_BIND_CH 0x18 // TX, RX for bind end is 0x17
|
||||
|
||||
static void __attribute__((unused)) flyzone_build_packet()
|
||||
{
|
||||
packet[0] = 0xA5;
|
||||
packet[1] = rx_tx_addr[2];
|
||||
packet[2] = rx_tx_addr[3];
|
||||
packet[3] = convert_channel_8b(AILERON); //00..80..FF
|
||||
packet[4] = convert_channel_8b(ELEVATOR); //00..80..FF
|
||||
packet[5] = convert_channel_8b(THROTTLE); //00..FF
|
||||
packet[6] = convert_channel_8b(RUDDER); //00..80..FF
|
||||
packet[7] = 0xFF;
|
||||
}
|
||||
|
||||
uint16_t ReadFlyzone()
|
||||
{
|
||||
#ifndef FORCE_FLYZONE_TUNING
|
||||
A7105_AdjustLOBaseFreq(1);
|
||||
#endif
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
{
|
||||
packet[0] = 0x1B;
|
||||
packet[1] = rx_tx_addr[2];
|
||||
packet[2] = rx_tx_addr[3];
|
||||
A7105_WriteData(3, FLYZONE_BIND_CH);
|
||||
if (bind_counter--==0)
|
||||
BIND_DONE;
|
||||
return 22700;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(phase>19)
|
||||
{
|
||||
phase=0;
|
||||
flyzone_build_packet();
|
||||
A7105_WriteData(8, hopping_frequency[0]);
|
||||
A7105_SetPower();
|
||||
}
|
||||
else
|
||||
{
|
||||
A7105_WriteReg(A7105_0F_PLL_I, hopping_frequency[(phase&0x02)>>1]);
|
||||
A7105_Strobe(A7105_TX);
|
||||
}
|
||||
phase++;
|
||||
}
|
||||
return 1500;
|
||||
}
|
||||
|
||||
uint16_t initFlyzone()
|
||||
{
|
||||
A7105_Init();
|
||||
|
||||
hopping_frequency[0]=((random(0xfefefefe) & 0x0F)+2)<<2;
|
||||
hopping_frequency[1]=hopping_frequency[0]+0x50;
|
||||
|
||||
#ifdef FLYZONE_FORCEID
|
||||
rx_tx_addr[2]=0x35;
|
||||
rx_tx_addr[3]=0xD0;
|
||||
hopping_frequency[0]=0x18;
|
||||
hopping_frequency[1]=0x68;
|
||||
#endif
|
||||
|
||||
phase=255;
|
||||
bind_counter = FLYZONE_BIND_COUNT;
|
||||
return 2400;
|
||||
}
|
||||
#endif
|
||||
// Normal packet is 8 bytes: 0xA5 0xAF 0x59 0x84 0x7A 0x00 0x80 0xFF
|
||||
// Protocol is using AETR channel order, 1 byte per channel 00..80..FF including trim. Channels are in packet [3,4,5,6].
|
||||
// packet[0,1,2,7] values are constant in normal mode.
|
||||
// packet[0]=0xA5 -> normal mode
|
||||
// packet[1,2] ->ID
|
||||
// packet[7]=0xFF -> ???
|
||||
// Channel values are updated every 30ms which is quite slow, slower than PPM...
|
||||
// Packets are sent every 1500µs on 2 different channels. 2 times on first channel, 2 times on second channel and restart. The channels are changing between the files 0x08, 0x58 and 0x18, 0x68.
|
||||
//
|
||||
// Bind is sending 3 bytes on channel 0x18: 0x1B 0x35 0xD0 every 22.7ms
|
||||
// packet[0]=0x1B -> bind mode
|
||||
// packet[1,2] ->ID
|
||||
// It listens for the model on channel 0x17 and recieves 0x1B 0x35 0xD0 when the plane accepts bind.
|
||||
301
Multiprotocol/FrSkyX_Rx_cc2500.ino
Normal file
301
Multiprotocol/FrSkyX_Rx_cc2500.ino
Normal file
@@ -0,0 +1,301 @@
|
||||
/*
|
||||
This project is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Multiprotocol is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(FRSKYX_RX_CC2500_INO)
|
||||
|
||||
#include "iface_cc2500.h"
|
||||
|
||||
#define FRSKYX_FCC_LENGTH 30+2
|
||||
#define FRSKYX_LBT_LENGTH 33+2
|
||||
|
||||
enum {
|
||||
FRSKYX_RX_BIND,
|
||||
FRSKYX_RX_DATA,
|
||||
};
|
||||
|
||||
static uint8_t frskyx_rx_chanskip;
|
||||
static uint8_t frskyx_rx_disable_lna;
|
||||
static uint8_t frskyx_rx_data_started;
|
||||
|
||||
static void __attribute__((unused)) FrSkyX_Rx_initialise() {
|
||||
CC2500_Reset();
|
||||
|
||||
CC2500_WriteReg(CC2500_02_IOCFG0, 0x01);
|
||||
CC2500_WriteReg(CC2500_18_MCSM0, 0x18);
|
||||
CC2500_WriteReg(CC2500_07_PKTCTRL1, 0x04);
|
||||
CC2500_WriteReg(CC2500_3E_PATABLE, 0xFF);
|
||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, option); // Frequency offset hack
|
||||
CC2500_WriteReg(CC2500_0D_FREQ2, 0x5C);
|
||||
CC2500_WriteReg(CC2500_13_MDMCFG1, 0x23);
|
||||
CC2500_WriteReg(CC2500_14_MDMCFG0, 0x7A);
|
||||
CC2500_WriteReg(CC2500_19_FOCCFG, 0x16);
|
||||
CC2500_WriteReg(CC2500_1A_BSCFG, 0x6C);
|
||||
CC2500_WriteReg(CC2500_1B_AGCCTRL2, 0x03);
|
||||
CC2500_WriteReg(CC2500_1C_AGCCTRL1, 0x40);
|
||||
CC2500_WriteReg(CC2500_1D_AGCCTRL0, 0x91);
|
||||
CC2500_WriteReg(CC2500_21_FREND1, 0x56);
|
||||
CC2500_WriteReg(CC2500_22_FREND0, 0x10);
|
||||
CC2500_WriteReg(CC2500_23_FSCAL3, 0xA9);
|
||||
CC2500_WriteReg(CC2500_24_FSCAL2, 0x0A);
|
||||
CC2500_WriteReg(CC2500_25_FSCAL1, 0x00);
|
||||
CC2500_WriteReg(CC2500_26_FSCAL0, 0x11);
|
||||
CC2500_WriteReg(CC2500_29_FSTEST, 0x59);
|
||||
CC2500_WriteReg(CC2500_2C_TEST2, 0x88);
|
||||
CC2500_WriteReg(CC2500_2D_TEST1, 0x31);
|
||||
CC2500_WriteReg(CC2500_2E_TEST0, 0x0B);
|
||||
CC2500_WriteReg(CC2500_03_FIFOTHR, 0x07);
|
||||
CC2500_WriteReg(CC2500_09_ADDR, 0x00);
|
||||
|
||||
switch (sub_protocol) {
|
||||
case FRSKYX_FCC:
|
||||
CC2500_WriteReg(CC2500_17_MCSM1, 0x0C);
|
||||
CC2500_WriteReg(CC2500_0E_FREQ1, 0x76);
|
||||
CC2500_WriteReg(CC2500_0F_FREQ0, 0x27);
|
||||
CC2500_WriteReg(CC2500_06_PKTLEN, 0x1E);
|
||||
CC2500_WriteReg(CC2500_08_PKTCTRL0, 0x01);
|
||||
CC2500_WriteReg(CC2500_0B_FSCTRL1, 0x0A);
|
||||
CC2500_WriteReg(CC2500_10_MDMCFG4, 0x7B);
|
||||
CC2500_WriteReg(CC2500_11_MDMCFG3, 0x61);
|
||||
CC2500_WriteReg(CC2500_12_MDMCFG2, 0x13);
|
||||
CC2500_WriteReg(CC2500_15_DEVIATN, 0x51);
|
||||
break;
|
||||
case FRSKYX_LBT:
|
||||
CC2500_WriteReg(CC2500_17_MCSM1, 0x0E);
|
||||
CC2500_WriteReg(CC2500_0E_FREQ1, 0x80);
|
||||
CC2500_WriteReg(CC2500_0F_FREQ0, 0x00);
|
||||
CC2500_WriteReg(CC2500_06_PKTLEN, 0x23);
|
||||
CC2500_WriteReg(CC2500_08_PKTCTRL0, 0x01);
|
||||
CC2500_WriteReg(CC2500_0B_FSCTRL1, 0x08);
|
||||
CC2500_WriteReg(CC2500_10_MDMCFG4, 0x7B);
|
||||
CC2500_WriteReg(CC2500_11_MDMCFG3, 0xF8);
|
||||
CC2500_WriteReg(CC2500_12_MDMCFG2, 0x03);
|
||||
CC2500_WriteReg(CC2500_15_DEVIATN, 0x53);
|
||||
break;
|
||||
}
|
||||
|
||||
frskyx_rx_disable_lna = IS_POWER_FLAG_on;
|
||||
CC2500_SetTxRxMode(frskyx_rx_disable_lna ? TXRX_OFF : RX_EN); // lna disable / enable
|
||||
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
CC2500_Strobe(CC2500_SFRX);
|
||||
CC2500_Strobe(CC2500_SRX);
|
||||
CC2500_WriteReg(CC2500_0A_CHANNR, 0); // bind channel
|
||||
delayMicroseconds(1000); // wait for RX to activate
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) frskyx_rx_set_channel(uint8_t channel)
|
||||
{
|
||||
CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency[channel]);
|
||||
CC2500_WriteReg(CC2500_25_FSCAL1, calData[channel]);
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
CC2500_Strobe(CC2500_SFRX);
|
||||
CC2500_Strobe(CC2500_SRX);
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) frskyx_rx_calibrate()
|
||||
{
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
CC2500_Strobe(CC2500_SFRX);
|
||||
CC2500_Strobe(CC2500_SRX);
|
||||
for (unsigned c = 0; c < 47; c++)
|
||||
{
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency[c]);
|
||||
CC2500_Strobe(CC2500_SCAL);
|
||||
delayMicroseconds(900);
|
||||
calData[c] = CC2500_ReadReg(CC2500_25_FSCAL1);
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t __attribute__((unused)) frskyx_rx_check_crc()
|
||||
{
|
||||
uint8_t limit = packet_length - 4;
|
||||
uint16_t lcrc = frskyX_crc_x(&packet[3], limit - 3); // computed crc
|
||||
uint16_t rcrc = (packet[limit] << 8) | (packet[limit + 1] & 0xff); // received crc
|
||||
return lcrc == rcrc;
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) frskyx_rx_build_telemetry_packet()
|
||||
{
|
||||
static uint16_t frskyx_rx_rc_chan[16];
|
||||
uint16_t pxx_channel[8];
|
||||
uint32_t bits = 0;
|
||||
uint8_t bitsavailable = 0;
|
||||
uint8_t idx = 0;
|
||||
|
||||
// decode PXX channels
|
||||
pxx_channel[0] = ((packet[10] << 8) & 0xF00) | packet[9];
|
||||
pxx_channel[1] = ((packet[11] << 4) & 0xFF0) | (packet[10] >> 4);
|
||||
pxx_channel[2] = ((packet[13] << 8) & 0xF00) | packet[12];
|
||||
pxx_channel[3] = ((packet[14] << 4) & 0xFF0) | (packet[13] >> 4);
|
||||
pxx_channel[4] = ((packet[16] << 8) & 0xF00) | packet[15];
|
||||
pxx_channel[5] = ((packet[17] << 4) & 0xFF0) | (packet[16] >> 4);
|
||||
pxx_channel[6] = ((packet[19] << 8) & 0xF00) | packet[18];
|
||||
pxx_channel[7] = ((packet[20] << 4) & 0xFF0) | (packet[19] >> 4);
|
||||
for (unsigned i = 0; i < 8; i++) {
|
||||
uint8_t shifted = (pxx_channel[i] & 0x800)>0;
|
||||
uint16_t channel_value = pxx_channel[i] & 0x7FF;
|
||||
if (channel_value < 64)
|
||||
frskyx_rx_rc_chan[shifted ? i + 8 : i] = 0;
|
||||
else
|
||||
frskyx_rx_rc_chan[shifted ? i + 8 : i] = min(((channel_value - 64) << 4) / 15, 2047);
|
||||
}
|
||||
|
||||
// buid telemetry packet
|
||||
pkt[idx++] = RX_LQI;
|
||||
pkt[idx++] = RX_RSSI;
|
||||
pkt[idx++] = 0; // start channel
|
||||
pkt[idx++] = 16; // number of channels in packet
|
||||
|
||||
// pack channels
|
||||
for (int i = 0; i < 16; i++) {
|
||||
bits |= frskyx_rx_rc_chan[i] << bitsavailable;
|
||||
bitsavailable += 11;
|
||||
while (bitsavailable >= 8) {
|
||||
pkt[idx++] = bits & 0xff;
|
||||
bits >>= 8;
|
||||
bitsavailable -= 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t initFrSkyX_Rx()
|
||||
{
|
||||
FrSkyX_Rx_initialise();
|
||||
state = 0;
|
||||
frskyx_rx_chanskip = 1;
|
||||
hopping_frequency_no = 0;
|
||||
frskyx_rx_data_started = 0;
|
||||
telemetry_link = 0;
|
||||
if (IS_BIND_IN_PROGRESS) {
|
||||
phase = FRSKYX_RX_BIND;
|
||||
}
|
||||
else {
|
||||
uint16_t temp = FRSKYX_RX_EEPROM_OFFSET;
|
||||
rx_tx_addr[0] = eeprom_read_byte(temp++);
|
||||
rx_tx_addr[1] = eeprom_read_byte(temp++);
|
||||
rx_tx_addr[2] = eeprom_read_byte(temp++);
|
||||
for(uint8_t ch = 0; ch < 47; ch++)
|
||||
hopping_frequency[ch] = eeprom_read_byte(temp++);
|
||||
frskyx_rx_calibrate();
|
||||
CC2500_WriteReg(CC2500_18_MCSM0, 0x08); // FS_AUTOCAL = manual
|
||||
CC2500_WriteReg(CC2500_09_ADDR, rx_tx_addr[0]); // set address
|
||||
CC2500_WriteReg(CC2500_07_PKTCTRL1, 0x05); // check address
|
||||
frskyx_rx_set_channel(hopping_frequency_no);
|
||||
phase = FRSKYX_RX_DATA;
|
||||
}
|
||||
packet_length = (sub_protocol == FRSKYX_LBT) ? FRSKYX_LBT_LENGTH : FRSKYX_FCC_LENGTH;
|
||||
return 1000;
|
||||
}
|
||||
|
||||
uint16_t FrSkyX_Rx_callback()
|
||||
{
|
||||
static uint32_t pps_timer=0;
|
||||
static uint8_t pps_counter=0;
|
||||
static int8_t read_retry = 0;
|
||||
uint8_t len, ch;
|
||||
if (prev_option != option)
|
||||
{
|
||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, option); // Frequency offset hack
|
||||
prev_option = option;
|
||||
}
|
||||
if (frskyx_rx_disable_lna != IS_POWER_FLAG_on) {
|
||||
frskyx_rx_disable_lna = IS_POWER_FLAG_on;
|
||||
CC2500_SetTxRxMode(frskyx_rx_disable_lna ? TXRX_OFF : RX_EN);
|
||||
}
|
||||
switch(phase) {
|
||||
case FRSKYX_RX_BIND:
|
||||
len = CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F;
|
||||
if(len >= packet_length) {
|
||||
CC2500_ReadData(packet, packet_length);
|
||||
if (frskyx_rx_check_crc()) {
|
||||
if (packet[5] <= 0x2D) {
|
||||
for (ch = 0; ch < 5; ch++)
|
||||
hopping_frequency[packet[5]+ch] = packet[6+ch];
|
||||
state |= 1 << (packet[5] / 5);
|
||||
}
|
||||
}
|
||||
if (state == 0x3ff) {
|
||||
debugln("bind complete");
|
||||
frskyx_rx_calibrate();
|
||||
rx_tx_addr[0] = packet[3]; // TXID
|
||||
rx_tx_addr[1] = packet[4]; // TXID
|
||||
rx_tx_addr[2] = packet[12]; // RX #
|
||||
CC2500_WriteReg(CC2500_18_MCSM0, 0x08); // FS_AUTOCAL = manual
|
||||
CC2500_WriteReg(CC2500_09_ADDR, rx_tx_addr[0]); // set address
|
||||
CC2500_WriteReg(CC2500_07_PKTCTRL1, 0x05); // check address
|
||||
phase = FRSKYX_RX_DATA;
|
||||
frskyx_rx_set_channel(hopping_frequency_no);
|
||||
// store txid and channel list
|
||||
uint16_t temp = FRSKYX_RX_EEPROM_OFFSET;
|
||||
eeprom_write_byte((EE_ADDR)temp++, rx_tx_addr[0]);
|
||||
eeprom_write_byte((EE_ADDR)temp++, rx_tx_addr[1]);
|
||||
eeprom_write_byte((EE_ADDR)temp++, rx_tx_addr[2]);
|
||||
for (ch = 0; ch < 47; ch++)
|
||||
eeprom_write_byte((EE_ADDR)temp++, hopping_frequency[ch]);
|
||||
BIND_DONE;
|
||||
}
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
CC2500_Strobe(CC2500_SFRX);
|
||||
CC2500_Strobe(CC2500_SRX);
|
||||
}
|
||||
return 1000;
|
||||
case FRSKYX_RX_DATA:
|
||||
len = CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F;
|
||||
if (len >= packet_length) {
|
||||
CC2500_ReadData(packet, packet_length);
|
||||
if (packet[1] == rx_tx_addr[0] && packet[2] == rx_tx_addr[1] && packet[6] == rx_tx_addr[2] && frskyx_rx_check_crc()) {
|
||||
RX_RSSI = packet[packet_length-2];
|
||||
if(RX_RSSI >= 128)
|
||||
RX_RSSI -= 128;
|
||||
else
|
||||
RX_RSSI += 128;
|
||||
// hop to next channel
|
||||
frskyx_rx_chanskip = ((packet[4] & 0xC0) >> 6) | ((packet[5] & 0x3F) << 2);
|
||||
hopping_frequency_no = (hopping_frequency_no + frskyx_rx_chanskip) % 47;
|
||||
frskyx_rx_set_channel(hopping_frequency_no);
|
||||
if(packet[7] == 0 && telemetry_link == 0) { // standard packet, send channels to TX
|
||||
frskyx_rx_build_telemetry_packet();
|
||||
telemetry_link = 1;
|
||||
}
|
||||
frskyx_rx_data_started = 1;
|
||||
read_retry = 0;
|
||||
pps_counter++;
|
||||
}
|
||||
}
|
||||
|
||||
// packets per second
|
||||
if (millis() - pps_timer >= 1000) {
|
||||
pps_timer = millis();
|
||||
debugln("%ld pps", pps_counter);
|
||||
RX_LQI = pps_counter;
|
||||
pps_counter = 0;
|
||||
}
|
||||
|
||||
// skip channel if no packet received in time
|
||||
if (read_retry++ >= 9) {
|
||||
hopping_frequency_no = (hopping_frequency_no + frskyx_rx_chanskip) % 47;
|
||||
frskyx_rx_set_channel(hopping_frequency_no);
|
||||
if(frskyx_rx_data_started)
|
||||
read_retry = 0;
|
||||
else
|
||||
read_retry = -50; // retry longer until first packet is catched
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 1000;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -55,25 +55,6 @@ static void __attribute__((unused)) frskyX_initialize_data(uint8_t adr)
|
||||
CC2500_WriteReg(CC2500_07_PKTCTRL1,0x05);
|
||||
}
|
||||
|
||||
//**CRC**
|
||||
const uint16_t PROGMEM frskyX_CRC_Short[]={
|
||||
0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
|
||||
0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7 };
|
||||
static uint16_t __attribute__((unused)) frskyX_CRCTable(uint8_t val)
|
||||
{
|
||||
uint16_t word ;
|
||||
word = pgm_read_word(&frskyX_CRC_Short[val&0x0F]) ;
|
||||
val /= 16 ;
|
||||
return word ^ (0x1081 * val) ;
|
||||
}
|
||||
static uint16_t __attribute__((unused)) frskyX_crc_x(uint8_t *data, uint8_t len)
|
||||
{
|
||||
uint16_t crc = 0;
|
||||
for(uint8_t i=0; i < len; i++)
|
||||
crc = (crc<<8) ^ frskyX_CRCTable((uint8_t)(crc>>8) ^ *data++);
|
||||
return crc;
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) frskyX_build_bind_packet()
|
||||
{
|
||||
packet[0] = (sub_protocol & 2 ) ? 0x20 : 0x1D ; // LBT or FCC
|
||||
|
||||
@@ -47,7 +47,7 @@ static void __attribute__((unused)) GW008_send_packet(uint8_t bind)
|
||||
}
|
||||
else
|
||||
{
|
||||
packet[1] = 0x01 | GET_FLAG(CH5, 0x40); // flip
|
||||
packet[1] = 0x01 | GET_FLAG(CH5_SW, 0x40); // flip
|
||||
packet[2] = convert_channel_16b_limit(AILERON , 200, 0); // aileron
|
||||
packet[3] = convert_channel_16b_limit(ELEVATOR, 0, 200); // elevator
|
||||
packet[4] = convert_channel_16b_limit(RUDDER , 200, 0); // rudder
|
||||
@@ -125,7 +125,7 @@ uint16_t GW008_callback()
|
||||
NRF24L01_SetTxRxMode(TX_EN);
|
||||
GW008_send_packet(1);
|
||||
phase = GW008_BIND2;
|
||||
return 300;
|
||||
return 850; // minimum value 750 for STM32
|
||||
}
|
||||
break;
|
||||
case GW008_BIND2:
|
||||
|
||||
@@ -324,12 +324,20 @@ uint16_t ReadHITEC()
|
||||
// 0C,1C,A1,2B,00,17,00,00,00,42,44,17,00,48,8D -> 42=>temperature3 0x42-0x28=26°C,44=>temperature4 0x44-0x28=28°C
|
||||
// 0C,1C,A1,2B,00,18,00,00,00,00,00,18,00,50,92
|
||||
debug(",telem,%02x",pkt[14]&0x7F);
|
||||
#if defined(HITEC_FW_TELEMETRY) || defined(HITEC_HUB_TELEMETRY)
|
||||
TX_RSSI = pkt[13];
|
||||
if(TX_RSSI >=128)
|
||||
TX_RSSI -= 128;
|
||||
else
|
||||
TX_RSSI += 128;
|
||||
TX_LQI = pkt[14]&0x7F;
|
||||
#endif
|
||||
#if defined(HITEC_FW_TELEMETRY)
|
||||
if(sub_protocol==OPT_FW)
|
||||
{
|
||||
// 8 bytes telemetry packets => see at the end of this file how to fully decode it
|
||||
pkt[0]=pkt[13]; // TX RSSI
|
||||
pkt[1]=pkt[14]&0x7F; // TX LQI
|
||||
pkt[0]=TX_RSSI; // TX RSSI
|
||||
pkt[1]=TX_LQI; // TX LQI
|
||||
uint8_t offset=pkt[5]==0?1:0;
|
||||
for(uint8_t i=5;i < 11; i++)
|
||||
pkt[i-3]=pkt[i+offset]; // frame number followed by 5 bytes of data
|
||||
@@ -351,12 +359,6 @@ uint16_t ReadHITEC()
|
||||
v_lipo2 = (pkt[6])<<5 | (pkt[7])>>3; // calculation in float is volt=(pkt[6]<<8+pkt[7])/10
|
||||
break;
|
||||
}
|
||||
TX_RSSI = pkt[13];
|
||||
if(TX_RSSI >=128)
|
||||
TX_RSSI -= 128;
|
||||
else
|
||||
TX_RSSI += 128;
|
||||
TX_LQI = pkt[14]&0x7F;
|
||||
telemetry_link=1; // telemetry hub available
|
||||
}
|
||||
#endif
|
||||
@@ -403,7 +405,7 @@ packet[1] = TX LQI value
|
||||
packet[2] = frame number
|
||||
packet[3-7] telemetry data
|
||||
|
||||
The frame number takes the following values: 0x00, 0x11, 0x12, ..., 0x18. The frames can be present or not, they also do not have to follow each others.
|
||||
The frame number takes the following values: 0x00, 0x11, 0x12, ..., 0x1C. The frames can be present or not, they also do not have to follow each others.
|
||||
Here is a description of the telemetry data for each frame number:
|
||||
- frame 0x00
|
||||
data byte 0 -> 0x00 unknown
|
||||
@@ -414,9 +416,9 @@ data byte 4 -> RX Batt Volt_L => RX Batt=(Volt_H*256+Volt_L)/28
|
||||
- frame 0x11
|
||||
data byte 0 -> 0xAF start of frame
|
||||
data byte 1 -> 0x00 unknown
|
||||
data byte 2 -> 0x2D frame type but constant here
|
||||
data byte 3 -> Volt1_H
|
||||
data byte 4 -> Volt1_L RX Batt=(Volt1_H*256+Volt1_L)/28 V
|
||||
data byte 2 -> 0x2D station type 0x2D=standard station nitro or electric, 0xAC=advanced station
|
||||
data byte 3 -> RX Batt Volt_H
|
||||
data byte 4 -> RX Batt Volt_L => RX Batt=(Volt_H*256+Volt_L)/28
|
||||
- frame 0x12
|
||||
data byte 0 -> Lat_sec_H GPS : latitude second
|
||||
data byte 1 -> Lat_sec_L signed int : 1/100 of second
|
||||
@@ -431,9 +433,9 @@ data byte 3 -> signed int : +=Est, - = west
|
||||
data byte 4 -> Temp2 Temperature2=Temp2-40°C
|
||||
- frame 0x14
|
||||
data byte 0 -> Speed_H
|
||||
data byte 1 -> Speed_L Speed=Speed_H*256+Speed_L km/h
|
||||
data byte 1 -> Speed_L GPS Speed=Speed_H*256+Speed_L km/h
|
||||
data byte 2 -> Alti_sea_H
|
||||
data byte 3 -> Alti_sea_L Altitude sea=Alti_sea_H*256+Alti_sea_L m
|
||||
data byte 3 -> Alti_sea_L GPS Altitude=Alti_sea_H*256+Alti_sea_L m
|
||||
data byte 4 -> Temp1 Temperature1=Temp1-40°C
|
||||
- frame 0x15
|
||||
data byte 0 -> FUEL
|
||||
@@ -448,15 +450,29 @@ data byte 2 -> Date_day
|
||||
data byte 3 -> Time_hour GPS Time
|
||||
data byte 4 -> Time_min
|
||||
- frame 0x17
|
||||
data byte 0 -> 0x00 COURSEH
|
||||
data byte 1 -> 0x00 COURSEL GPS Course = COURSEH*256+COURSEL
|
||||
data byte 2 -> 0x00 GPS count
|
||||
data byte 0 -> COURSEH
|
||||
data byte 1 -> COURSEL GPS heading = COURSEH*256+COURSEL in degrees
|
||||
data byte 2 -> Count GPS satellites
|
||||
data byte 3 -> Temp3 Temperature3=Temp2-40°C
|
||||
data byte 4 -> Temp4 Temperature4=Temp3-40°C
|
||||
- frame 0x18
|
||||
data byte 1 -> Volt2_H
|
||||
data byte 2 -> Volt2_L Volt2=(Volt2_H*256+Volt2_L)/10 V
|
||||
data byte 3 -> AMP1_L
|
||||
data byte 4 -> AMP1_H Amp=(AMP1_H*256+AMP1_L -180)/14 in signed A
|
||||
data byte 1 -> Volt_H
|
||||
data byte 2 -> Volt_L Volt=(Volt_H*256+Volt_L)/10 V
|
||||
data byte 3 -> AMP_L
|
||||
data byte 4 -> AMP_H Amp=(AMP1_*256+AMP_L -180)/14 in signed A
|
||||
- frame 0x19 Servo sensor
|
||||
data byte 0 -> AMP_Servo1 Amp=AMP_Servo1/10 in A
|
||||
data byte 1 -> AMP_Servo2 Amp=AMP_Servo2/10 in A
|
||||
data byte 2 -> AMP_Servo3 Amp=AMP_Servo3/10 in A
|
||||
data byte 3 -> AMP_Servo4 Amp=AMP_Servo4/10 in A
|
||||
- frame 0x1A
|
||||
data byte 2 -> ASpeed_H Air speed=ASpeed_H*256+ASpeed_L km/h
|
||||
data byte 3 -> ASpeed_L
|
||||
- frame 0x1B Variometer sensor
|
||||
data byte 0 -> Alti1H
|
||||
data byte 1 -> Alti1L Altitude unfiltered
|
||||
data byte 2 -> Alti2H
|
||||
data byte 3 -> Alti2L Altitude filtered
|
||||
- frame 0x1C Unknown
|
||||
*/
|
||||
#endif
|
||||
@@ -40,13 +40,17 @@
|
||||
40,WFLY
|
||||
41,BUGS
|
||||
42,BUGSMINI,BUGSMINI,BUGS3H
|
||||
43,Traxxas
|
||||
43,Traxxas,RX6519
|
||||
44,NCC1701
|
||||
45,E01X,E012,E015,E016H
|
||||
46,V911S
|
||||
47,GD00X,GD_V1,GD_V2
|
||||
48,V761
|
||||
49,KF606
|
||||
50,REDPINE,FAST,SLOW
|
||||
51,POTENSIC,A20
|
||||
50,Redpine,Fast,Slow
|
||||
51,Potensic,A20
|
||||
52,ZSX,280
|
||||
53,Flyzone,FZ-410
|
||||
54,Scanner
|
||||
55,FrskyX_RX,FCC,EU_LBT
|
||||
63,XN_DUMP,250K,1M,2M
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_REVISION 1
|
||||
#define VERSION_PATCH_LEVEL 67
|
||||
#define VERSION_PATCH_LEVEL 81
|
||||
|
||||
//******************
|
||||
// Protocols
|
||||
@@ -78,6 +78,10 @@ enum PROTOCOLS
|
||||
PROTO_KF606 = 49, // =>NRF24L01
|
||||
PROTO_REDPINE = 50, // =>CC2500
|
||||
PROTO_POTENSIC = 51, // =>NRF24L01
|
||||
PROTO_ZSX = 52, // =>NRF24L01
|
||||
PROTO_FLYZONE = 53, // =>A7105
|
||||
PROTO_SCANNER = 54, // =>CC2500
|
||||
PROTO_FRSKYX_RX = 55, // =>CC2500
|
||||
PROTO_XN297DUMP = 63, // =>NRF24L01
|
||||
};
|
||||
|
||||
@@ -89,6 +93,10 @@ enum Flysky
|
||||
V912 = 3,
|
||||
CX20 = 4,
|
||||
};
|
||||
enum Flyzone
|
||||
{
|
||||
FZ410 = 0,
|
||||
};
|
||||
enum Hubsan
|
||||
{
|
||||
H107 = 0,
|
||||
@@ -277,6 +285,16 @@ enum REDPINE
|
||||
RED_FAST= 0,
|
||||
RED_SLOW= 1,
|
||||
};
|
||||
enum TRAXXAS
|
||||
{
|
||||
RX6519 = 0,
|
||||
};
|
||||
enum FRSKYX_RX
|
||||
{
|
||||
FRSKYX_FCC = 0,
|
||||
FRSKYX_LBT
|
||||
};
|
||||
|
||||
#define NONE 0
|
||||
#define P_HIGH 1
|
||||
#define P_LOW 0
|
||||
@@ -307,6 +325,9 @@ enum MultiPacketTypes
|
||||
MULTI_TELEMETRY_SYNC = 8,
|
||||
MULTI_TELEMETRY_SPORT_POLLING = 9,
|
||||
MULTI_TELEMETRY_HITEC = 10,
|
||||
MULTI_TELEMETRY_SCANNER = 11,
|
||||
MULTI_TELEMETRY_AFHDS2A_AC = 12,
|
||||
MULTI_TELEMETRY_RX_CHANNELS = 13,
|
||||
};
|
||||
|
||||
// Macros
|
||||
@@ -390,15 +411,16 @@ enum MultiPacketTypes
|
||||
//********************
|
||||
//** Debug messages **
|
||||
//********************
|
||||
#if defined(STM32_BOARD) && defined (DEBUG_SERIAL)
|
||||
#if defined(STM32_BOARD) && (defined (DEBUG_SERIAL) || defined (ARDUINO_MULTI_DEBUG))
|
||||
uint16_t debug_time=0;
|
||||
#define debug(msg, ...) {char debug_buf[64]; sprintf(debug_buf, msg, ##__VA_ARGS__); Serial.write(debug_buf);}
|
||||
#define debugln(msg, ...) {char debug_buf[64]; sprintf(debug_buf, msg "\r\n", ##__VA_ARGS__); Serial.write(debug_buf);}
|
||||
#define debug_time(msg) { uint16_t debug_time_TCNT1=TCNT1; debug_time=debug_time_TCNT1-debug_time; debug(msg "%u", debug_time>>1); debug_time=debug_time_TCNT1; }
|
||||
#define debugln_time(msg) { uint16_t debug_time_TCNT1=TCNT1; debug_time=debug_time_TCNT1-debug_time; debug(msg "%u\r\n", debug_time>>1); debug_time=debug_time_TCNT1; }
|
||||
#else
|
||||
#define debug(...) { }
|
||||
#define debugln(...) { }
|
||||
#define debug_time(...) { }
|
||||
#define debugln_time(...) { }
|
||||
#undef DEBUG_SERIAL
|
||||
#endif
|
||||
|
||||
@@ -552,6 +574,7 @@ enum {
|
||||
#define AFHDS2A_EEPROM_OFFSET 50 // RX ID, 4 bytes per model id, end is 50+64=114
|
||||
#define BUGS_EEPROM_OFFSET 114 // RX ID, 2 bytes per model id, end is 114+32=146
|
||||
#define BUGSMINI_EEPROM_OFFSET 146 // RX ID, 2 bytes per model id, end is 146+32=178
|
||||
#define FRSKYX_RX_EEPROM_OFFSET 178 // (3) TX ID + (47) channels + (1) freq_tune, 51 bytes per model, end is 178+51=229
|
||||
//#define CONFIG_EEPROM_OFFSET 210 // Current configuration of the multimodule
|
||||
|
||||
//****************************************
|
||||
@@ -622,6 +645,10 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
||||
KF606 49
|
||||
REDPINE 50
|
||||
POTENSIC 51
|
||||
ZSX 52
|
||||
FLYZONE 53
|
||||
SCANNER 54
|
||||
FRSKYX_RX 55
|
||||
BindBit=> 0x80 1=Bind/0=No
|
||||
AutoBindBit=> 0x40 1=Yes /0=No
|
||||
RangeCheck=> 0x20 1=Yes /0=No
|
||||
@@ -761,6 +788,11 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
||||
sub_protocol==REDPINE
|
||||
RED_FAST 0
|
||||
RED_SLOW 1
|
||||
sub_protocol==TRAXXAS
|
||||
RX6519 0
|
||||
sub_protocol==FRSKYX_RX
|
||||
FCC 0
|
||||
LBT 1
|
||||
|
||||
Power value => 0x80 0=High/1=Low
|
||||
Stream[3] = option_protocol;
|
||||
@@ -774,7 +806,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
||||
2047 +125%
|
||||
Values are concatenated to fit in 22 bytes like in SBUS protocol.
|
||||
Failsafe values have exactly the same range/values than normal channels except the extremes where
|
||||
0=hold, 2047=no pulse. If failsafe is not set or RX then failsafe packets should not be sent.
|
||||
0=no pulse, 2047=hold. If failsafe is not set or RX then failsafe packets should not be sent.
|
||||
*/
|
||||
/*
|
||||
Multimodule Status
|
||||
@@ -845,7 +877,6 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
||||
|
||||
*No* usual frsky byte stuffing and without start/stop byte (0x7e)
|
||||
|
||||
|
||||
Type 0x04 Spektrum telemetry data
|
||||
data[0] TX RSSI
|
||||
data[1-15] telemetry data
|
||||
@@ -856,7 +887,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
||||
technically DSM bind data is only 10 bytes but multi sends 16
|
||||
like with telemtery, check length field)
|
||||
|
||||
Type 0x06 Flysky AFHDS2 telemetry data
|
||||
Type 0x06 Flysky AFHDS2 telemetry data type 0xAA
|
||||
length: 29
|
||||
data[0] = RSSI value
|
||||
data[1-28] telemetry data
|
||||
@@ -869,4 +900,22 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
||||
data[3-7] telemetry data
|
||||
Full description at the bottom of Hitec_cc2500.ino
|
||||
|
||||
Type 0x0B Spectrum Scanner telemetry data
|
||||
length: 6
|
||||
data[0] = start channel (2400 + x*0.333 Mhz)
|
||||
data[1-5] power levels
|
||||
|
||||
Type 0x0C Flysky AFHDS2 telemetry data type 0xAC
|
||||
length: 29
|
||||
data[0] = RSSI value
|
||||
data[1-28] telemetry data
|
||||
|
||||
Type 0x0D RX channels forwarding
|
||||
length: variable
|
||||
data[0] = received packets per second
|
||||
data[1] = rssi
|
||||
data[2] = start channel
|
||||
data[3] = number of channels to follow
|
||||
data[4-]= packed channels data, 11 bit per channel
|
||||
|
||||
*/
|
||||
|
||||
@@ -114,7 +114,11 @@ uint8_t armed, arm_flags, arm_channel_previous;
|
||||
uint8_t num_ch;
|
||||
|
||||
#ifdef CC2500_INSTALLED
|
||||
uint8_t calData[50];
|
||||
#ifdef SCANNER_CC2500_INO
|
||||
uint8_t calData[255];
|
||||
#else
|
||||
uint8_t calData[50];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_FOR_BOOTLOADER
|
||||
@@ -167,7 +171,7 @@ volatile uint8_t rx_ok_buff[RXBUFFER_SIZE];
|
||||
volatile uint8_t discard_frame = 0;
|
||||
|
||||
// Telemetry
|
||||
#define MAX_PKT 29
|
||||
#define MAX_PKT 30
|
||||
uint8_t pkt[MAX_PKT];//telemetry receiving packets
|
||||
#if defined(TELEMETRY)
|
||||
#ifdef INVERT_TELEMETRY
|
||||
@@ -224,7 +228,25 @@ void setup()
|
||||
// Setup diagnostic uart before anything else
|
||||
#ifdef DEBUG_SERIAL
|
||||
Serial.begin(115200,SERIAL_8N1);
|
||||
while (!Serial); // Wait for ever for the serial port to connect...
|
||||
|
||||
// Wait up to 30s for a serial connection; double-blink the LED while we wait
|
||||
unsigned long currMillis = millis();
|
||||
unsigned long initMillis = currMillis;
|
||||
pinMode(LED_pin,OUTPUT);
|
||||
LED_off;
|
||||
while (!Serial && (currMillis - initMillis) <= 30000) {
|
||||
LED_on;
|
||||
delay(100);
|
||||
LED_off;
|
||||
delay(100);
|
||||
LED_on;
|
||||
delay(100);
|
||||
LED_off;
|
||||
delay(500);
|
||||
currMillis = millis();
|
||||
}
|
||||
|
||||
delay(50); // Brief delay for FTDI debugging
|
||||
debugln("Multiprotocol version: %d.%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_PATCH_LEVEL);
|
||||
#endif
|
||||
|
||||
@@ -398,7 +420,7 @@ void setup()
|
||||
#endif
|
||||
|
||||
// Read or create protocol id
|
||||
MProtocol_id_master=random_id(10,false);
|
||||
MProtocol_id_master=random_id(EEPROM_ID_OFFSET,false);
|
||||
|
||||
debugln("Module Id: %lx", MProtocol_id_master);
|
||||
|
||||
@@ -625,7 +647,7 @@ uint8_t Update_All()
|
||||
update_led_status();
|
||||
#if defined(TELEMETRY)
|
||||
#if ( !( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) )
|
||||
if( (protocol==PROTO_FRSKYD) || (protocol==PROTO_BAYANG) || (protocol==PROTO_NCC1701) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_FRSKYX) || (protocol==PROTO_DSM) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC))
|
||||
if( (protocol == PROTO_FRSKYX_RX) || (protocol == PROTO_SCANNER) || (protocol==PROTO_FRSKYD) || (protocol==PROTO_BAYANG) || (protocol==PROTO_NCC1701) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_FRSKYX) || (protocol==PROTO_DSM) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC))
|
||||
#endif
|
||||
TelemetryUpdate();
|
||||
#endif
|
||||
@@ -933,6 +955,13 @@ static void protocol_init()
|
||||
remote_callback = ReadBUGS;
|
||||
break;
|
||||
#endif
|
||||
#if defined(FLYZONE_A7105_INO)
|
||||
case PROTO_FLYZONE:
|
||||
PE1_off; //antenna RF1
|
||||
next_callback = initFlyzone();
|
||||
remote_callback = ReadFlyzone;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CC2500_INSTALLED
|
||||
#if defined(FRSKYD_CC2500_INO)
|
||||
@@ -991,6 +1020,22 @@ static void protocol_init()
|
||||
remote_callback = ReadHITEC;
|
||||
break;
|
||||
#endif
|
||||
#if defined(SCANNER_CC2500_INO)
|
||||
case PROTO_SCANNER:
|
||||
PE1_off;
|
||||
PE2_on; //antenna RF2
|
||||
next_callback = initScanner();
|
||||
remote_callback = Scanner_callback;
|
||||
break;
|
||||
#endif
|
||||
#if defined(FRSKYX_RX_CC2500_INO)
|
||||
case PROTO_FRSKYX_RX:
|
||||
PE1_off;
|
||||
PE2_on; //antenna RF2
|
||||
next_callback = initFrSkyX_Rx();
|
||||
remote_callback = FrSkyX_Rx_callback;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CYRF6936_INSTALLED
|
||||
#if defined(DSM_CYRF6936_INO)
|
||||
@@ -1058,6 +1103,13 @@ static void protocol_init()
|
||||
remote_callback = ReadJ6Pro;
|
||||
break;
|
||||
#endif
|
||||
#if defined(TRAXXAS_CYRF6936_INO)
|
||||
case PROTO_TRAXXAS:
|
||||
PE2_on; //antenna RF4
|
||||
next_callback = initTRAXXAS();
|
||||
remote_callback = ReadTRAXXAS;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef NRF24L01_INSTALLED
|
||||
#if defined(HISKY_NRF24L01_INO)
|
||||
@@ -1254,6 +1306,12 @@ static void protocol_init()
|
||||
remote_callback = POTENSIC_callback;
|
||||
break;
|
||||
#endif
|
||||
#if defined(ZSX_NRF24L01_INO)
|
||||
case PROTO_ZSX:
|
||||
next_callback=initZSX();
|
||||
remote_callback = ZSX_callback;
|
||||
break;
|
||||
#endif
|
||||
#if defined(XN297DUMP_NRF24L01_INO)
|
||||
case PROTO_XN297DUMP:
|
||||
next_callback=initXN297Dump();
|
||||
@@ -1415,7 +1473,7 @@ void update_serial_data()
|
||||
uint16_t temp=((*((uint32_t *)p))>>dec)&0x7FF;
|
||||
#ifdef FAILSAFE_ENABLE
|
||||
if(failsafe)
|
||||
Failsafe_data[i]=temp; //value range 0..2047, 0=no pulses, 2047=hold
|
||||
Failsafe_data[i]=temp; //value range 0..2047, 0=no pulse, 2047=hold
|
||||
else
|
||||
#endif
|
||||
Channel_data[i]=temp; //value range 0..2047, 0=-125%, 2047=+125%
|
||||
@@ -1912,3 +1970,20 @@ static uint32_t random_id(uint16_t address, uint8_t create_new)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set the flags for detecting and writing the firmware signature
|
||||
#if defined (CHECK_FOR_BOOTLOADER)
|
||||
bool firmwareFlag_CHECK_FOR_BOOTLOADER = true;
|
||||
#endif
|
||||
#if defined (MULTI_STATUS)
|
||||
bool firmwareFlag_MULTI_STATUS = true;
|
||||
#endif
|
||||
#if defined (MULTI_TELEMETRY)
|
||||
bool firmwareFlag_MULTI_TELEMETRY = true;
|
||||
#endif
|
||||
#if defined (INVERT_TELEMETRY)
|
||||
bool firmwareFlag_INVERT_TELEMETRY = true;
|
||||
#endif
|
||||
#if defined (DEBUG_SERIAL)
|
||||
bool firmwareFlag_DEBUG_SERIAL = true;
|
||||
#endif
|
||||
|
||||
@@ -286,7 +286,7 @@ const uint16_t PROGMEM xn297_crc_xorout_scrambled_enhanced[] = {
|
||||
|
||||
// unscrambled enhanced mode crc xorout table
|
||||
// unused so far
|
||||
/*
|
||||
#ifdef XN297DUMP_NRF24L01_INO
|
||||
const uint16_t xn297_crc_xorout_enhanced[] = {
|
||||
0x0000, 0x8BE6, 0xD8EC, 0xB87A, 0x42DC, 0xAA89,
|
||||
0x83AF, 0x10E4, 0xE83E, 0x5C29, 0xAC76, 0x1C69,
|
||||
@@ -294,7 +294,7 @@ const uint16_t xn297_crc_xorout_enhanced[] = {
|
||||
0x7CDB, 0x7A14, 0xD5D2, 0x57D7, 0xE31D, 0xCE42,
|
||||
0x648D, 0xBF2D, 0x653B, 0x190C, 0x9117, 0x9A97,
|
||||
0xABFC, 0xE68E, 0x0DE7, 0x28A2, 0x1965 };
|
||||
*/
|
||||
#endif
|
||||
|
||||
static uint8_t bit_reverse(uint8_t b_in)
|
||||
{
|
||||
|
||||
152
Multiprotocol/Scanner_cc2500.ino
Normal file
152
Multiprotocol/Scanner_cc2500.ino
Normal file
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
This project is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Multiprotocol is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(SCANNER_CC2500_INO)
|
||||
|
||||
#include "iface_cc2500.h"
|
||||
|
||||
#define SCAN_MAX_RADIOCHANNEL 249 // 2483 MHz
|
||||
#define SCAN_CHANNEL_LOCK_TIME 210 // with precalibration, channel requires only 90 usec for synthesizer to settle
|
||||
#define SCAN_AVERAGE_INTVL 20
|
||||
#define SCAN_MAX_COUNT 5
|
||||
#define SCAN_CHANS_PER_PACKET 5
|
||||
|
||||
static uint8_t scan_tlm_index;
|
||||
|
||||
enum ScanStates {
|
||||
SCAN_CHANNEL_CHANGE = 0,
|
||||
SCAN_GET_RSSI = 1,
|
||||
};
|
||||
|
||||
static void __attribute__((unused)) Scanner_cc2500_init()
|
||||
{
|
||||
/* Initialize CC2500 chip */
|
||||
CC2500_WriteReg(CC2500_08_PKTCTRL0, 0x12); // Packet Automation Control
|
||||
CC2500_WriteReg(CC2500_0B_FSCTRL1, 0x0A); // Frequency Synthesizer Control
|
||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, 0x00); // Frequency Synthesizer Control
|
||||
CC2500_WriteReg(CC2500_0D_FREQ2, 0x5C); // Frequency Control Word, High Byte
|
||||
CC2500_WriteReg(CC2500_0E_FREQ1, 0x4E); // Frequency Control Word, Middle Byte
|
||||
CC2500_WriteReg(CC2500_0F_FREQ0, 0xC3); // Frequency Control Word, Low Byte
|
||||
CC2500_WriteReg(CC2500_10_MDMCFG4, 0x8D); // Modem Configuration
|
||||
CC2500_WriteReg(CC2500_11_MDMCFG3, 0x3B); // Modem Configuration
|
||||
CC2500_WriteReg(CC2500_12_MDMCFG2, 0x10); // Modem Configuration
|
||||
CC2500_WriteReg(CC2500_13_MDMCFG1, 0x23); // Modem Configuration
|
||||
CC2500_WriteReg(CC2500_14_MDMCFG0, 0xA4); // Modem Configuration
|
||||
CC2500_WriteReg(CC2500_15_DEVIATN, 0x62); // Modem Deviation Setting
|
||||
CC2500_WriteReg(CC2500_18_MCSM0, 0x08); // Main Radio Control State Machine Configuration
|
||||
CC2500_WriteReg(CC2500_19_FOCCFG, 0x1D); // Frequency Offset Compensation Configuration
|
||||
CC2500_WriteReg(CC2500_1A_BSCFG, 0x1C); // Bit Synchronization Configuration
|
||||
CC2500_WriteReg(CC2500_1B_AGCCTRL2, 0xC7); // AGC Control
|
||||
CC2500_WriteReg(CC2500_1C_AGCCTRL1, 0x00); // AGC Control
|
||||
CC2500_WriteReg(CC2500_1D_AGCCTRL0, 0xB0); // AGC Control
|
||||
CC2500_WriteReg(CC2500_21_FREND1, 0xB6); // Front End RX Configuration
|
||||
|
||||
CC2500_SetTxRxMode(RX_EN); // Receive mode
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
CC2500_Strobe(CC2500_SRX);
|
||||
|
||||
delayMicroseconds(1000); // wait for RX to activate
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) Scanner_calibrate()
|
||||
{
|
||||
for (uint8_t c = 0; c < SCAN_MAX_RADIOCHANNEL; c++)
|
||||
{
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
CC2500_WriteReg(CC2500_0A_CHANNR, c);
|
||||
CC2500_Strobe(CC2500_SCAL);
|
||||
delayMicroseconds(900);
|
||||
calData[c] = CC2500_ReadReg(CC2500_25_FSCAL1);
|
||||
}
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) Scanner_scan_next()
|
||||
{
|
||||
CC2500_WriteReg(CC2500_0A_CHANNR, rf_ch_num);
|
||||
CC2500_WriteReg(CC2500_25_FSCAL1, calData[rf_ch_num]);
|
||||
CC2500_Strobe(CC2500_SFRX);
|
||||
CC2500_Strobe(CC2500_SRX);
|
||||
}
|
||||
|
||||
static int __attribute__((unused)) Scanner_scan_rssi()
|
||||
{
|
||||
uint8_t rssi;
|
||||
rssi = CC2500_ReadReg(0x40 | CC2500_34_RSSI); // 0.5 db/count, RSSI value read from the RSSI status register is a 2's complement number
|
||||
uint8_t rssi_rel;
|
||||
if (rssi >= 128) {
|
||||
rssi_rel = rssi - 128; // relative power levels 0-127 (equals -137 to -72 dBm)
|
||||
}
|
||||
else {
|
||||
rssi_rel = rssi + 128; // relativ power levels 128-255 (equals -73 to -10 dBm)
|
||||
}
|
||||
return rssi_rel;
|
||||
}
|
||||
|
||||
uint16_t Scanner_callback()
|
||||
{
|
||||
static uint8_t max_count, max_rssi;
|
||||
uint8_t rssi;
|
||||
switch (phase)
|
||||
{
|
||||
case SCAN_CHANNEL_CHANGE:
|
||||
if(telemetry_link == 0) {
|
||||
max_count = 0;
|
||||
max_rssi = 0;
|
||||
rf_ch_num++;
|
||||
if (rf_ch_num >= (SCAN_MAX_RADIOCHANNEL + 1))
|
||||
rf_ch_num = 0;
|
||||
if (scan_tlm_index++ == 0)
|
||||
pkt[0] = rf_ch_num; // start channel for telemetry packet
|
||||
Scanner_scan_next();
|
||||
phase = SCAN_GET_RSSI;
|
||||
}
|
||||
return SCAN_CHANNEL_LOCK_TIME;
|
||||
case SCAN_GET_RSSI:
|
||||
rssi = Scanner_scan_rssi();
|
||||
if(rssi >= max_rssi) {
|
||||
max_rssi = rssi;
|
||||
pkt[scan_tlm_index] = rssi;
|
||||
}
|
||||
max_count++;
|
||||
if(max_count > SCAN_MAX_COUNT) {
|
||||
phase = SCAN_CHANNEL_CHANGE;
|
||||
if (scan_tlm_index == SCAN_CHANS_PER_PACKET)
|
||||
{
|
||||
// send data to TX
|
||||
telemetry_link = 1;
|
||||
scan_tlm_index = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return SCAN_AVERAGE_INTVL;
|
||||
}
|
||||
|
||||
uint16_t initScanner(void)
|
||||
{
|
||||
rf_ch_num = SCAN_MAX_RADIOCHANNEL;
|
||||
scan_tlm_index = 0;
|
||||
telemetry_link = 0;
|
||||
phase = SCAN_CHANNEL_CHANGE;
|
||||
Scanner_cc2500_init();
|
||||
CC2500_Strobe(CC2500_SRX);
|
||||
Scanner_calibrate();
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
CC2500_SetTxRxMode(RX_EN);
|
||||
CC2500_Strobe(CC2500_SRX); // Receive mode
|
||||
return 1250;
|
||||
}
|
||||
|
||||
#endif
|
||||
235
Multiprotocol/TRAXXAS_cyrf6936.ino
Normal file
235
Multiprotocol/TRAXXAS_cyrf6936.ino
Normal file
@@ -0,0 +1,235 @@
|
||||
/*
|
||||
This project is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Multiprotocol is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Works with Traxxas 6519 receivers https://traxxas.com/sites/default/files/24CompGuide-2016.jpg .
|
||||
*/
|
||||
|
||||
#if defined(TRAXXAS_CYRF6936_INO)
|
||||
|
||||
#include "iface_cyrf6936.h"
|
||||
|
||||
//#define TRAXXAS_FORCE_ID
|
||||
|
||||
#define TRAXXAS_CHANNEL 0x05
|
||||
#define TRAXXAS_BIND_CHANNEL 0x2B
|
||||
#define TRAXXAS_PACKET_SIZE 16
|
||||
|
||||
enum {
|
||||
TRAXXAS_BIND_PREP_RX=0,
|
||||
TRAXXAS_BIND_RX,
|
||||
TRAXXAS_BIND_TX1,
|
||||
TRAXXAS_PREP_DATA,
|
||||
TRAXXAS_DATA,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM TRAXXAS_sop_bind[] ={ 0x3C, 0x37, 0xCC, 0x91, 0xE2, 0xF8, 0xCC, 0x91 };
|
||||
const uint8_t PROGMEM TRAXXAS_sop_data[] ={ 0xA1, 0x78, 0xDC, 0x3C, 0x9E, 0x82, 0xDC, 0x3C };
|
||||
//const uint8_t PROGMEM TRAXXAS_sop_check[]={ 0x97, 0xE5, 0x14, 0x72, 0x7F, 0x1A, 0x14, 0x72 };
|
||||
|
||||
const uint8_t PROGMEM TRAXXAS_init_vals[][2] = {
|
||||
//Init from dump
|
||||
{CYRF_0B_PWR_CTRL, 0x00}, // PMU
|
||||
{CYRF_32_AUTO_CAL_TIME, 0x3C}, // Default init value
|
||||
{CYRF_35_AUTOCAL_OFFSET, 0x14}, // Default init value
|
||||
{CYRF_1B_TX_OFFSET_LSB, 0x55}, // Default init value
|
||||
{CYRF_1C_TX_OFFSET_MSB, 0x05}, // Default init value
|
||||
{CYRF_28_CLK_EN, 0x02}, // Force Receive Clock Enable
|
||||
{CYRF_06_RX_CFG, 0x88 | 0x02}, // AGC enabled, Fast Turn Mode enabled, adding overwrite enable to not lockup RX
|
||||
{CYRF_1E_RX_OVERRIDE, 0x08}, // Reject packets with 0 seed
|
||||
{CYRF_03_TX_CFG, 0x08 | CYRF_BIND_POWER}, // 8DR Mode, 32 chip codes
|
||||
};
|
||||
|
||||
static void __attribute__((unused)) TRAXXAS_cyrf_bind_config()
|
||||
{
|
||||
CYRF_PROGMEM_ConfigSOPCode(TRAXXAS_sop_bind);
|
||||
CYRF_WriteRegister(CYRF_15_CRC_SEED_LSB, 0x5A);
|
||||
CYRF_WriteRegister(CYRF_16_CRC_SEED_MSB, 0x5A);
|
||||
CYRF_ConfigRFChannel(TRAXXAS_BIND_CHANNEL);
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) TRAXXAS_cyrf_data_config()
|
||||
{
|
||||
CYRF_PROGMEM_ConfigSOPCode(TRAXXAS_sop_data);
|
||||
#ifdef TRAXXAS_FORCE_ID // data taken from TX dump
|
||||
CYRF_WriteRegister(CYRF_15_CRC_SEED_LSB, 0x1B);
|
||||
CYRF_WriteRegister(CYRF_16_CRC_SEED_MSB, 0x3F);
|
||||
#else
|
||||
CYRF_WriteRegister(CYRF_15_CRC_SEED_LSB, cyrfmfg_id[0]+0xB6);
|
||||
CYRF_WriteRegister(CYRF_16_CRC_SEED_MSB, cyrfmfg_id[1]+0x5D);
|
||||
#endif
|
||||
CYRF_ConfigRFChannel(TRAXXAS_CHANNEL);
|
||||
CYRF_SetTxRxMode(TX_EN);
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) TRAXXAS_send_data_packet()
|
||||
{
|
||||
packet[0] = 0x01;
|
||||
memset(&packet[1],0x00,TRAXXAS_PACKET_SIZE-1);
|
||||
//Steering
|
||||
uint16_t ch = convert_channel_16b_nolimit(RUDDER,500,1000);
|
||||
packet[2]=ch>>8;
|
||||
packet[3]=ch;
|
||||
//Throttle
|
||||
ch = convert_channel_16b_nolimit(THROTTLE,500,1000);
|
||||
packet[4]=ch>>8;
|
||||
packet[5]=ch;
|
||||
//AUX3
|
||||
ch = convert_channel_16b_nolimit(AILERON,500,1000);
|
||||
packet[6]=ch>>8;
|
||||
packet[7]=ch;
|
||||
//AUX4???
|
||||
ch = convert_channel_16b_nolimit(ELEVATOR,500,1000);
|
||||
packet[12]=ch>>8;
|
||||
packet[13]=ch;
|
||||
|
||||
CYRF_SetPower(0x08);
|
||||
CYRF_WriteDataPacketLen(packet, TRAXXAS_PACKET_SIZE);
|
||||
}
|
||||
|
||||
uint16_t ReadTRAXXAS()
|
||||
{
|
||||
uint8_t status;
|
||||
|
||||
switch(phase)
|
||||
{
|
||||
case TRAXXAS_BIND_PREP_RX:
|
||||
TRAXXAS_cyrf_bind_config();
|
||||
CYRF_SetTxRxMode(RX_EN); //Receive mode
|
||||
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x83); //Prepare to receive
|
||||
packet_count=100; //Timeout for RX
|
||||
phase=TRAXXAS_BIND_RX;
|
||||
return 700;
|
||||
case TRAXXAS_BIND_RX:
|
||||
//Read data from RX
|
||||
status = CYRF_ReadRegister(CYRF_07_RX_IRQ_STATUS);
|
||||
if((status & 0x03) == 0x02) // RXC=1, RXE=0 then 2nd check is required (debouncing)
|
||||
status |= CYRF_ReadRegister(CYRF_07_RX_IRQ_STATUS);
|
||||
debugln("s=%02X",status);
|
||||
CYRF_WriteRegister(CYRF_07_RX_IRQ_STATUS, 0x80); // need to set RXOW before data read
|
||||
if((status & 0x07) == 0x02)
|
||||
{ // Data received with no errors
|
||||
len=CYRF_ReadRegister(CYRF_09_RX_COUNT);
|
||||
debugln("L=%02X",len)
|
||||
if(len==TRAXXAS_PACKET_SIZE)
|
||||
{
|
||||
CYRF_ReadDataPacketLen(packet, TRAXXAS_PACKET_SIZE);
|
||||
debug("RX=");
|
||||
for(uint8_t i=0;i<TRAXXAS_PACKET_SIZE;i++)
|
||||
debug(" %02X",packet[i]);
|
||||
debugln("");
|
||||
for(uint8_t i=0;i<6;i++)
|
||||
packet[i+1]=cyrfmfg_id[i];
|
||||
packet[10]=0x01;
|
||||
packet_count=12;
|
||||
CYRF_SetTxRxMode(TX_EN);
|
||||
phase=TRAXXAS_BIND_TX1;
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
if( --packet_count == 0 )
|
||||
{ // Retry RX
|
||||
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x20); // Enable RX abort
|
||||
CYRF_WriteRegister(CYRF_0F_XACT_CFG, 0x24); // Force end state
|
||||
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x00); // Disable RX abort
|
||||
if(--bind_counter != 0)
|
||||
phase=TRAXXAS_BIND_PREP_RX; // Retry receiving bind packet
|
||||
else
|
||||
phase=TRAXXAS_PREP_DATA; // Abort binding
|
||||
}
|
||||
return 700;
|
||||
case TRAXXAS_BIND_TX1:
|
||||
CYRF_WriteDataPacketLen(packet, TRAXXAS_PACKET_SIZE);
|
||||
debug("P=");
|
||||
for(uint8_t i=0;i<TRAXXAS_PACKET_SIZE;i++)
|
||||
debug(" %02X",packet[i]);
|
||||
debugln("");
|
||||
if(--packet_count==0) // Switch to normal mode
|
||||
phase=TRAXXAS_PREP_DATA;
|
||||
break;
|
||||
case TRAXXAS_PREP_DATA:
|
||||
BIND_DONE;
|
||||
TRAXXAS_cyrf_data_config();
|
||||
phase++;
|
||||
case TRAXXAS_DATA:
|
||||
TRAXXAS_send_data_packet();
|
||||
break;
|
||||
}
|
||||
return 13940;
|
||||
}
|
||||
|
||||
uint16_t initTRAXXAS()
|
||||
{
|
||||
CYRF_Reset();
|
||||
|
||||
//Config CYRF registers
|
||||
for(uint8_t i = 0; i < sizeof(TRAXXAS_init_vals) / 2; i++)
|
||||
CYRF_WriteRegister(pgm_read_byte_near(&TRAXXAS_init_vals[i][0]), pgm_read_byte_near(&TRAXXAS_init_vals[i][1]));
|
||||
|
||||
//Read CYRF ID
|
||||
CYRF_GetMfgData(cyrfmfg_id);
|
||||
cyrfmfg_id[0]+=RX_num;
|
||||
|
||||
#ifdef TRAXXAS_FORCE_ID // data taken from TX dump
|
||||
cyrfmfg_id[0]=0x65; // CYRF MFG ID
|
||||
cyrfmfg_id[1]=0xE2;
|
||||
cyrfmfg_id[2]=0x5E;
|
||||
cyrfmfg_id[3]=0x55;
|
||||
cyrfmfg_id[4]=0x4D;
|
||||
cyrfmfg_id[5]=0xFE;
|
||||
#endif
|
||||
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
{
|
||||
bind_counter=100;
|
||||
phase = TRAXXAS_BIND_PREP_RX;
|
||||
}
|
||||
else
|
||||
phase = TRAXXAS_PREP_DATA;
|
||||
return 1000;
|
||||
}
|
||||
|
||||
/*
|
||||
Bind phase 1
|
||||
CHANNEL: 0x2B
|
||||
SOP_CODE: 0x3C 0x37 0xCC 0x91 0xE2 0xF8 0xCC 0x91
|
||||
CRC_SEED_LSB: 0x5A
|
||||
CRC_SEED_MSB: 0x5A
|
||||
RX1: 0x02 0x4A 0xA3 0x2D 0x1A 0x49 0xFE 0x06 0x00 0x00 0x02 0x01 0x06 0x06 0x00 0x00
|
||||
TX1: 0x02 0x65 0xE2 0x5E 0x55 0x4D 0xFE 0xEE 0x00 0x00 0x01 0x01 0x06 0x05 0x00 0x00
|
||||
Note: RX cyrfmfg_id is 0x4A,0xA3,0x2D,0x1A,0x49,0xFE and TX cyrfmfg_id is 0x65,0xE2,0x5E,0x55,0x4D,0xFE
|
||||
|
||||
Bind phase 2 (looks like normal mode?)
|
||||
CHANNEL: 0x05
|
||||
SOP_CODE: 0xA1 0x78 0xDC 0x3C 0x9E 0x82 0xDC 0x3C
|
||||
CRC_SEED_LSB: 0x1B
|
||||
CRC_SEED_MSB: 0x3F
|
||||
RX2: 0x03 0x4A 0xA3 0x2D 0x1A 0x49 0xFE 0x06 0x00 0x00 0x02 0x01 0x06 0x06 0x00 0x00
|
||||
TX2: 0x01 0x65 0x01 0xF4 0x03 0xE7 0x02 0x08 0x00 0x00 0x01 0x01 0x02 0xEE 0x00 0x00
|
||||
Note: TX2 is nearly a normal packet at the exception of the 2nd byte equal to cyrfmfg_id[0]
|
||||
|
||||
Bind phase 3 (check?)
|
||||
CHANNEL: 0x22
|
||||
SOP_CODE: 0x97 0xE5 0x14 0x72 0x7F 0x1A 0x14 0x72
|
||||
CRC_SEED_LSB: 0xA5
|
||||
CRC_SEED_MSB: 0xA5
|
||||
RX3: 0x04 0x4A 0xA3 0x2D 0x1A 0x49 0xFE 0x06 0x00 0x00 0x02 0x01 0x06 0x06 0x00 0x00
|
||||
|
||||
Switch to normal mode
|
||||
CHANNEL: 0x05
|
||||
SOP_CODE: 0xA1 0x78 0xDC 0x3C 0x9E 0x82 0xDC 0x3C
|
||||
CRC_SEED_LSB: 0x1B
|
||||
CRC_SEED_MSB: 0x3F
|
||||
TX3: 0x01 0x00 0x02 0xA8 0x03 0xE7 0x02 0x08 0x00 0x00 0x01 0x01 0x02 0xEE 0x00 0x00
|
||||
*/
|
||||
#endif
|
||||
@@ -47,6 +47,24 @@
|
||||
#define CHANNEL_MAX_COMMAND 1424 // 1750us
|
||||
|
||||
//Channel definitions
|
||||
#define CH1 0
|
||||
#define CH2 1
|
||||
#define CH3 2
|
||||
#define CH4 3
|
||||
#define CH5 4
|
||||
#define CH6 5
|
||||
#define CH7 6
|
||||
#define CH8 7
|
||||
#define CH9 8
|
||||
#define CH10 9
|
||||
#define CH11 10
|
||||
#define CH12 11
|
||||
#define CH13 12
|
||||
#define CH14 13
|
||||
#define CH15 14
|
||||
#define CH16 15
|
||||
|
||||
//Channel order
|
||||
#ifdef AETR
|
||||
#define AILERON 0
|
||||
#define ELEVATOR 1
|
||||
@@ -194,20 +212,3 @@
|
||||
#define THROTTLE 1
|
||||
#define RUDDER 0
|
||||
#endif
|
||||
|
||||
#define CH1 0
|
||||
#define CH2 1
|
||||
#define CH3 2
|
||||
#define CH4 3
|
||||
#define CH5 4
|
||||
#define CH6 5
|
||||
#define CH7 6
|
||||
#define CH8 7
|
||||
#define CH9 8
|
||||
#define CH10 9
|
||||
#define CH11 10
|
||||
#define CH12 11
|
||||
#define CH13 12
|
||||
#define CH14 13
|
||||
#define CH15 14
|
||||
#define CH16 15
|
||||
|
||||
@@ -170,13 +170,40 @@ static void multi_send_status()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SCANNER_TELEMETRY
|
||||
void spectrum_scanner_frame()
|
||||
{
|
||||
#if defined MULTI_TELEMETRY
|
||||
multi_send_header(MULTI_TELEMETRY_SCANNER, SCAN_CHANS_PER_PACKET + 1);
|
||||
#else
|
||||
Serial_write(0xAA); // Telemetry packet
|
||||
#endif
|
||||
Serial_write(pkt[0]); // start channel
|
||||
for(uint8_t ch = 0; ch < SCAN_CHANS_PER_PACKET; ch++)
|
||||
Serial_write(pkt[ch+1]); // RSSI power levels
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRSKYX_RX_TELEMETRY
|
||||
void frskyx_rx_channels_frame()
|
||||
{
|
||||
#if defined MULTI_TELEMETRY
|
||||
multi_send_header(MULTI_TELEMETRY_RX_CHANNELS, 26);
|
||||
#else
|
||||
Serial_write(0xAA); // Telemetry packet
|
||||
#endif
|
||||
for (uint8_t i = 0; i < 26; i++)
|
||||
Serial_write(pkt[i]); // pps, rssi, ch start, ch count, 16x ch data
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AFHDS2A_FW_TELEMETRY
|
||||
void AFHDSA_short_frame()
|
||||
{
|
||||
#if defined MULTI_TELEMETRY
|
||||
multi_send_header(MULTI_TELEMETRY_AFHDS2A, 29);
|
||||
multi_send_header(pkt[29]==0xAA?MULTI_TELEMETRY_AFHDS2A:MULTI_TELEMETRY_AFHDS2A_AC, 29);
|
||||
#else
|
||||
Serial_write(0xAA); // Telemetry packet
|
||||
Serial_write(pkt[29]); // Telemetry packet 0xAA or 0xAC
|
||||
#endif
|
||||
for (uint8_t i = 0; i < 29; i++) // RSSI value followed by 4*7 bytes of telemetry data
|
||||
Serial_write(pkt[i]);
|
||||
@@ -996,6 +1023,24 @@ void TelemetryUpdate()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined SCANNER_TELEMETRY
|
||||
if (telemetry_link && protocol == PROTO_SCANNER)
|
||||
{
|
||||
spectrum_scanner_frame();
|
||||
telemetry_link = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined FRSKYX_RX_TELEMETRY
|
||||
if (telemetry_link && protocol == PROTO_FRSKYX_RX)
|
||||
{
|
||||
frskyx_rx_channels_frame();
|
||||
telemetry_link = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if((telemetry_link & 1 )&& protocol != PROTO_FRSKYX)
|
||||
{ // FrSkyD + Hubsan + AFHDS2A + Bayang + Cabell + Hitec + Bugs + BugsMini + NCC1701
|
||||
frsky_link_frame();
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Check for minimum version of multi-module boards
|
||||
#define MIN_AVR_BOARD 107
|
||||
#define MIN_ORX_BOARD 107
|
||||
#define MIN_STM32_BOARD 114
|
||||
// Check for minimum board file definition version for DIY multi-module boards
|
||||
#define MIN_AVR_BOARD 109
|
||||
#define MIN_ORX_BOARD 109
|
||||
#define MIN_STM32_BOARD 116
|
||||
//AVR
|
||||
#if (defined(ARDUINO_MULTI_NO_BOOT) && ARDUINO_MULTI_NO_BOOT < MIN_AVR_BOARD) || (defined(ARDUINO_MULTI_FLASH_FROM_TX) && ARDUINO_MULTI_FLASH_FROM_TX < MIN_AVR_BOARD)
|
||||
#error You need to update your Multi 4-in-1 board definition. Open Boards Manager and update to the latest version of the Multi 4-in-1 AVR Boards.
|
||||
@@ -35,6 +35,11 @@
|
||||
#error You need to update your Multi 4-in-1 board definition. Open Boards Manager and update to the latest version of the Multi 4-in-1 STM32 Board.
|
||||
#endif
|
||||
|
||||
// Enable serial debugging if a debugging option was chosen in the IDE
|
||||
#ifdef ARDUINO_MULTI_DEBUG
|
||||
#define DEBUG_SERIAL
|
||||
#endif
|
||||
|
||||
// Error if CHECK_FOR_BOOTLOADER is not enabled but a FLASH_FROM_TX board is selected
|
||||
#if (defined(ARDUINO_MULTI_FLASH_FROM_TX) || defined(ARDUINO_MULTI_STM32_FLASH_FROM_TX)) &! defined(CHECK_FOR_BOOTLOADER)
|
||||
#if defined(STM32_BOARD)
|
||||
@@ -44,9 +49,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Error if CHECK_FOR_BOOTLOADER is enabled but the 'Flash from TX' bootloader
|
||||
// Warning if CHECK_FOR_BOOTLOADER is enabled but no bootloader
|
||||
#if defined(ARDUINO_MULTI_NO_BOOT) && defined(CHECK_FOR_BOOTLOADER)
|
||||
#error "You have enabled CHECK_FOR_BOOTLOADER but not selected the 'Flash from TX' bootloader."
|
||||
#undef CHECK_FOR_BOOTLOADER
|
||||
#warning "Disabling CHECK_FOR_BOOTLOADER since no bootloader is selected."
|
||||
#endif
|
||||
|
||||
//Check number of banks
|
||||
@@ -62,6 +68,12 @@
|
||||
#endif
|
||||
|
||||
// Check forced tuning values are valid
|
||||
//CC2500
|
||||
#ifdef FORCE_CORONA_TUNING
|
||||
#if ( FORCE_CORONA_TUNING < -127 ) || ( FORCE_CORONA_TUNING > 127 )
|
||||
#error "The CORONA forced frequency tuning value is outside of the range -127..127."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FORCE_FRSKYD_TUNING
|
||||
#if ( FORCE_FRSKYD_TUNING < -127 ) || ( FORCE_FRSKYD_TUNING > 127 )
|
||||
#error "The FrSkyD forced frequency tuning value is outside of the range -127..127."
|
||||
@@ -77,14 +89,9 @@
|
||||
#error "The FrSkyX forced frequency tuning value is outside of the range -127..127."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FORCE_SFHSS_TUNING
|
||||
#if ( FORCE_SFHSS_TUNING < -127 ) || ( FORCE_SFHSS_TUNING > 127 )
|
||||
#error "The SFHSS forced frequency tuning value is outside of the range -127..127."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FORCE_CORONA_TUNING
|
||||
#if ( FORCE_CORONA_TUNING < -127 ) || ( FORCE_CORONA_TUNING > 127 )
|
||||
#error "The CORONA forced frequency tuning value is outside of the range -127..127."
|
||||
#ifdef FORCE_HITEC_TUNING
|
||||
#if ( FORCE_HITEC_TUNING < -127 ) || ( FORCE_HITEC_TUNING > 127 )
|
||||
#error "The HITEC forced frequency tuning value is outside of the range -127..127."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FORCE_REDPINE_TUNING
|
||||
@@ -92,9 +99,20 @@
|
||||
#error "The REDPINE forced frequency tuning value is outside of the range -127..127."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FORCE_HITEC_TUNING
|
||||
#if ( FORCE_HITEC_TUNING < -127 ) || ( FORCE_HITEC_TUNING > 127 )
|
||||
#error "The HITEC forced frequency tuning value is outside of the range -127..127."
|
||||
#ifdef FORCE_SFHSS_TUNING
|
||||
#if ( FORCE_SFHSS_TUNING < -127 ) || ( FORCE_SFHSS_TUNING > 127 )
|
||||
#error "The SFHSS forced frequency tuning value is outside of the range -127..127."
|
||||
#endif
|
||||
#endif
|
||||
//A7105
|
||||
#ifdef FORCE_AFHDS2A_TUNING
|
||||
#if ( FORCE_AFHDS2A_TUNING < -300 ) || ( FORCE_AFHDS2A_TUNING > 300 )
|
||||
#error "The AFHDS2A forced frequency tuning value is outside of the range -300..300."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FORCE_BUGS_TUNING
|
||||
#if ( FORCE_BUGS_TUNING < -300 ) || ( FORCE_BUGS_TUNING > 300 )
|
||||
#error "The BUGS forced frequency tuning value is outside of the range -300..300."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FORCE_FLYSKY_TUNING
|
||||
@@ -102,20 +120,27 @@
|
||||
#error "The Flysky forced frequency tuning value is outside of the range -300..300."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FORCE_FLYZONE_TUNING
|
||||
#if ( FORCE_FLYZONE_TUNING < -300 ) || ( FORCE_FLYZONE_TUNING > 300 )
|
||||
#error "The Flyzone forced frequency tuning value is outside of the range -300..300."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FORCE_HUBSAN_TUNING
|
||||
#if ( FORCE_HUBSAN_TUNING < -300 ) || ( FORCE_HUBSAN_TUNING > 300 )
|
||||
#error "The Hubsan forced frequency tuning value is outside of the range -300..300."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FORCE_AFHDS2A_TUNING
|
||||
#if ( FORCE_AFHDS2A_TUNING < -300 ) || ( FORCE_AFHDS2A_TUNING > 300 )
|
||||
#error "The AFHDS2A forced frequency tuning value is outside of the range -300..300."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef USE_A7105_CH15_TUNING
|
||||
#ifndef FORCE_BUGS_TUNING
|
||||
#define FORCE_BUGS_TUNING 0
|
||||
#endif
|
||||
#ifndef FORCE_FLYSKY_TUNING
|
||||
#define FORCE_FLYSKY_TUNING 0
|
||||
#endif
|
||||
#ifndef FORCE_FLYZONE_TUNING
|
||||
#define FORCE_FLYZONE_TUNING 0
|
||||
#endif
|
||||
#ifndef FORCE_HUBSAN_TUNING
|
||||
#define FORCE_HUBSAN_TUNING 0
|
||||
#endif
|
||||
@@ -124,6 +149,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (USE_CYRF6936_CH15_TUNING) && (DSM_THROTTLE_KILL_CH == 15)
|
||||
#error "Error Channel 15 conflict between the CYRF6936 freq tuning and the DSM throttle kill feature."
|
||||
#endif
|
||||
|
||||
//Change/Force configuration if OrangeTX
|
||||
#ifdef ORANGE_TX
|
||||
#undef ENABLE_PPM // Disable PPM for OrangeTX module
|
||||
@@ -144,6 +173,7 @@
|
||||
#undef HUBSAN_A7105_INO
|
||||
#undef AFHDS2A_A7105_INO
|
||||
#undef BUGS_A7105_INO
|
||||
#undef FLYZONE_A7105_INO
|
||||
#endif
|
||||
#ifndef CYRF6936_INSTALLED
|
||||
#undef DEVO_CYRF6936_INO
|
||||
@@ -151,7 +181,7 @@
|
||||
#undef J6PRO_CYRF6936_INO
|
||||
#undef WFLY_CYRF6936_INO
|
||||
#undef WK2x01_CYRF6936_INO
|
||||
#undef TRAXXAS_CYRF6936_INO
|
||||
#undef TRAXXAS_CYRF6936_INO
|
||||
#endif
|
||||
#ifndef CC2500_INSTALLED
|
||||
#undef FRSKYD_CC2500_INO
|
||||
@@ -162,6 +192,8 @@
|
||||
#undef REDPINE_CC2500_INO
|
||||
#undef HITEC_CC2500_INO
|
||||
#undef XN297L_CC2500_EMU
|
||||
#undef SCANNER_CC2500_INO
|
||||
#undef FRSKYX_RX_CC2500_INO
|
||||
#endif
|
||||
#ifndef NRF24L01_INSTALLED
|
||||
#undef BAYANG_NRF24L01_INO
|
||||
@@ -197,6 +229,7 @@
|
||||
#undef V911S_NRF24L01_INO
|
||||
#undef XN297L_CC2500_EMU
|
||||
#undef POTENSIC_NRF24L01_INO
|
||||
#undef ZSX_NRF24L01_INO
|
||||
#endif
|
||||
|
||||
//Make sure telemetry is selected correctly
|
||||
@@ -217,9 +250,21 @@
|
||||
#undef DSM_TELEMETRY
|
||||
#undef MULTI_STATUS
|
||||
#undef MULTI_TELEMETRY
|
||||
#undef SCANNER_TELEMETRY
|
||||
#undef SCANNER_CC2500_INO
|
||||
#undef FRSKYX_RX_TELEMETRY
|
||||
#undef FRSKYX_RX_CC2500_INO
|
||||
#else
|
||||
#if defined MULTI_TELEMETRY && not defined INVERT_TELEMETRY
|
||||
#warning MULTI_TELEMETRY has been defined but not INVERT_TELEMETRY. They should be both enabled for OpenTX telemetry and status to work.
|
||||
#if defined(MULTI_TELEMETRY) && defined(MULTI_STATUS)
|
||||
#error You should choose either MULTI_TELEMETRY or MULTI_STATUS but not both.
|
||||
#endif
|
||||
#if not defined(SCANNER_CC2500_INO) || not defined(SCANNER_TELEMETRY)
|
||||
#undef SCANNER_TELEMETRY
|
||||
#undef SCANNER_CC2500_INO
|
||||
#endif
|
||||
#if not defined(FRSKYX_RX_CC2500_INO) || not defined(FRSKYX_RX_TELEMETRY)
|
||||
#undef FRSKYX_RX_TELEMETRY
|
||||
#undef FRSKYX_RX_CC2500_INO
|
||||
#endif
|
||||
#if not defined(BAYANG_NRF24L01_INO)
|
||||
#undef BAYANG_HUB_TELEMETRY
|
||||
@@ -227,7 +272,7 @@
|
||||
#if not defined(NCC1701_NRF24L01_INO)
|
||||
#undef NCC1701_HUB_TELEMETRY
|
||||
#endif
|
||||
#if not ( defined(BUGS_A7105_INO) || defined(BUGSMINI_NRF24L01_INO) )
|
||||
#if not defined(BUGS_A7105_INO) && not defined(BUGSMINI_NRF24L01_INO)
|
||||
#undef BUGS_HUB_TELEMETRY
|
||||
#endif
|
||||
#if not defined(CABELL_NRF24L01_INO)
|
||||
@@ -260,7 +305,7 @@
|
||||
#if not defined(DSM_CYRF6936_INO)
|
||||
#undef DSM_TELEMETRY
|
||||
#endif
|
||||
#if not defined(DSM_TELEMETRY) && not defined(SPORT_TELEMETRY) && not defined(HUB_TELEMETRY) && not defined(HUBSAN_HUB_TELEMETRY) && not defined(BUGS_HUB_TELEMETRY) && not defined(NCC1701_HUB_TELEMETRY) && not defined(BAYANG_HUB_TELEMETRY) && not defined(CABELL_HUB_TELEMETRY) && not defined(AFHDS2A_HUB_TELEMETRY) && not defined(AFHDS2A_FW_TELEMETRY) && not defined(MULTI_TELEMETRY) && not defined(MULTI_STATUS) && not defined(HITEC_HUB_TELEMETRY) && not defined(HITEC_FW_TELEMETRY)
|
||||
#if not defined(DSM_TELEMETRY) && not defined(SPORT_TELEMETRY) && not defined(HUB_TELEMETRY) && not defined(HUBSAN_HUB_TELEMETRY) && not defined(BUGS_HUB_TELEMETRY) && not defined(NCC1701_HUB_TELEMETRY) && not defined(BAYANG_HUB_TELEMETRY) && not defined(CABELL_HUB_TELEMETRY) && not defined(AFHDS2A_HUB_TELEMETRY) && not defined(AFHDS2A_FW_TELEMETRY) && not defined(MULTI_TELEMETRY) && not defined(MULTI_STATUS) && not defined(HITEC_HUB_TELEMETRY) && not defined(HITEC_FW_TELEMETRY) && not defined(SCANNER_TELEMETRY) && not defined(FRSKYX_RX_TELEMETRY)
|
||||
#undef TELEMETRY
|
||||
#undef INVERT_TELEMETRY
|
||||
#undef SPORT_POLLING
|
||||
|
||||
@@ -80,9 +80,6 @@ static void __attribute__((unused)) WFLY_cyrf_data_config()
|
||||
|
||||
static uint16_t __attribute__((unused)) WFLY_send_data_packet()
|
||||
{
|
||||
#ifdef USE_CYRF6936_CH15_TUNING
|
||||
static uint16_t Channel15=1024;
|
||||
#endif
|
||||
packet_count++;
|
||||
packet[0] = rx_tx_addr[2];
|
||||
packet[1] = rx_tx_addr[3];
|
||||
@@ -137,16 +134,6 @@ static uint16_t __attribute__((unused)) WFLY_send_data_packet()
|
||||
sum += packet[i];
|
||||
packet[len] = sum;
|
||||
|
||||
#ifdef USE_CYRF6936_CH15_TUNING
|
||||
if(Channel15!=Channel_data[CH15])
|
||||
{ // adjust frequency
|
||||
Channel15=Channel_data[CH15]+0x155; // default value is 0x555 = 0x400 + 0x155
|
||||
CYRF_WriteRegister(CYRF_1B_TX_OFFSET_LSB, Channel15&0xFF);
|
||||
CYRF_WriteRegister(CYRF_1C_TX_OFFSET_MSB, Channel15>>8);
|
||||
Channel15-=0x155;
|
||||
}
|
||||
#endif
|
||||
|
||||
CYRF_ConfigRFChannel(hopping_frequency[(packet_count)%4]);
|
||||
CYRF_SetPower(0x08);
|
||||
CYRF_WriteDataPacketLen(packet, len+1);
|
||||
|
||||
@@ -76,10 +76,10 @@ static boolean __attribute__((unused)) XN297Dump_process_packet(void)
|
||||
{
|
||||
uint16_t crcxored;
|
||||
uint8_t packet_sc[XN297DUMP_MAX_PACKET_LEN], packet_un[XN297DUMP_MAX_PACKET_LEN];
|
||||
|
||||
// init crc
|
||||
crc = 0xb5d2;
|
||||
|
||||
//Try normal payload
|
||||
// address
|
||||
for (uint8_t i = 0; i < address_length; i++)
|
||||
{
|
||||
@@ -112,6 +112,56 @@ static boolean __attribute__((unused)) XN297Dump_process_packet(void)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//Try enhanced payload
|
||||
crc = 0xb5d2;
|
||||
packet_length=0;
|
||||
uint16_t crc_enh;
|
||||
for (uint8_t i = 0; i < XN297DUMP_MAX_PACKET_LEN-XN297DUMP_CRC_LENGTH; i++)
|
||||
{
|
||||
packet_sc[i]=packet[i]^xn297_scramble[i];
|
||||
crc = crc16_update(crc, packet[i], 8);
|
||||
crc_enh = crc16_update(crc, packet[i+1] & 0xC0, 2);
|
||||
crcxored=(packet[i+1]<<10)|(packet[i+2]<<2)|(packet[i+3]>>6) ;
|
||||
if((crc_enh ^ pgm_read_word(&xn297_crc_xorout_scrambled_enhanced[i - 3])) == crcxored)
|
||||
{ // Found a valid CRC for the enhanced payload mode
|
||||
packet_length=i;
|
||||
scramble=true;
|
||||
i++;
|
||||
packet_sc[i]=packet[i]^xn297_scramble[i];
|
||||
memcpy(packet_un,packet_sc,packet_length+2); // unscramble packet
|
||||
break;
|
||||
}
|
||||
if((crc_enh ^ pgm_read_word(&xn297_crc_xorout_enhanced[i - 3])) == crcxored)
|
||||
{ // Found a valid CRC for the enhanced payload mode
|
||||
packet_length=i;
|
||||
scramble=false;
|
||||
memcpy(packet_un,packet,packet_length+2); // packet is unscrambled
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(packet_length!=0)
|
||||
{ // Found a valid CRC for the enhanced payload mode
|
||||
debug("Enhanced ");
|
||||
//check selected address length
|
||||
if((packet_un[address_length]>>1)!=packet_length-address_length)
|
||||
{
|
||||
for(uint8_t i=3;i<=5;i++)
|
||||
if((packet_un[i]>>1)==packet_length-i)
|
||||
address_length=i;
|
||||
debug("Wrong address length selected using %d ", address_length )
|
||||
}
|
||||
debug("pid=%d ",((packet_un[address_length]&0x01)<<1)|(packet_un[address_length+1]>>7));
|
||||
debug("ack=%d ",(packet_un[address_length+1]>>6)&0x01);
|
||||
// address
|
||||
for (uint8_t i = 0; i < address_length; i++)
|
||||
packet[address_length-1-i]=packet_un[i];
|
||||
// payload
|
||||
for (uint8_t i = address_length; i < packet_length; i++)
|
||||
packet[i] = bit_reverse((packet_un[i+1]<<2)|(packet_un[i+2]>>6));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
117
Multiprotocol/ZSX_nrf24l01.ino
Normal file
117
Multiprotocol/ZSX_nrf24l01.ino
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
This project is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Multiprotocol is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// Compatible with JJRC ZSX-280 plane.
|
||||
|
||||
#if defined(ZSX_NRF24L01_INO)
|
||||
|
||||
#include "iface_xn297l.h"
|
||||
|
||||
//#define FORCE_ZSX_ORIGINAL_ID
|
||||
|
||||
#define ZSX_INITIAL_WAIT 500
|
||||
#define ZSX_PACKET_PERIOD 10093
|
||||
#define ZSX_RF_BIND_CHANNEL 7
|
||||
#define ZSX_PAYLOAD_SIZE 6
|
||||
#define ZSX_BIND_COUNT 50
|
||||
#define ZSX_RF_NUM_CHANNELS 1
|
||||
|
||||
static void __attribute__((unused)) ZSX_send_packet()
|
||||
{
|
||||
memcpy(&packet[1],rx_tx_addr,3);
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
{
|
||||
packet[0] = 0xAA;
|
||||
packet[4] = 0x00;
|
||||
packet[5] = 0x00;
|
||||
}
|
||||
else
|
||||
{
|
||||
packet[0]= 0x55;
|
||||
packet[4]= 0xFF-convert_channel_8b(RUDDER); // FF..80..01
|
||||
packet[5]= convert_channel_8b(THROTTLE)>>1 // 0..7F
|
||||
| GET_FLAG(CH5_SW, 0x80); // Light
|
||||
}
|
||||
|
||||
XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP));
|
||||
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);
|
||||
NRF24L01_FlushTx();
|
||||
XN297_WritePayload(packet, ZSX_PAYLOAD_SIZE);
|
||||
|
||||
NRF24L01_SetPower(); // Set tx_power
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) ZSX_initialize_txid()
|
||||
{
|
||||
rx_tx_addr[0]=rx_tx_addr[3]; // Use RX_num;
|
||||
#ifdef FORCE_ZSX_ORIGINAL_ID
|
||||
//TX1
|
||||
rx_tx_addr[0]=0x03;
|
||||
rx_tx_addr[1]=0x01;
|
||||
rx_tx_addr[2]=0xC3;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) ZSX_init()
|
||||
{
|
||||
NRF24L01_Initialize();
|
||||
NRF24L01_SetTxRxMode(TX_EN);
|
||||
NRF24L01_FlushTx();
|
||||
NRF24L01_FlushRx();
|
||||
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); // Clear data ready, data sent, and retransmit
|
||||
NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00); // No Auto Acknowldgement on all data pipes
|
||||
NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01); // Enable data pipe 0 only
|
||||
NRF24L01_SetBitrate(NRF24L01_BR_1M); // 1Mbps
|
||||
NRF24L01_SetPower();
|
||||
XN297_SetTXAddr((uint8_t*)"\xc1\xc2\xc3", 3);
|
||||
NRF24L01_WriteReg(NRF24L01_05_RF_CH, ZSX_RF_BIND_CHANNEL); // Set bind channel
|
||||
}
|
||||
|
||||
uint16_t ZSX_callback()
|
||||
{
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
if(--bind_counter==0)
|
||||
{
|
||||
BIND_DONE;
|
||||
XN297_SetTXAddr(rx_tx_addr, 3);
|
||||
NRF24L01_WriteReg(NRF24L01_05_RF_CH, 0x00);
|
||||
}
|
||||
ZSX_send_packet();
|
||||
return ZSX_PACKET_PERIOD;
|
||||
}
|
||||
|
||||
uint16_t initZSX()
|
||||
{
|
||||
BIND_IN_PROGRESS; // autobind protocol
|
||||
ZSX_initialize_txid();
|
||||
ZSX_init();
|
||||
bind_counter=ZSX_BIND_COUNT;
|
||||
return ZSX_INITIAL_WAIT;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// XN297 spped 1Mb, scrambled
|
||||
// Bind
|
||||
// channel 7
|
||||
// address: C1 C2 C3
|
||||
// P(6)= AA 03 01 C3 00 00
|
||||
// 03 01 C3 <- normal address
|
||||
// Normal
|
||||
// channel 0 and seems to be fixed
|
||||
// address: 03 01 C3
|
||||
// P(6)= 55 03 01 C3 80 00
|
||||
// 03 01 C3 <- normal address
|
||||
// 80 <- rudder FF..80..01
|
||||
// 00 <- throttle 00..7F, light flag 0x80
|
||||
@@ -31,8 +31,8 @@
|
||||
/*************************/
|
||||
//Allow flashing multimodule directly with TX(erky9x or opentx maintenance mode)
|
||||
//Instructions:https://github.com/pascallanger/DIY-Multiprotocol-TX-Module/blob/master/docs/Flash_from_Tx.md
|
||||
//To enable this feature remove the "//" on the next line. Requires a compatible bootloader or upload method to be selected when you use the Multi 4-in-1 Boards Manager definitions.
|
||||
//#define CHECK_FOR_BOOTLOADER
|
||||
//To disable this feature add "//" at the begining of the next line. Requires a compatible bootloader or upload method to be selected when you use the Multi 4-in-1 Boards Manager definitions.
|
||||
#define CHECK_FOR_BOOTLOADER
|
||||
|
||||
|
||||
/*******************/
|
||||
@@ -108,10 +108,11 @@
|
||||
|
||||
//Once a good tuning value is found it can be set here and will override the frequency tuning for a specific protocol.
|
||||
//Uncomment the lines below (remove the "//") and set an appropriate value (replace the "0") to enable. Valid range is -300 to +300 and default is 0.
|
||||
//#define FORCE_FLYSKY_TUNING 0
|
||||
//#define FORCE_HUBSAN_TUNING 0
|
||||
//#define FORCE_AFHDS2A_TUNING 0
|
||||
//#define FORCE_BUGS_TUNING 0
|
||||
//#define FORCE_BUGS_TUNING 0
|
||||
//#define FORCE_FLYSKY_TUNING 0
|
||||
//#define FORCE_FLYZONE_TUNING 0
|
||||
//#define FORCE_HUBSAN_TUNING 0
|
||||
|
||||
/** CYRF6936 Fine Frequency Tuning **/
|
||||
//This is required in rare cases where some CYRF6936 modules and/or RXs have an inaccurate crystal oscillator.
|
||||
@@ -155,25 +156,27 @@
|
||||
|
||||
//The protocols below need an A7105 to be installed
|
||||
#define AFHDS2A_A7105_INO
|
||||
#define FLYSKY_A7105_INO
|
||||
#define HUBSAN_A7105_INO
|
||||
#define BUGS_A7105_INO
|
||||
#define FLYSKY_A7105_INO
|
||||
#define FLYZONE_A7105_INO
|
||||
#define HUBSAN_A7105_INO
|
||||
|
||||
//The protocols below need a CYRF6936 to be installed
|
||||
#define DEVO_CYRF6936_INO
|
||||
#define DSM_CYRF6936_INO
|
||||
#define J6PRO_CYRF6936_INO
|
||||
#define TRAXXAS_CYRF6936_INO
|
||||
#define WFLY_CYRF6936_INO
|
||||
#define WK2x01_CYRF6936_INO
|
||||
|
||||
//#define TRAXXAS_CYRF6936_INO
|
||||
|
||||
//The protocols below need a CC2500 to be installed
|
||||
#define CORONA_CC2500_INO
|
||||
#define FRSKYD_CC2500_INO
|
||||
#define FRSKYV_CC2500_INO
|
||||
#define FRSKYX_CC2500_INO
|
||||
#define FRSKYX_RX_CC2500_INO
|
||||
#define HITEC_CC2500_INO
|
||||
#define SCANNER_CC2500_INO
|
||||
#define SFHSS_CC2500_INO
|
||||
#define REDPINE_CC2500_INO
|
||||
|
||||
@@ -210,6 +213,7 @@
|
||||
#define V761_NRF24L01_INO
|
||||
#define V911S_NRF24L01_INO
|
||||
#define YD717_NRF24L01_INO
|
||||
#define ZSX_NRF24L01_INO
|
||||
|
||||
|
||||
/***************************/
|
||||
@@ -222,10 +226,10 @@
|
||||
// For more throw, 1024..1976us @100% and 904..2096us @125%, remove the "//" on the line below. Be aware that too much throw can damage some UMX servos. To achieve standard throw in this mode use a channel weight of 84%.
|
||||
//#define DSM_MAX_THROW
|
||||
//Some models (X-Vert, Blade 230S...) require a special value to instant stop the motor(s).
|
||||
// You can disable this feature by adding "//" on the line below. You have to specify which channel (15 by default) will be used to kill the throttle channel.
|
||||
// If the channel 15 is above -50% the throttle is untouched but if it is between -50% and -100%, the throttle output will be forced between -100% and -150%.
|
||||
// You can disable this feature by adding "//" on the line below. You have to specify which channel (14 by default) will be used to kill the throttle channel.
|
||||
// If the channel 14 is above -50% the throttle is untouched but if it is between -50% and -100%, the throttle output will be forced between -100% and -150%.
|
||||
// For example, a value of -80% applied on channel 15 will instantly kill the motors on the X-Vert.
|
||||
#define DSM_THROTTLE_KILL_CH 15
|
||||
#define DSM_THROTTLE_KILL_CH 14
|
||||
|
||||
//AFHDS2A specific settings
|
||||
//-------------------------
|
||||
@@ -273,11 +277,11 @@
|
||||
|
||||
//Comment if you don't want to send Multi status telemetry frames (Protocol available, Bind in progress, version...)
|
||||
//Use with er9x/erksy9x, for OpenTX MULTI_TELEMETRY below is preferred instead
|
||||
#define MULTI_STATUS
|
||||
//#define MULTI_STATUS
|
||||
|
||||
//Uncomment to send Multi status and allow OpenTX to autodetect the telemetry format
|
||||
//Supported by OpenTX version 2.2 RC9 and newer. NOT supported by er9x/ersky9x use MULTI_STATUS instead.
|
||||
//#define MULTI_TELEMETRY
|
||||
#define MULTI_TELEMETRY
|
||||
|
||||
//Comment a line to disable a specific protocol telemetry
|
||||
#define DSM_TELEMETRY // Forward received telemetry packet directly to TX to be decoded by er9x, ersky9x and OpenTX
|
||||
@@ -292,6 +296,8 @@
|
||||
#define CABELL_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||
#define HITEC_HUB_TELEMETRY // Use FrSkyD Hub format to send basic telemetry to the radios which can decode it like er9x, ersky9x and OpenTX
|
||||
#define HITEC_FW_TELEMETRY // Under development: Forward received telemetry packets to be decoded by ersky9x and OpenTX
|
||||
#define SCANNER_TELEMETRY // Forward spectrum scanner data to TX
|
||||
#define FRSKYX_RX_TELEMETRY // Forward channels data to TX
|
||||
|
||||
//SPORT_POLLING is an implementation of the same polling routine as XJT module for sport telemetry bidirectional communication.
|
||||
//This is useful for passing sport control frames from TX to RX(ex: changing Betaflight PID or VTX channels on the fly using LUA scripts with OpentX).
|
||||
@@ -530,6 +536,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
||||
V6X6
|
||||
V912
|
||||
CX20
|
||||
PROTO_FLYZONE
|
||||
FZ410
|
||||
PROTO_FQ777
|
||||
NONE
|
||||
PROTO_FRSKYD
|
||||
@@ -541,6 +549,9 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
||||
CH_8
|
||||
EU_16
|
||||
EU_8
|
||||
PROTO_FRSKYX_RX
|
||||
FRSKYX_FCC
|
||||
FRSKYX_LBT
|
||||
PROTO_FY326
|
||||
FY326
|
||||
FY319
|
||||
@@ -607,6 +618,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
||||
PROTO_REDPINE
|
||||
RED_FAST
|
||||
RED_SLOW
|
||||
PROTO_SCANNER
|
||||
NONE
|
||||
PROTO_SFHSS
|
||||
NONE
|
||||
PROTO_SHENQI
|
||||
@@ -621,7 +634,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
||||
SYMAX
|
||||
SYMAX5C
|
||||
PROTO_TRAXXAS
|
||||
NONE
|
||||
RX6519
|
||||
PROTO_V2X2
|
||||
V2X2
|
||||
JXD506
|
||||
@@ -644,4 +657,6 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
||||
SYMAX4
|
||||
XINXUN
|
||||
NIHUI
|
||||
PROTO_ZSX
|
||||
NONE
|
||||
*/
|
||||
|
||||
@@ -65,64 +65,69 @@ You've upgraded the module but the radio does not display the name of the protoc
|
||||
|
||||
# Available Protocol Table of Contents (Listed Alphabetically)
|
||||
|
||||
Protocol Name|Protocol Number|Sub_Proto 0|Sub_Proto 1|Sub_Proto 2|Sub_Proto 3|Sub_Proto 4|Sub_Proto 5|Sub_Proto 6|Sub_Proto 7|RF Module
|
||||
---|---|---|---|---|---|---|---|---|---|---
|
||||
[Assan](Protocols_Details.md#ASSAN---24)|24|ASSAN||||||||NRF24L01
|
||||
[Bayang](Protocols_Details.md#BAYANG---14)|14|Bayang|H8S3D|X16_AH|IRDRONE|DHD_D4||||NRF24L01
|
||||
[Bugs](Protocols_Details.md#BUGS---41)|41|BUGS||||||||A7105
|
||||
[BugsMini](Protocols_Details.md#BUGSMINI---42)|42|BUGSMINI|BUGS3H|||||||NRF24L01
|
||||
[Cabell](Protocols_Details.md#Cabell---34)|34|Cabell_V3|C_TELEM|-|-|-|-|F_SAFE|UNBIND|NRF24L01
|
||||
CFlie|38|CFlie||||||||NRF24L01
|
||||
[CG023](Protocols_Details.md#CG023---13)|13|CG023|YD829|||||||NRF24L01
|
||||
[Corona](Protocols_Details.md#CORONA---37)|37|COR_V1|COR_V2|FD_V3||||||CC2500
|
||||
[CX10](Protocols_Details.md#CX10---12)|12|GREEN|BLUE|DM007|-|J3015_1|J3015_2|MK33041||NRF24L01
|
||||
[Devo](Protocols_Details.md#DEVO---7)|7|Devo|8CH|10CH|12CH|6CH|7CH|||CYRF6936
|
||||
[DM002](Protocols_Details.md#DM002---33)|33|DM002||||||||NRF24L01
|
||||
[DSM](Protocols_Details.md#DSM---6)|6|DSM2-22|DSM2-11|DSMX-22|DSMX-11|AUTO||||CYRF6936
|
||||
[E01X](Protocols_Details.md#E01X---45)|45|E012|E015|E016H||||||NRF24L01
|
||||
[ESky](Protocols_Details.md#ESKY---16)|16|ESky||||||||NRF24L01
|
||||
[ESky150](Protocols_Details.md#ESKY150---35)|35|ESKY150||||||||NRF24L01
|
||||
[Flysky](Protocols_Details.md#FLYSKY---1)|1|Flysky|V9x9|V6x6|V912|CX20||||A7105
|
||||
[Flysky AFHDS2A](Protocols_Details.md#FLYSKY-AFHDS2A---28)|28|PWM_IBUS|PPM_IBUS|PWM_SBUS|PPM_SBUS|||||A7105
|
||||
[FQ777](Protocols_Details.md#FQ777---23)|23|FQ777||||||||NRF24L01
|
||||
[FrskyD](Protocols_Details.md#FRSKYD---3)|3|FrskyD||||||||CC2500
|
||||
[FrskyV](Protocols_Details.md#FRSKYV---25)|25|FrskyV||||||||CC2500
|
||||
[FrskyX](Protocols_Details.md#FRSKYX---15)|15|CH_16|CH_8|EU_16|EU_8|||||CC2500
|
||||
[FY326](Protocols_Details.md#FY326---20)|20|FY326|FY319|||||||NRF24L01
|
||||
[GD00X](Protocols_Details.md#GD00X---47)|47|GD_V1*|GD_V2*|||||||NRF24L01
|
||||
[GW008](Protocols_Details.md#GW008---32)|32|GW008||||||||NRF24L01
|
||||
[H8_3D](Protocols_Details.md#H8_3D---36)|36|H8_3D|H20H|H20Mini|H30Mini|||||NRF24L01
|
||||
[Hisky](Protocols_Details.md#HISKY---4)|4|Hisky|HK310|||||||NRF24L01
|
||||
[Hitec](Protocols_Details.md#HITEC---39)|39|OPT_FW|OPT_HUB|MINIMA||||||CC2500
|
||||
[Hontai](Protocols_Details.md#HONTAI---26)|26|HONTAI|JJRCX1|X5C1|FQ777_951|||||NRF24L01
|
||||
[Hubsan](Protocols_Details.md#HUBSAN---2)|2|H107|H301|H501||||||A7105
|
||||
[J6Pro](Protocols_Details.md#J6Pro---22)|22|J6PRO||||||||CYRF6936
|
||||
[KF606](Protocols_Details.md#KF606---49)|49|KF606*||||||||NRF24L01
|
||||
[KN](Protocols_Details.md#KN---9)|9|WLTOYS|FEILUN|||||||NRF24L01
|
||||
[MJXq](Protocols_Details.md#MJXQ---18)|18|WLH08|X600|X800|H26D|E010*|H26WH|PHOENIX*||NRF24L01
|
||||
[MT99xx](Protocols_Details.md#MT99XX---17)|17|MT|H7|YZ|LS|FY805||||NRF24L01
|
||||
[NCC1701](Protocols_Details.md#NCC1701---44)|44|NCC1701||||||||NRF24L01
|
||||
[OpenLRS](Protocols_Details.md#OpenLRS---27)|27|||||||||None
|
||||
[Potensic](Protocols_Details.md#Potensic---51)|51|A20||||||||NRF24L01
|
||||
[Q2X2](Protocols_Details.md#Q2X2---29)|29|Q222|Q242|Q282||||||NRF24L01
|
||||
[Q303](Protocols_Details.md#Q303---31)|31|Q303|CX35|CX10D|CX10WD|||||NRF24L01
|
||||
[Redpine](Protocols_Details.md#Redpine---50)|50|FAST|SLOW|||||||NRF24L01
|
||||
[SFHSS](Protocols_Details.md#SFHSS---21)|21|SFHSS||||||||CC2500
|
||||
[Shenqi](Protocols_Details.md#Shenqi---19)|19|Shenqi||||||||NRF24L01
|
||||
[SLT](Protocols_Details.md#SLT---11)|11|SLT_V1|SLT_V2|Q100|Q200|MR100||||NRF24L01
|
||||
[SymaX](Protocols_Details.md#Symax---10)|10|SYMAX|SYMAX5C|||||||NRF24L01
|
||||
Traxxas|43|Traxxas||||||||NRF24L01
|
||||
[V2x2](Protocols_Details.md#V2X2---5)|5|V2x2|JXD506|||||||NRF24L01
|
||||
[V761](Protocols_Details.md#V761---48)|48|V761||||||||NRF24L01
|
||||
[V911S](Protocols_Details.md#V911S---46)|46|V911S*||||||||NRF24L01
|
||||
[WFly](Protocols_Details.md#WFLY---40)|40|WFLY||||||||CYRF6936
|
||||
[WK2x01](Protocols_Details.md#WK2X01---30)|30|WK2801|WK2401|W6_5_1|W6_6_1|W6_HEL|W6_HEL_I|||CYRF6936
|
||||
[YD717](Protocols_Details.md#YD717---8)|8|YD717|SKYWLKR|SYMAX4|XINXUN|NIHUI||||NRF24L01
|
||||
* "*" Sub Protocols designated by * suffix will use the NRF24L01 module by default to emulate the XN297L RF chip.
|
||||
* If a CC2500 module is installed it will be used instead as it is proving to be a better option for the XN297L@250kbps. Each specific sub protocol has a more detailed explanation.
|
||||
Protocol Name|Protocol Number|Sub_Proto 0|Sub_Proto 1|Sub_Proto 2|Sub_Proto 3|Sub_Proto 4|Sub_Proto 5|Sub_Proto 6|Sub_Proto 7|RF Module|Emulation
|
||||
---|---|---|---|---|---|---|---|---|---|---|---
|
||||
[Assan](Protocols_Details.md#ASSAN---24)|24|ASSAN||||||||NRF24L01|
|
||||
[Bayang](Protocols_Details.md#BAYANG---14)|14|Bayang|H8S3D|X16_AH|IRDRONE|DHD_D4||||NRF24L01|XN297
|
||||
[Bugs](Protocols_Details.md#BUGS---41)|41|BUGS||||||||A7105|
|
||||
[BugsMini](Protocols_Details.md#BUGSMINI---42)|42|BUGSMINI|BUGS3H|||||||NRF24L01|XN297
|
||||
[Cabell](Protocols_Details.md#Cabell---34)|34|Cabell_V3|C_TELEM|-|-|-|-|F_SAFE|UNBIND|NRF24L01|
|
||||
CFlie|38|CFlie||||||||NRF24L01|
|
||||
[CG023](Protocols_Details.md#CG023---13)|13|CG023|YD829|||||||NRF24L01|XN297
|
||||
[Corona](Protocols_Details.md#CORONA---37)|37|COR_V1|COR_V2|FD_V3||||||CC2500|
|
||||
[CX10](Protocols_Details.md#CX10---12)|12|GREEN|BLUE|DM007|-|J3015_1|J3015_2|MK33041||NRF24L01|XN297
|
||||
[Devo](Protocols_Details.md#DEVO---7)|7|Devo|8CH|10CH|12CH|6CH|7CH|||CYRF6936|
|
||||
[DM002](Protocols_Details.md#DM002---33)|33|DM002||||||||NRF24L01|XN297
|
||||
[DSM](Protocols_Details.md#DSM---6)|6|DSM2-22|DSM2-11|DSMX-22|DSMX-11|AUTO||||CYRF6936|
|
||||
[E01X](Protocols_Details.md#E01X---45)|45|E012|E015|E016H||||||NRF24L01|XN297/HS6200
|
||||
[ESky](Protocols_Details.md#ESKY---16)|16|ESky||||||||NRF24L01|
|
||||
[ESky150](Protocols_Details.md#ESKY150---35)|35|ESKY150||||||||NRF24L01|
|
||||
[Flysky](Protocols_Details.md#FLYSKY---1)|1|Flysky|V9x9|V6x6|V912|CX20||||A7105|
|
||||
[Flysky AFHDS2A](Protocols_Details.md#FLYSKY-AFHDS2A---28)|28|PWM_IBUS|PPM_IBUS|PWM_SBUS|PPM_SBUS|||||A7105|
|
||||
[Flyzone](Protocols_Details.md#FLYZONE---53)|53|FZ410||||||||A7105|
|
||||
[FQ777](Protocols_Details.md#FQ777---23)|23|FQ777||||||||NRF24L01|SSV7241
|
||||
[FrskyD](Protocols_Details.md#FRSKYD---3)|3|FrskyD||||||||CC2500|
|
||||
[FrskyV](Protocols_Details.md#FRSKYV---25)|25|FrskyV||||||||CC2500|
|
||||
[FrskyX](Protocols_Details.md#FRSKYX---15)|15|CH_16|CH_8|EU_16|EU_8|||||CC2500|
|
||||
[FrskyX_RX](Protocols_Details.md#FRSKYX_RX---55)|55|FCC|EU_LBT|||||CC2500|
|
||||
[FY326](Protocols_Details.md#FY326---20)|20|FY326|FY319|||||||NRF24L01|
|
||||
[GD00X](Protocols_Details.md#GD00X---47)|47|GD_V1*|GD_V2*|||||||NRF24L01|
|
||||
[GW008](Protocols_Details.md#GW008---32)|32|GW008||||||||NRF24L01|XN297
|
||||
[H8_3D](Protocols_Details.md#H8_3D---36)|36|H8_3D|H20H|H20Mini|H30Mini|||||NRF24L01|XN297
|
||||
[Hisky](Protocols_Details.md#HISKY---4)|4|Hisky|HK310|||||||NRF24L01|
|
||||
[Hitec](Protocols_Details.md#HITEC---39)|39|OPT_FW|OPT_HUB|MINIMA||||||CC2500|
|
||||
[Hontai](Protocols_Details.md#HONTAI---26)|26|HONTAI|JJRCX1|X5C1|FQ777_951|||||NRF24L01|XN297
|
||||
[Hubsan](Protocols_Details.md#HUBSAN---2)|2|H107|H301|H501||||||A7105|
|
||||
[J6Pro](Protocols_Details.md#J6Pro---22)|22|J6PRO||||||||CYRF6936|
|
||||
[KF606](Protocols_Details.md#KF606---49)|49|KF606*||||||||NRF24L01|XN297
|
||||
[KN](Protocols_Details.md#KN---9)|9|WLTOYS|FEILUN|||||||NRF24L01|
|
||||
[MJXq](Protocols_Details.md#MJXQ---18)|18|WLH08|X600|X800|H26D|E010*|H26WH|PHOENIX*||NRF24L01|XN297
|
||||
[MT99xx](Protocols_Details.md#MT99XX---17)|17|MT|H7|YZ|LS|FY805||||NRF24L01|XN297
|
||||
[NCC1701](Protocols_Details.md#NCC1701---44)|44|NCC1701||||||||NRF24L01|
|
||||
[OpenLRS](Protocols_Details.md#OpenLRS---27)|27|||||||||None|
|
||||
[Potensic](Protocols_Details.md#Potensic---51)|51|A20||||||||NRF24L01|XN297
|
||||
[Q2X2](Protocols_Details.md#Q2X2---29)|29|Q222|Q242|Q282||||||NRF24L01|
|
||||
[Q303](Protocols_Details.md#Q303---31)|31|Q303|CX35|CX10D|CX10WD|||||NRF24L01|XN297
|
||||
[Redpine](Protocols_Details.md#Redpine---50)|50|FAST|SLOW|||||||NRF24L01|
|
||||
[Scanner](Protocols_Details.md#Scanner---54)|54|||||||||CC2500|
|
||||
[SFHSS](Protocols_Details.md#SFHSS---21)|21|SFHSS||||||||CC2500|
|
||||
[Shenqi](Protocols_Details.md#Shenqi---19)|19|Shenqi||||||||NRF24L01|LT8900
|
||||
[SLT](Protocols_Details.md#SLT---11)|11|SLT_V1|SLT_V2|Q100|Q200|MR100||||NRF24L01|
|
||||
[SymaX](Protocols_Details.md#Symax---10)|10|SYMAX|SYMAX5C|||||||NRF24L01|
|
||||
[Traxxas](Protocols_Details.md#Traxxas---43)|43|RX6519||||||||CYRF6936|
|
||||
[V2x2](Protocols_Details.md#V2X2---5)|5|V2x2|JXD506|||||||NRF24L01|
|
||||
[V761](Protocols_Details.md#V761---48)|48|V761||||||||NRF24L01|XN297
|
||||
[V911S](Protocols_Details.md#V911S---46)|46|V911S*||||||||NRF24L01|XN297
|
||||
[WFly](Protocols_Details.md#WFLY---40)|40|WFLY||||||||CYRF6936|
|
||||
[WK2x01](Protocols_Details.md#WK2X01---30)|30|WK2801|WK2401|W6_5_1|W6_6_1|W6_HEL|W6_HEL_I|||CYRF6936|
|
||||
[YD717](Protocols_Details.md#YD717---8)|8|YD717|SKYWLKR|SYMAX4|XINXUN|NIHUI||||NRF24L01|
|
||||
[ZSX](Protocols_Details.md#ZSX---52)|52|280||||||||NRF24L01|XN297
|
||||
* "*" Sub Protocols designated by * suffix will use the NRF24L01 module by default to emulate the XN297L RF chip. If a CC2500 module is installed it will be used instead as it is proving to be a better option for the XN297L@250kbps. Each specific sub protocol has a more detailed explanation.
|
||||
|
||||
# A7105 RF Module
|
||||
|
||||
If USE_A7105_CH15_TUNING is enabled, the value of channel 15 is used by all A7105 protocols for tuning the frequency. This is required in rare cases where some A7105 modules and/or RXs have an inaccurate crystal oscillator.
|
||||
|
||||
## FLYSKY - *1*
|
||||
Extended limits supported
|
||||
|
||||
@@ -183,6 +188,15 @@ Note that the RX ouput will be AETR whatever the input channel order is.
|
||||
### Sub_protocol PWM_SBUS - *2*
|
||||
### Sub_protocol PPM_SBUS - *3*
|
||||
|
||||
## FLYZONE - *53*
|
||||
Models using the Flyzone FZ-410 TX: Fokker D.VII Micro EP RTF
|
||||
|
||||
Models using the old ARES TX (prior to Hitec RED): Tiger Moth
|
||||
|
||||
CH1|CH2|CH3|CH4
|
||||
---|---|---|---
|
||||
A|E|T|R
|
||||
|
||||
## HUBSAN - *2*
|
||||
|
||||
Telemetry enabled for battery voltage and TX RSSI
|
||||
@@ -328,6 +342,32 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
|
||||
---|---|---|---|---|---|---|---
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
|
||||
|
||||
## FRSKYX_RX - *55*
|
||||
The FrSkyX receiver protocol enables master/slave trainning, separate access from 2 different radios to the same model,...
|
||||
|
||||
Extended limits supported
|
||||
|
||||
Option for this protocol corresponds to fine frequency tuning.
|
||||
If the value is equal to 0, the RX will auto tune otherwise it will use the indicated value.
|
||||
This value is different for each Module and **must** be accurate otherwise the link will not be stable.
|
||||
Check the [Frequency Tuning page](/docs/Frequency_Tuning.md) to determine it.
|
||||
|
||||
Low power: enable/disable the LNA stage on the RF component to use depending on the distance with the TX.
|
||||
|
||||
### Sub_protocol FCC - *0*
|
||||
FCC protocol 8 or 16 channels.
|
||||
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14|CH15|CH16
|
||||
---|---|---|---|---|---|---|---|---|----|----|----|----|----|----|----
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14|CH15|CH16
|
||||
|
||||
### Sub_protocol EU_LBT - *1*
|
||||
EU_LBT protocol 8 or 16 channels.
|
||||
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14|CH15|CH16
|
||||
---|---|---|---|---|---|---|---|---|----|----|----|----|----|----|----
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14|CH15|CH16
|
||||
|
||||
## HITEC - *39*
|
||||
Models: OPTIMA, MINIMA and MICRO receivers.
|
||||
|
||||
@@ -369,15 +409,20 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
|
||||
---|---|---|---|---|---|---|---
|
||||
A|E|T|R|CH5|CH6|CH7|CH8
|
||||
|
||||
## Scanner - *54*
|
||||
2.4GHz scanner accessible using the OpenTX 2.3 Spectrum Analyser tool.
|
||||
|
||||
***
|
||||
# CYRF6936 RF Module
|
||||
|
||||
If USE_CYRF6936_CH15_TUNING is enabled, the value of channel 15 is used by all CYRF6936 protocols for tuning the frequency. This is required in rare cases where some CYRF6936 modules and/or RXs have an inaccurate crystal oscillator.
|
||||
|
||||
## DEVO - *7*
|
||||
Extended limits and failsafe supported
|
||||
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
|
||||
---|---|---|---|---|---|---|---
|
||||
A|E|T|R|CH5|CH6|CH7|CH8
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12
|
||||
---|---|---|---|---|---|---|---|---|---|---|---
|
||||
A|E|T|R|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12
|
||||
|
||||
Note that the RX ouput will be EATR.
|
||||
|
||||
@@ -483,16 +528,16 @@ Telemetry enabled for TSSI and plugins
|
||||
|
||||
option=number of channels from 4 to 12. An invalid option value will end up with 6 channels.
|
||||
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|----|----|CH15
|
||||
---|---|---|---|---|---|---|---|---|----|----|----|----|----|----
|
||||
A|E|T|R|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|----|----|TH_KILL
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|----|CH14
|
||||
---|---|---|---|---|---|---|---|---|----|----|----|----|----
|
||||
A|E|T|R|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|----|TH_KILL
|
||||
|
||||
Notes:
|
||||
- model/type/number of channels indicated on the RX can be different from what the RX is in fact wanting to see. So don't hesitate to test different combinations until you have something working. Using Auto is the best way to find these settings.
|
||||
- RX output will match the Spektrum standard TAER independently of the input configuration AETR, RETA...
|
||||
- RX output will match the Spektrum standard throw (1500µs +/- 400µs -> 1100..1900µs) for a 100% input. This is true for both Serial and PPM input. For PPM, make sure the end points PPM_MIN_100 and PPM_MAX_100 in _config.h are matching your TX ouput. The maximum ouput is 1000..2000µs based on an input of 125%.
|
||||
- If you want to override the above and get maximum throw (old way) uncomment in _config.h the line #define DSM_MAX_THROW . In this mode to achieve standard throw use a channel weight of 84%.
|
||||
- TH_KILL is a feature which is enabled on channel 15 by default (can be disabled/changed) in the _config.h file. Some models (X-Vert, Blade 230S...) require a special position to instant stop the motor(s). If the channel 15 is above -50% the throttle is untouched but if it is between -50% and -100%, the throttle output will be forced between -100% and -150%. For example, a value of -80% applied on channel 15 will instantly kill the motors on the X-Vert.
|
||||
- TH_KILL is a feature which is enabled on channel 14 by default (can be disabled/changed) in the _config.h file. Some models (X-Vert, Blade 230S...) require a special position to instant stop the motor(s). If the channel 15 is above -50% the throttle is untouched but if it is between -50% and -100%, the throttle output will be forced between -100% and -150%. For example, a value of -80% applied on channel 14 will instantly kill the motors on the X-Vert.
|
||||
|
||||
### Sub_protocol DSM2_22 - *0*
|
||||
DSM2, Resolution 1024, refresh rate 22ms
|
||||
@@ -515,6 +560,15 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12
|
||||
---|---|---|---|---|---|---|---|---|----|----|----
|
||||
A|E|T|R|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12
|
||||
|
||||
## Traxxas - *43*
|
||||
Receiver 6519
|
||||
|
||||
Extended limits supported
|
||||
|
||||
CH1|CH2|CH3|CH4
|
||||
---|---|---|---
|
||||
AUX3|AUX4|THROTTLE|STEERING
|
||||
|
||||
## WFLY - *40*
|
||||
Receivers: WFR04S, WFR07S, WFR09S
|
||||
|
||||
@@ -749,10 +803,16 @@ FMODE and AUX7 have 4 positions: -100%..-50%=>0, -50%..5%=>1, 5%..50%=>2, 50%..1
|
||||
|
||||
## FY326 - *20*
|
||||
|
||||
### Sub_protocol FY326 - *0*
|
||||
Model: FY326 Q7 Quadcopter
|
||||
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9
|
||||
---|---|---|---|---|---|---|---|---
|
||||
A|E|T|R|FLIP|RTH|HEADLESS|EXPERT|CALIBRATE
|
||||
|
||||
### Sub_protocol FY319 - *1*
|
||||
Model: X6 FY319 Quadcopter (Needs Testing)
|
||||
|
||||
## FQ777 - *23*
|
||||
Model: FQ777-124 (with SV7241A)
|
||||
|
||||
@@ -1180,6 +1240,15 @@ A|E|T|R|FLIP|LIGHT|PICTURE|VIDEO|HEADLESS
|
||||
### Sub_protocol NIHUI - *4*
|
||||
Same channels assignement as above.
|
||||
|
||||
## ZSX - *52*
|
||||
Model: JJRC ZSX-280
|
||||
|
||||
Autobind protocol
|
||||
|
||||
CH1|CH2|CH3|CH4|CH5
|
||||
---|---|---|---|---
|
||||
||T|R|LIGHT
|
||||
|
||||
# OpenLRS module
|
||||
|
||||
## OpenLRS - *27*
|
||||
|
||||
19
docs/Advanced_Debug.md
Normal file
19
docs/Advanced_Debug.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Enable the STM32 module serial debug feature
|
||||
|
||||
To enable serial debug on your module you must know how to buid the firmware from the source code available on this GitHub. To do so follow this page: [Compiling and programming the STM32 module](Compiling_STM32.md).
|
||||
|
||||
Procedure:
|
||||
1. Upload the debug firmware to the module:
|
||||
<img src="images/Debug1.png" />
|
||||
|
||||
iRangeX+, Banggood and old Jumper 4in1 modules|Recent Jumper 4in1 modules with built-in CP2102|FTDI
|
||||
----------------------------------------------|-----------------------------------------------|----
|
||||
Use the Debug Option: "Native USB Debugging"|Use the Debug Option: "Serial/FTDI Debugging"|Use the Debug Option: "Serial/FTDI Debugging"
|
||||
Do not disconnect the USB cable. In case you have to do it, you have to connect the module, close and reopen the Serial Monitor to get the module working otherwise the status LED will do a [Fast double blink](Troubleshooting.md).|Do not disconnect the USB cable. In case you have to do it, you have to power the TX first, then connect the USB cable to the module and relaunch the Serial monitor.|No restrictions apart from relaunching the Serial monitor if you disconnect the FTDI from the PC.
|
||||
|
||||
2. Power on the TX
|
||||
1. Open in the Arduino IDE the Serial Monitor: Tools->Serial Monitor or Ctrl+Shift+M<br> <img src="images/Serial_Monitor_1.png" />
|
||||
1. Make sure the settings at the bottom of the Serial Monitor window are the same as the picture above especially the baud rate set to 115200 baud
|
||||
1. The Serial Monitor window should show the module booting, selection of a different protocol and more depending on the protocol currently loaded<br> <img src="images/Serial_Monitor_2.png" />
|
||||
1. At this stage you can test whatever is needed or have been instructed to do. You can easily select text in the window to copy and paste it on the forum or in a text file.
|
||||
1. **Important: to use your module normally and before flying you must reupload the firmware as you usually do with the Debug Option set to "None"**
|
||||
@@ -1,11 +1,17 @@
|
||||
# Advanced Topics {This page is currently a proof of concept}
|
||||
# Advanced Topics
|
||||
Warning: the topics on this page are not for the fainthearted. It is strongly recommended that you have some experience in getting up and runnning with your module before you dive in there. On the other hand what is described on this page are some very useful options that could greatly increase the value and the enjoyment of your Multiprotocol module.
|
||||
|
||||
# Enable STM32 module serial debug
|
||||
This document describes how to enable serial debug for STM32 MULTI-modules. This can be useful in case of issues with a protocol or to reverse a protocol based on the XN297L RF component. See the [MULTI-Module Serial Debug](Advanced_Debug.md) page for more details.
|
||||
|
||||
# XN297L dump feature
|
||||
This document describes how to dump packets sent from a TX using a XN297L RF compatible component over the air on a STM32 MULTI-modules. This can be useful to get details on a protocol or even fully reverse a protocol as used in many remote controls lately. See the [MULTI-Module XN297L Dump](Advanced_XN297Ldump.md) page for more details.
|
||||
|
||||
# EEPROM Backup and Restore
|
||||
This document describes how to back up and restore the EEPROM for both Atmega328p and STM32 MULTI-modules. This can be useful if cloning a module, or to preserve settings. See the [MULTI-Module EEPROM](EEPROM.md) page for more details.
|
||||
|
||||
# Telemetry in PPM mode
|
||||
It is possible to access the telemetry stream coming from the receiver through the MULTI-module. This document describes a simple bluetooth module to stream telemetry information to a mobile device like an Android smartphone or tablet. The method may be generalized to feed telemetry to the transmitter if the transmitter has the capabilities to process the information. This is very useful with modules used in the PPM mode with transmitters that do not support telemetry. See the [Advanced Bluetooth Telemetry](Advanced_Bluetooth_Telemetry.md) page for more details.
|
||||
|
||||
# Manually setting fuses on ATmega328
|
||||
This document describes a relatively simple process to set the fuses on ATmega328. See the [Advanced Manually Setting ATmega328 Fuses](Advanced_Manually_Setting_ATmega328_Fuses.md) page for more details.
|
||||
|
||||
# EEPROM Backup and Restore
|
||||
This document describes how to back up and restore the EEPROM for both Atmega328p and STM32 MULTI-modules. This can be useful if cloning a module, or to preserve settings. See the [MULTI-Module EEPROM](EEPROM.md) page for more details.
|
||||
|
||||
16
docs/Advanced_XN297Ldump.md
Normal file
16
docs/Advanced_XN297Ldump.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# XN297L dump feature
|
||||
|
||||
To get the XN297L dump feature working on your module you must know:
|
||||
1. How to buid the firmware from the source code available on this GitHub. To do so follow this page: [Compiling and programming the STM32 module](Compiling_STM32.md).
|
||||
1. How to enable serial debug [MULTI-Module Serial Debug](Advanced_Debug.md).
|
||||
|
||||
Procedure to use the XN297L dump feature:
|
||||
1. Start the Multi module in serial debug mode with the Arduion IDE Serial Monitor open<br> <img src="images/Serial_Monitor_2.png" />
|
||||
1. Select the protocol 63 or "Custom 63" to enable the XN297L Dump protocol
|
||||
1. This protocol parameters are:
|
||||
* sub_protocol or type or the second number after "Custom 63" is used to set the transmission speed: 0=250Kbps, 1=1Mbps and 2=2Mbps. Any other value will default to 1Mbps.
|
||||
* RX_num or Receiver number sets the address length 3, 4 or 5 bytes. Any other value will default to an address length of 5 bytes.
|
||||
* option sets the RF channel number used to receive packets between 0..84 . A value of -1 will automatically scan all channels one by one. Any other value will default to the RF channel 0.
|
||||
|
||||
Examples:
|
||||
TBC
|
||||
@@ -40,6 +40,54 @@ The board definitions are installed using the Arduino IDE Boards Manager.
|
||||
* **Multi 4-in-1 (Atmega328p, 3.3V, 16MHz)** for the Atmega module
|
||||
* **Multi 4-in-1 (OrangeRX)** for the OrangeRX module
|
||||
|
||||
## Install device drivers
|
||||
|
||||
### Windows 7 or newer:
|
||||
1. If you haven't already done so, clone or download and unpack the Multiprocol source
|
||||
1. Open the folder where you unzipped or cloned the Multiprotocol project
|
||||
1. Browse to **\BootLoaders\Boards\Windows**
|
||||
1. Run **install-drivers.bat**
|
||||
1. Follow the prompts to install the two drivers
|
||||
|
||||
### Windows XP or older
|
||||
1. Download and install the legacy Windows XP drivers from [here](https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/master/drivers/win/win_xp_legacy)
|
||||
|
||||
**NOTE:** If you have installed the drivers and your module is not detected as a Maple device it most likely does not have a USB bootloader installed. Ready-made modules from Banggood **do not** come with a USB bootloader installed. You will need to follow the procedure to upload using a USB-to-serial adapter one time before you can upload firmware using the USB port.
|
||||
|
||||
### Jumper JP4IN1 drivers
|
||||
The driver for the Jumper JP4IN1 module, the Silicon Labs CP210x driver, can be downloaded from here: https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
|
||||
|
||||
### Other USB-to-serial device drivers
|
||||
Other drivers may be needed if you are using an external USB-to-serial adapter. Consult the documentation for your adapter.
|
||||
|
||||
Windows 10 includes drivers for many common serial devices, including many USB-to-serial adapters, so check Device Manager to see if your device is recognised.
|
||||
|
||||
### Mac OS X
|
||||
Uploading via USB requires the [libusb library](https://libusb.info/) to be installed. The easiest way to install the library is using the [Homebrew package manager for macOS](https://brew.sh/) by executing the two lines given below in a Terminal.
|
||||
|
||||
Install Homebrew:
|
||||
|
||||
`/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
|
||||
|
||||
Once Homebrew is installed, use it to install libusb:
|
||||
|
||||
`brew install libusb`
|
||||
|
||||
### Linux
|
||||
Permissions must be configured to allow access to serial devices.
|
||||
1. If you haven't already done so, clone or download and unpack the Multiprocol source
|
||||
1. Open a Terminal and change to the directory where you have cloned or unzipped the Multiprotocol source
|
||||
1. Run the following commands:
|
||||
|
||||
```
|
||||
sudo cp -v BootLoaders/Boards/Linux/45-maple.rules /etc/udev/rules.d/45-maple.rules
|
||||
sudo chown root:root /etc/udev/rules.d/45-maple.rules
|
||||
sudo chmod 644 /etc/udev/rules.d/45-maple.rules
|
||||
sudo udevadm control --reload-rules
|
||||
sudo usermod -a -G plugdev $USER
|
||||
sudo usermod -a -G dialout $USER
|
||||
```
|
||||
|
||||
## Compiling and Uploading
|
||||
Refer to the hardware-specific pages for information on compiling the firmware and uploading it to the multiprotocol module:
|
||||
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
# Flashing, Compiling and Programming (STM32)
|
||||
# Compiling and Flashing (STM32)
|
||||
|
||||
Multiprotocol firmware can be either flashed with a precompiled binary or compile/upload your customized firmware using the Arduino IDE. The guide below will walk you through all the steps in many details, don't be afraid by the length it is in fact simple!
|
||||
Multiprotocol modules can be flashed with a precompiled firmware file (Option 1 and 2) or you can compile and upload your customized firmware using the Arduino IDE (Option 3).
|
||||
|
||||
**These instructions are for the STM32 version of the Multiprotocol module.** If you are Compling for the Arduino ATmega328p version of the Multiprotocol Module please go to the dedicated [ATmega328](Compiling.md) page.
|
||||
|
||||
## Index
|
||||
1. [Tools Required](#tools-required)
|
||||
1. [Precompiled Binaries](#flashing-pre-compiled-binaries)
|
||||
1. [Preparation](#preparation)
|
||||
1. [Option 1 - Update firmware using precompiled binaries](#option-1---update-firmware-using-precompiled-binaries)
|
||||
1. [Option 2 - Flash from TX](#option-2---flash-from-tx)
|
||||
1. [Option 3 - Compiling and updating firmware](#option-3---compiling-and-updating-firmware)
|
||||
1. [Preparation](#preparation)
|
||||
1. [Install the Arduino IDE](#install-the-arduino-ide)
|
||||
1. [Download the Multiprotocol source and open the project](#download-the-multiprotocol-source-and-open-the-project)
|
||||
1. [Install the Multi 4-in-1 board](#install-the-multi-4-in-1-board)
|
||||
1. [Configure the Arduino IDE](#configure-the-arduino-ide)
|
||||
1. [Configure the firmware](#configure-the-firmware)
|
||||
1. [Verify the firmware](#verify-the-firmware)
|
||||
1. [Preparing to upload the firmware](#preparing-to-upload-the-firmware)
|
||||
1. [Select an upload method](#select-an-upload-method)
|
||||
1. [Upload via Serial inc. Bootloader (FTDI)](#upload-via-serial-inc-bootloader-ftdi)
|
||||
1. [Flash from TX](#flash-from-tx)
|
||||
1. [Upload via USB](#upload-via-usb)
|
||||
1. [Install the Maple USB Drivers](#install-the-maple-usb-drivers)
|
||||
1. [Configure the firmware](#configure-the-firmware)
|
||||
1. [Verify the firmware](#verify-the-firmware)
|
||||
1. [Connect the module](#connect-the-module)
|
||||
1. [USB Port](#usb-port)
|
||||
1. [USB-to-Serial adapter](#usb-to-serial-adapter)
|
||||
1. [Upload the firmware](#upload-the-firmware)
|
||||
1. [Troubleshooting](#troubleshooting)
|
||||
|
||||
@@ -27,7 +26,7 @@ Multiprotocol firmware can be either flashed with a precompiled binary or compil
|
||||
|
||||
Tools are only required if a multi module does not have a USB port, a working bootloader or an integrated FTDI adapter:
|
||||
* The latest iRangeX IRX4+ modules most likely already have the USB Bootloader flashed on it. You therefore don't need the FTDI adapter below and don't need to open your module to flash it.
|
||||
* The latest jumper modules have an integrated FTDI appearing as a CP2102 device on the computer. You therefore don't need the FTDI adapter below and don't need to open your module to flash it.
|
||||
* The latest Jumper modules have an integrated FTDI appearing as a CP2102 device on the computer. You therefore don't need the FTDI adapter below and don't need to open your module to flash it.
|
||||
* The Vantac MPM Lite module already has the USB Bootloader flashed on it. You therefore don't need the FTDI adapter below and don't need to open your module to flash it. **Modules' bootloader however might not be booting everytime depending on the radio, if this is the case you need to upgrade it.**
|
||||
|
||||
You are still unsure if your module can be flashed without tools or opening it? Here is how to quickly check:
|
||||
@@ -53,10 +52,14 @@ The 4-pin header needs to be soldered onto the board as indicated by the red rec
|
||||
|
||||
**Note:** The Banggood STM32 module most likely already has the header pin in place.
|
||||
|
||||
## Flashing pre-compiled binaries
|
||||
## Option 1 - Update Firmware using Precompiled Binaries
|
||||
If you don't need/want to customize the multi module firmware then you can use pre-compiled binaries available [here](https://github.com/pascallanger/DIY-Multiprotocol-TX-Module/releases).
|
||||
- **Multiprotocol_V1.X.X_STM32.bin** files are for radios with support for hardware telemetry inversion, such as Turnigy 9X, 9XR, 9X+.
|
||||
- **Multiprotocol_V1.X.X_STM32_INV.bin** files are for radios which require inverted telemetry for the external module firmware, such as Turnigy 9XR Pro, FrSky radios and Jumper radios.
|
||||
|
||||
**STM32 Builds (file names beginning with 'Multi-STM_')**
|
||||
- All radio modules and protocols are included in all builds
|
||||
- Files with TXFLASH in the name are built with a bootloader for flashing from a transmitter OR via the module's USB port (eg. Multi-STM_TXFLASH_INV-vX.X.X.XX.bin)
|
||||
- Files with FTDI in the name are built without a bootloader for flashing using an FTDI adapter (eg. Multi-STM_FTDI_INV-vX.X.X.XX.bin)
|
||||
- OpenTx/JumperTX version (files with OPENTX in the name) have the MULTI_TELEMETRY parameter enabled (eg. Multi-STM_TXFLASH_INV_OPENTX-vX.X.X.XX.bin or Multi-STM_FTDI_INV_OPENTX-vvX.X.X.XX.bin)
|
||||
|
||||
[Flash-Multi](https://github.com/benlye/flash-multi) is the recommended Windows utility for flashing pre-compiled firmware to any STM32-based Multiprotocol TX module. Firmware upload can be performed using the built-in USB connection or via an external FTDI adapter.
|
||||
|
||||
@@ -64,9 +67,21 @@ If you don't need/want to customize the multi module firmware then you can use p
|
||||
<img src="https://github.com/benlye/flash-multi/raw/master/img/flash-multi.jpg">
|
||||
</p>
|
||||
|
||||
## Preparation
|
||||
After a succesful flash your Module is now updated to the newer version firmware using the most common options. To change specific configured options you would need to use [Option-3](#option-3---compiling-and-updating-firmware), Compile using Arduino IDE and your desired upload method.
|
||||
|
||||
## Option 2 - Flash from TX
|
||||
1. If you don't need/want to customize the multi module firmware then you can use pre-compiled binaries available [here](https://github.com/pascallanger/DIY-Multiprotocol-TX-Module/releases).
|
||||
2. If you are compiling the firmware yourself in the Arduino environment with [Option-3](#option-3---compiling-and-updating-firmware), do the following to export the binary:
|
||||
- Click **Sketch -> Export compiled Binary**, or press **Ctrl+Alt+S**
|
||||
- Locate the file named **multi-stm-x.x.x.x.bin** in the **Multiprotocol source folder** folder (x.x.x.x is the multi version)
|
||||
3. Follow the instructions [here](/docs/Flash_from_Tx.md) to upload the firmware using your radio
|
||||
|
||||
## Option 3 - Compiling and Updating Firmware
|
||||
### Preparation
|
||||
Multiprotocol firmware can be compiled and flashed with your customized firmware using the Arduino IDE. The guide below will walk you through all the steps in many details, don't be afraid by the length it is in fact simple!
|
||||
|
||||
### Install the Arduino IDE
|
||||
1. Download and install the Arduino IDE. The currently supported Arduino version is 1.8.5, available for [Windows]( https://www.arduino.cc/download_handler.php?f=/arduino-1.8.5-windows.exe), [Mac OSX](https://www.arduino.cc/download_handler.php?f=/arduino-1.8.5-macosx.zip) and [Linux (64-bit)](https://www.arduino.cc/download_handler.php?f=/arduino-1.8.5-linux64.tar.xz)
|
||||
1. Download and install the Arduino IDE. The currently supported Arduino version is 1.8.9, available for [Windows]( https://www.arduino.cc/download_handler.php?f=/arduino-1.8.9-windows.exe), [Mac OSX](https://www.arduino.cc/download_handler.php?f=/arduino-1.8.9-macosx.zip) and [Linux (64-bit)](https://www.arduino.cc/download_handler.php?f=/arduino-1.8.9-linux64.tar.xz)
|
||||
1. It is recommended to upgrade Java to the [latest version](https://www.java.com/en/download/)
|
||||
|
||||
### Download the Multiprotocol source and open the project
|
||||
@@ -75,24 +90,24 @@ If you don't need/want to customize the multi module firmware then you can use p
|
||||
1. Clone the project using Git or Github Desktop, then
|
||||
1. Double-click the **Multiprotocol.ino** file in the **Multiprotocol** folder to open the project in the Arduino IDE
|
||||
|
||||
**Important note for Windows users:** You must download or unzip the Multiprotocol source in a folder which has no spaces in the path. If you have spaces in your username **do not** use a sub-folder of your user directory. This is due to a [bug in the Arduino IDE](https://github.com/arduino/arduino-builder/issues/316), caused by an [issue in Go](https://github.com/golang/go/issues/17149).
|
||||
|
||||
### Install the Multi 4-in-1 board
|
||||
1. Follow [these instructions](Arduino_IDE_Boards.md) to install the **Multi 4-in-1 STM32 Board** in the Arduino IDE
|
||||
|
||||
### Configure the Arduino IDE
|
||||
1. Under **Tools -> Board** select **Multi 4-in-1 (STM32FC103)**
|
||||
1. Under **Tools -> Upload method** select **Auto Detect (USB or Serial)** <- more details on this subject later on
|
||||
1. Under **Tools -> Programmer** select **stm32flash (FTDI)**
|
||||
1. Under **Tools -> Debug Option** select **None**
|
||||
|
||||
### Configure the firmware
|
||||
Make any changes you require to the firmware.
|
||||
|
||||
## Configure the firmware
|
||||
The STM32 module has more than enough flash space for all the available protocols so, unlike the Atmega328p-based module, it is not necessary to disable unused protocols.
|
||||
|
||||
You can still disable protocols if you wish, and you may also enable or disable other optional Multiprotocol features.
|
||||
## Verify the firmware
|
||||
|
||||
### Verify the firmware
|
||||
To check that the program will compile correctly and fit in the STM32 click **Sketch -> Verify/Compile**, or press **Ctrl+R**.
|
||||
|
||||
If there are errors, carefully read it, go to the line number indicated and correct your typo.
|
||||
If there are errors, carefully read it, go to the line number indicated and correct your typo.
|
||||
|
||||
If there are no errors and you see output like this:
|
||||
```
|
||||
@@ -101,29 +116,16 @@ Global variables use 4064 bytes (19%) of dynamic memory, leaving 16416 bytes for
|
||||
```
|
||||
You can proceed to the next step.
|
||||
|
||||
## Preparing to upload the firmware
|
||||
If you have already burnt the bootloader, and are simply recompiling firmware to re-flash using your TX or USB cable, you can skip this step and go straight to [Flash from TX](#flash-from-tx) or [Upload via USB](#upload-via-usb).
|
||||
### Connect the module
|
||||
#### USB port
|
||||
Ensure that you [installed the necessary drivers](https://github.com/benlye/DIY-Multiprotocol-TX-Module/blob/doc-updates/docs/Arduino_IDE_Boards.md#install-device-drivers).
|
||||
|
||||
STM modules, until now, do not come with a preloaded bootloader which makes the USB port unusable and discovered by a computer as unknown device. **For the first time use, you must use the upload method Upload via Serial inc. Bootloader (FTDI)** independently of what method you wish to use in future.
|
||||
If your Multiprotocol module has a USB port, connect it to the computer. With the drivers installed your computer should detect the module as a COM port. If the device appears correctly (check in **Device Manager**) you can proceed to the next step and [upload the firmware](#upload-the-firmware). If not, you will need to flash your module one time using a USB-to-serial adapter (also known as an FTDI adapter).
|
||||
|
||||
The latest Jumper 4-in-1 modules come with a USB port but it's in fact a built in FTDI appearing on the computer as a CP2102 serial device. You should use the method **Upload via Serial inc. Bootloader** instead of Upload via USB. 'Flash from TX' is supported once the bootloader is installed.
|
||||
**Note:** Some modules require external power in order for the USB port to work. If your module does not power on with USB power alone, install it in the transmitter and switch the transmitter on. It is generally safe for the module to recieve power from both USB and the transmitter.
|
||||
|
||||
### Select an Upload Method
|
||||
There are a total of five firmware upload methods to an STM32 module:
|
||||
* **Flash from TX** - uses the bootloader mode of radios running ersky9x or OpenTX to upload the firmware. The radio needs to run the latest bootloader with the Multi Flash app.
|
||||
* **Auto Detect (USB or Serial)** - Detects automatically if the upload method is USB or Serial. You need to configure the correct COM port in the IDE which is created when plugging the module.
|
||||
* **Upload via USB** - uses the USB upload method through the USB plug of the module. It requires the presence of a bootloader in the module.
|
||||
* **Upload via Serial inc. Bootloader (FTDI)** - uses the serial interface of the module via a USB-to-TTL adapter to install the bootloader and firmware.
|
||||
* **Upload via Serial (FTDI)** - uses the serial interface of the module via a USB-to-TTL adapter to install the firmware.
|
||||
|
||||
You will most likely use only once on a brand new module the **Upload via Serial inc. Bootloader (FTDI)** method to load the bootloader+firmware. Any successive updates will be done using either **Auto Detect (USB or Serial)** or **Flash from TX** depending on your preference.
|
||||
|
||||
1. Under **Tools -> Upload Method** select an upload method
|
||||
|
||||
The rest of this process will vary depending on the upload method you selected.
|
||||
|
||||
## Upload via Serial inc. Bootloader (FTDI)
|
||||
It is **strongly** recommended that you power your module from the transmitter when flashing it. This ensures that the module cannot be inadvertently supplied with 5V, which will damage the RF modules. This guide assumes that you will follow that advice, and instructs you to leave the V+ pin on the USB-to-TTL adapter disconnected. You may choose to ignore that advice at your own risk!
|
||||
#### USB-to-Serial adapter
|
||||
It is **strongly** recommended that you power your module from the transmitter when flashing it using a USB-to-serial adapater. This ensures that the module cannot be inadvertently supplied with 5V, which will damage the RF modules. This guide assumes that you will follow that advice, and instructs you to leave the V+ pin on the USB-to-TTL adapter disconnected. You may choose to ignore that advice at your own risk!
|
||||
|
||||
The wiring for the USB-to-TTL adapter is:
|
||||
* USB-to-TTL TX pin <-> Module RX pin
|
||||
@@ -149,151 +151,14 @@ In order to flash the bootloader the **BOOT0** jumper must be installed connecti
|
||||
| Bridge pins 1 and 2 as shown by the yellow jumper wire. | Bridge the left-most pins of the 6-pin header as shown by the yellow jumper. | Bridge pins 1 and 2 as shown by the blue jumper. | Bridge the BOOT0 pin to the adjacent 3.3V pin as shown by the yellow jumper. If it doesn't work move the jumper to bridge the two left hand pins (BOOT0 and directly above). | Bridge pins 1 and 2 as shown by the red jumper wire. | Brdige the two pins next to the usb port labelled with Boot0 |
|
||||
| <img src="images/diy-ch340g.jpg" height="200"/> | <img src="images/bg-stm32-boot0.jpg" height="200"/> | <img src="images/irx4-boot0.jpg" height="200"/> | <img src="images/irx4plus-boot0.jpg" height="200"/> | <img src="images/Jumper-ch340g.jpg" height="200"/> | <img src="images/mpmlite-boot0.jpg" width="200" /> |
|
||||
|
||||
1. If on Linux, ensure you have permissions to access serial interfaces as described in [Install the Maple USB drivers](#install-the-maple-usb-drivers)
|
||||
1. If on Linux, ensure you have permissions to access serial interfaces as described [here](https://github.com/benlye/DIY-Multiprotocol-TX-Module/blob/doc-updates/docs/Arduino_IDE_Boards.md#linux)
|
||||
1. Install the **BOOT0** jumper as described above.
|
||||
1. Switch on the transmitter
|
||||
1. Verify that you have selected the upload method **Upload via Serial inc. Bootloader (FTDI)** under **Tools -> Upload Method**
|
||||
1. Verify that you have selected **stm32flash (FTDI)** as the programmer under **Tools -> Programmer**
|
||||
1. Verify that the USB-to-TTL adapter is correctly connected to your module and you have selected the correct port under **Tools -> Port**
|
||||
1. In the Arduino IDE click **Sketch -> Upload**, or press **Ctrl+U**
|
||||
|
||||
Output will look similar to this:
|
||||
```
|
||||
C:\Users\blye\AppData\Local\Arduino15\packages\multi4in1\hardware\STM32F1\1.0.0/tools/win/serial_upload.bat COM4 0x0 C:\Users\blye\AppData\Local\Arduino15\packages\multi4in1\hardware\STM32F1\1.0.0/bootloaders/Multi4in1/StmMultiUSB.bin
|
||||
stm32flash -v -g 0x0 -b 57600 -w C:\Users\blye\AppData\Local\Arduino15\packages\multi4in1\hardware\STM32F1\1.0.0\bootloaders\Multi4in1\StmMultiUSB.bin COM4
|
||||
|
||||
stm32flash 0.4
|
||||
|
||||
http://stm32flash.googlecode.com/
|
||||
|
||||
Using Parser : Raw BINARY
|
||||
Interface serial_w32: 57600 8E1
|
||||
Version : 0x22
|
||||
Option 1 : 0x00
|
||||
Option 2 : 0x00
|
||||
Device ID : 0x0410 (Medium-density)
|
||||
- RAM : 20KiB (512b reserved by bootloader)
|
||||
- Flash : 128KiB (sector size: 4x1024)
|
||||
- Option RAM : 16b
|
||||
- System RAM : 2KiB
|
||||
Write to memory
|
||||
Erasing memory
|
||||
|
||||
Wrote and verified address 0x08000100 (3.56%)
|
||||
Wrote and verified address 0x08000200 (7.13%)
|
||||
...
|
||||
Wrote and verified address 0x08001c00 (99.78%)
|
||||
Wrote and verified address 0x08001c10 (100.00%) Done.
|
||||
|
||||
Starting execution at address 0x08000000... done.
|
||||
```
|
||||
Assuming the process is successful:
|
||||
1. Power off the transmitter
|
||||
1. Remove the **BOOT0** jumper
|
||||
1. Disconnect the USB-to-TTL adapter
|
||||
1. Your module is ready to use, enjoy!!!
|
||||
|
||||
## Flash from TX
|
||||
1. The MPM module must have a recent bootloader installed
|
||||
1. Click **Tools -> Upload method -> Flash from TX**
|
||||
1. Click **Sketch -> Export compiled Binary**, or press **Ctrl+Alt+S**
|
||||
1. Locate the file named **multi-stm-x.x.x.x.bin** in the **Multiprotocol source folder** folder (x.x.x.x is the multi version)
|
||||
1. Follow the instructions [here](/docs/Flash_from_Tx.md) to upload the firmware using your radio
|
||||
1. Once done your module is ready to be used
|
||||
|
||||
## Upload via USB
|
||||
In order for the module to be correctly identified it is necessary and only once to do some operations based on your operating system.
|
||||
|
||||
### Install the Maple USB drivers
|
||||
##### Windows 7 or newer:
|
||||
1. Open the folder where you unzipped or cloned the Multiprotocol project
|
||||
1. Browse to **\BootLoaders\Boards\Windows**
|
||||
1. Run **install-drivers.bat**
|
||||
1. Follow the prompts to install the two drivers
|
||||
|
||||
##### Windows XP or older
|
||||
1. Download and install the legacy Windows XP drivers from [here](https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/master/drivers/win/win_xp_legacy)
|
||||
|
||||
**NOTE:** If you have installed the drivers and your module is not detected as a Maple device it most likely does not have a USB bootloader installed. Ready-made modules from Banggood **do not** come with a USB bootloader installed. You will need to follow the procedure to [Burn a USB bootloader](#upload-via-serial-inc-bootloader-ftdi) before you can upload firmware.
|
||||
|
||||
##### Mac OS X
|
||||
Uploading via USB requires the [libusb library](https://libusb.info/) to be installed. The easiest way to install the library is using the [Homebrew package manager for macOS](https://brew.sh/) by executing the two lines given below in a Terminal.
|
||||
|
||||
Install Homebrew:
|
||||
|
||||
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
|
||||
Once Homebrew is installed, use it to install libusb:
|
||||
|
||||
brew install libusb
|
||||
|
||||
##### Linux (64-bit)
|
||||
To execute any of the following commands you should use a Terminal (shell) with the current directory set to the location where you cloned or unpacked this project.
|
||||
|
||||
You can do this by navigating to the project folder in the Files application then right clicking and selecting "Open in Terminal" from the menu that appears. This will open a Terminal where you will enter the commands indicated below.
|
||||
|
||||
If you are using Ubuntu 16.04 LTS it is not necessary to download Maple USB drivers but your account must have permissions to communicate to the Maple USB system devices. To do this you must be in the group which can access USB devices and/or serial interfaces. This configuration must be done once after account creation/system install. You can do that by entering the following commands:
|
||||
|
||||
sudo usermod -a -G plugdev $USER
|
||||
sudo usermod -a -G dialout $USER
|
||||
|
||||
Any sudo operation requires administrator privileges and if your account is an administrator account (and it will be if you installed Ubuntu yourself) it will ask for your password.
|
||||
|
||||
After entering these commands you must log out of Ubuntu completely and log back in. Simply closing the Terminal window and opening another will not work.
|
||||
|
||||
The first command adds your user account to the group which can access connected USB devices. The second adds your account to the group which can access serial interfaces.
|
||||
|
||||
The next steps will change your system's permissions rules so that users in the plugdev group can access attached USB devices.
|
||||
|
||||
If necessary, open another Terminal window with the current directory set to the project directory as explained above. Then type the following commands into the Terminal:
|
||||
|
||||
sudo cp BootLoaders/Boards/Linux/45-maple.rules /etc/udev/rules.d/
|
||||
sudo /etc/init.d/udev restart
|
||||
|
||||
After adding yourself to the groups as above and installing and running the udev rules above your system will be configured so that your user account will always have access to serial and USB devices without requiring you run these steps again.
|
||||
|
||||
### Upload the firmware
|
||||
**Note:** Some modules require external power in order for the USB port to work. If your module does not power on with USB power alone, install it in the transmitter and switch the transmitter on. It is generally safe for the module to recieve power from both USB and the transmitter.
|
||||
|
||||
1. Connect the USB cable to the Multiprotocol module
|
||||
1. Click **Tools -> Upload method -> Auto Detect (USB or Serial)**
|
||||
1. Select the correct COM port **Tools -> Port**, which should be labelled **COMx (Multi 4-in-1 (STM32F103CB))**.<p align="center"><img src="images/maple-serial-port-select.jpg"/></p>
|
||||
1. In the Arduino IDE click **Sketch -> Upload**, or press **Ctrl+U**
|
||||
|
||||
**Note:** If the module appears as a **Maple DFU** for a module with only a bootloader, **Maple Serial** for a module with a bootloader and firmware then follow the same process by selecting any available COM port (you must select one, if you don't have one appearing plug any device that will create a com port (an Arduino board for example)).
|
||||
|
||||
You should see output similar to this:
|
||||
```
|
||||
Sketch uses 68564 bytes (52%) of program storage space. Maximum is 131072 bytes.
|
||||
Global variables use 4064 bytes (19%) of dynamic memory, leaving 16416 bytes for local variables. Maximum is 20480 bytes.
|
||||
C:\Users\blye\AppData\Local\Arduino15\packages\multi4in1\hardware\STM32F1\1.0.0/tools/win/maple_upload.bat COM4 2 1EAF:0003 C:\Users\blye\AppData\Local\Temp\arduino_build_933551/Multiprotocol.ino.bin
|
||||
maple_loader v0.1
|
||||
Resetting to bootloader via DTR pulse
|
||||
Reset via USB Serial Failed! Did you select the right serial port?
|
||||
Searching for DFU device [1EAF:0003]...
|
||||
Assuming the board is in perpetual bootloader mode and continuing to attempt dfu programming...
|
||||
|
||||
Found it!
|
||||
|
||||
Opening USB Device 0x1eaf:0x0003...
|
||||
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=2, name="STM32duino bootloader v1.0 Upload to Flash 0x8002000"
|
||||
Setting Configuration 1...
|
||||
Claiming USB DFU Interface...
|
||||
Setting Alternate Setting ...
|
||||
Determining device status: state = dfuIDLE, status = 0
|
||||
dfuIDLE, continuing
|
||||
Transfer Size = 0x0400
|
||||
bytes_per_hash=1371
|
||||
Starting download: [##################################################] finished!
|
||||
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
|
||||
Done!
|
||||
Resetting USB to switch back to runtime mode
|
||||
error resetting after download: usb_reset: could not reset device, win error: The system cannot find the file specified.
|
||||
```
|
||||
|
||||
**Note:** The line `Reset via USB Serial Failed! Did you select the right serial port?` or a warning line stating that the device could not be reset is **not a problem**.
|
||||
|
||||
## Troubleshooting
|
||||
# Troubleshooting
|
||||
You can report your problem using the [GitHub issue](https://github.com/midelic/DIY-Multiprotocol-TX-Module/issues) system or go to the [Main thread on RCGROUPS](http://www.rcgroups.com/forums/showthread.php?t=2165676) to ask your question.
|
||||
Please provide the following information:
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Flashing from the Transmitter
|
||||
|
||||
For radios running ersky9x and OpenTX, there is an option to flash a precompiled firmware file to the multiprotocol module using the transmitter's Bootloader mode.
|
||||
For radios running erskyTx and OpenTX, there is an option to flash a precompiled firmware file to the multiprotocol module using the transmitter's Bootloader mode.
|
||||
|
||||
## Tools required
|
||||
* A compatible transmitter running an ersky9x bootloader v2.9 or newer. This is true for both OpenTX and ersky9x.
|
||||
* A compatible transmitter running an erskyTx bootloader v2.9 or newer. This is true for both OpenTX and erskyTx.
|
||||
* A precompiled multiprotocol firmware file (.hex for Atmega328p or .bin for STM32)
|
||||
* A **Flash from TX** bootloader installed on an Atmega328p or STM32 multiprotocol module
|
||||
* A means to get the firmware file onto the transmitter's SD card
|
||||
@@ -18,11 +18,11 @@ For radios running ersky9x and OpenTX, there is an option to flash a precompiled
|
||||
1. If everything is correct you are ready to upgrade the Multimodule firmware
|
||||
|
||||
### Upgrade the bootloader and install app(s)
|
||||
1. Download the latest zip file of the [ersky9x firmware](https://openrcforums.com/forum/viewtopic.php?f=7&t=4676)
|
||||
1. Download the latest zip file of the [erskyTx firmware](https://openrcforums.com/forum/viewtopic.php?f=7&t=4676) or [this file for the T16](http://www.er9x.com/t16BootFlashMulti.zip).
|
||||
1. Extract the .bin file corresponding to your radio in your SD card `\FIRMWARE` directory
|
||||
1. Download the latest [Flash Multiprotocol Module app](http://www.er9x.com/Ersky9xapps.html) for your radio
|
||||
1. Download the latest [Flash Multiprotocol Module app](http://www.er9x.com/Ersky9xapps.html) for your radio. For the T16, it's in the previous file.
|
||||
1. Copy the .app file in a folder called `APPS` at the root of the SD card (if the directory does not exist create it)
|
||||
1. For ersky9x
|
||||
1. For erskyTx
|
||||
1. Power on the radio in `MAINTENANCE` mode while pushing both horizontals trims outwards (away from each others)
|
||||
1. Select `Update Bootloader`
|
||||
1. Select the ersky9x firmware matching your radio
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
- **_Fast blink(on=0.1s,off=0.1s)_**: bind in progress
|
||||
- **_Slow blink(on=0.5s,off=0.5s)_**: serial has been selected but no valid signal is being seen on the RX pin.
|
||||
- **_Slower blink(on=1s,off=1s)_**: PPM has been selected but no valid signal is being seen on the PPM pin.
|
||||
- **_Fast double blink(on=0.1s,off=0.1s,on=0.1s,off=0.5s)_**: serial debugging is enabled and is waiting for a serial connection
|
||||
- **_On_**: Module is in normal operation mode (transmitting control signals).
|
||||
|
||||
## Protocol selection
|
||||
|
||||
BIN
docs/images/Debug1.png
Normal file
BIN
docs/images/Debug1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
docs/images/Serial_Monitor_1.png
Normal file
BIN
docs/images/Serial_Monitor_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
BIN
docs/images/Serial_Monitor_2.png
Normal file
BIN
docs/images/Serial_Monitor_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.7 KiB |
Reference in New Issue
Block a user