Compare commits

...

32 Commits

Author SHA1 Message Date
pascallanger
e783ce5788 Failsafe modification
The following protocols are supporting failsafe: FrSkyX, Devo, WK2x01, SFHSS, HISKY/HK310 and AFHDS2A
In Serial mode failsafe is configured on the radio itself.
In PPM mode and only after the module is up and fully operational, press the bind button for at least 5sec to send the current stick positions as failsafe to the RX.
2019-09-27 16:20:43 +02:00
pascallanger
18af4a0724 AVR modules: Fix KF606, GD00X and Potensic 2019-09-26 15:51:28 +02:00
pascallanger
7e6ec1dc8d Update FrSkyX_Rx_cc2500.ino
Remove compilation warnings for AVR
2019-09-26 15:50:38 +02:00
pascallanger
4fbe0859e0 Update comments 2019-09-25 19:10:55 +02:00
pascallanger
b89c23fe7c PPM channel remapping 2019-09-23 18:13:25 +02:00
goebish
e038c49ae9 Protocol FrskyX D16 RX frequency auto-tune (#270)
* Add autotune during bind

* Fix data phase
2019-09-23 08:11:06 +02:00
Ben Lye
bed02c9384 Update .travis.yml (#269) 2019-09-22 14:17:23 -04:00
pascallanger
96bc4f7cdf Revert Fix FrskyX failsafe hold/no pulse inversion 2019-09-22 20:00:04 +02:00
pascallanger
6503469ddd Bump multi board version to the latest 2019-09-22 17:29:43 +02:00
pascallanger
61a1c3742c Fix FrskyX failsafe hold/no pulse inversion 2019-09-22 17:12:00 +02:00
pascallanger
1fb2a38bc1 Hitec additional telemetry 2019-09-22 17:11:23 +02:00
pascallanger
22a0d79315 FrskyX_RX documentation 2019-09-22 17:05:46 +02:00
MRC3742
0cc72772a3 Repair sub protocol column listing errors for two Protocol (#268) 2019-09-19 20:13:13 +02:00
Pascal Langer
11f4e636e3 AFHDS2A telemetry fix
Discard RX config packets
2019-09-19 10:51:24 +02:00
pascallanger
fef1a2e041 Update Advanced_Debug.md 2019-09-19 09:07:14 +02:00
pascallanger
41a9c8e013 Update Advanced_Debug.md 2019-09-19 08:59:40 +02:00
Pascal Langer
c1ad02b792 Create Debug1.png 2019-09-19 08:55:20 +02:00
Pascal Langer
ab2315c951 FrSkyX: few cosmetic and optimization changes 2019-09-18 11:05:46 +02:00
goebish
7948e33cbc Fix start channel (#267) 2019-09-18 08:48:04 +02:00
goebish
2be2dce584 Protocol FrSky D16 receiver (#266)
* Add skeleton for FrSkyX receiver protocol

* Binds & receives data packets

* Store bind information

* Fix compilation

* Bypass LNA since intended usage implies tx & rx are close together

* Bind channel has FS_AUTOCAL

* Add freq fine tune & low power mode (disable lna)

* Add TX ID check

* Retry longer until first packet is catched

* Fix chanskip for first packet

* Fix defines

* Fix bind

* Send channels to TX

* Fix RSSI reading

* Add missing static keyword

* Fix Validate.h

* Fix compilation
2019-09-17 23:35:19 +02:00
Ben Lye
69bdfe3dba Update package_multi_4in1_board_index.json 2019-09-17 20:36:24 +01:00
Pascal Langer
d73d163a58 Update Validate.h 2019-09-17 09:53:18 +02:00
Ben Lye
48a52ae5b2 Update Multiprotocol.ino (#265) 2019-09-17 09:37:18 +02:00
Pascal Langer
078dc2ab17 AFHDS2A telemetry AA and AC 2019-09-14 16:34:19 +02:00
Pascal Langer
6f4522caa6 Revert "AFHDS2A telemetry AA and AC"
This reverts commit 3c76ce9f39.
2019-09-14 16:31:27 +02:00
Pascal Langer
3c76ce9f39 AFHDS2A telemetry AA and AC 2019-09-14 16:27:07 +02:00
goebish
8601149051 Fix scanner telemetry (#262)
* Fix scanner telemetry

* Take several samples per channel, keep maximum value
2019-09-14 16:07:49 +02:00
pascallanger
d7ef15d435 Update Compiling_STM32.md 2019-09-12 16:08:20 +02:00
pascallanger
27e3645b56 Update Compiling_STM32.md 2019-09-12 15:55:08 +02:00
pascallanger
95eb4e1a22 Update Compiling_STM32.md 2019-09-12 15:54:18 +02:00
pascallanger
32ea07bf5a Update Compiling_STM32.md 2019-09-12 15:51:58 +02:00
pascallanger
06272575c5 Flash from TX 2019-09-12 15:50:12 +02:00
19 changed files with 861 additions and 254 deletions

View File

@@ -44,7 +44,7 @@ before_install:
#
- 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; }
- buildEachProtocol() { exitcodesum=0; for PROTOCOL in $ALL_PROTOCOLS ; do echo Building $PROTOCOL; buildProtocol $PROTOCOL; if [ $? -ne 0 ]; then exitcodesum=$((exitcodesum + 1)); fi; done; return $exitcodesum; }
#
# Arduino IDE adds a lot of noise caused by network traffic; firewall it
- sudo iptables -P INPUT DROP

View File

@@ -134,6 +134,24 @@
],
"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",
@@ -449,6 +467,27 @@
"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",

View File

@@ -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;

View File

@@ -13,28 +13,6 @@
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef FAILSAFE_ENABLE
//Convert from percentage to failsafe value
#define FAILSAFE_THROTTLE_LOW_VAL (((FAILSAFE_THROTTLE_LOW+125)*1024)/125)
#if FAILSAFE_THROTTLE_LOW_VAL <= 0
#undef FAILSAFE_THROTTLE_LOW_VAL
#define FAILSAFE_THROTTLE_LOW_VAL 1
#elif (FAILSAFE_THROTTLE_LOW_VAL) >= 2046
#undef FAILSAFE_THROTTLE_LOW_VAL
#define FAILSAFE_THROTTLE_LOW_VAL 2046
#endif
void InitFailsafe()
{
for(uint8_t i=0;i<NUM_CHN;i++)
Failsafe_data[i]=1024;
Failsafe_data[THROTTLE]=(uint16_t)FAILSAFE_THROTTLE_LOW_VAL; //1=-125%, 204=-100%
FAILSAFE_VALUES_on;
#ifdef FAILSAFE_SERIAL_ONLY
if(mode_select == MODE_SERIAL)
FAILSAFE_VALUES_off;
#endif
}
#endif
#ifdef ENABLE_PPM
void InitPPM()
{
@@ -61,13 +39,30 @@ uint8_t convert_channel_8b_limit_deadband(uint8_t num,uint8_t min,uint8_t mid, u
{
uint16_t val=limit_channel_100(num); // 204<->1844
uint16_t db_low=CHANNEL_MID-deadband, db_high=CHANNEL_MID+deadband; // 1024+-deadband
int32_t calc;
uint8_t out;
if(val>=db_low && val<=db_high)
return mid;
else if(val<db_low)
val=min+(val-CHANNEL_MIN_100)*(mid-min)/(db_low-CHANNEL_MIN_100);
{
val-=CHANNEL_MIN_100;
calc=mid-min;
calc*=val;
calc/=(db_low-CHANNEL_MIN_100);
out=calc;
out+=min;
}
else
val=mid+(val-db_high)*(max-mid)/(CHANNEL_MAX_100-1-db_high);
return val;
{
val-=db_high;
calc=max-mid;
calc*=val;
calc/=(CHANNEL_MAX_100-db_high+1);
out=calc;
out+=mid;
if(max>min) out++; else out--;
}
return out;
}
// Reverse a channel and store it
@@ -163,6 +158,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,

View File

@@ -0,0 +1,373 @@
/*
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_TUNE_START,
FRSKYX_RX_TUNE_LOW,
FRSKYX_RX_TUNE_HIGH,
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 int8_t frskyx_rx_finetune;
static void __attribute__((unused)) frskyx_rx_strobe_rx()
{
CC2500_Strobe(CC2500_SIDLE);
CC2500_Strobe(CC2500_SFRX);
CC2500_Strobe(CC2500_SRX);
}
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, 0);
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
frskyx_rx_strobe_rx();
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]);
frskyx_rx_strobe_rx();
}
static void __attribute__((unused)) frskyx_rx_calibrate()
{
frskyx_rx_strobe_rx();
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;
frskyx_rx_finetune = 0;
telemetry_link = 0;
if (IS_BIND_IN_PROGRESS) {
phase = FRSKYX_RX_TUNE_START;
}
else {
uint16_t temp = FRSKYX_RX_EEPROM_OFFSET;
rx_tx_addr[0] = eeprom_read_byte((EE_ADDR)temp++);
rx_tx_addr[1] = eeprom_read_byte((EE_ADDR)temp++);
rx_tx_addr[2] = eeprom_read_byte((EE_ADDR)temp++);
frskyx_rx_finetune = eeprom_read_byte((EE_ADDR)temp++);
for(uint8_t ch = 0; ch < 47; ch++)
hopping_frequency[ch] = eeprom_read_byte((EE_ADDR)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
if (option == 0)
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
else
CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
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;
static int8_t tune_low, tune_high;
uint8_t len, ch;
if ((prev_option != option) && (phase >= FRSKYX_RX_DATA)) {
if (option == 0)
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
else
CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
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);
}
len = CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F;
switch(phase) {
case FRSKYX_RX_TUNE_START:
if (len >= packet_length) {
CC2500_ReadData(packet, packet_length);
if(packet[1] == 0x03 && packet[2] == 0x01) {
if(frskyx_rx_check_crc()) {
frskyx_rx_finetune = -127;
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
phase = FRSKYX_RX_TUNE_LOW;
frskyx_rx_strobe_rx();
return 1000;
}
}
}
frskyx_rx_finetune += 10;
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
frskyx_rx_strobe_rx();
return 18000;
case FRSKYX_RX_TUNE_LOW:
if (len >= packet_length) {
CC2500_ReadData(packet, packet_length);
if (frskyx_rx_check_crc()) {
tune_low = frskyx_rx_finetune;
frskyx_rx_finetune = 127;
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
phase = FRSKYX_RX_TUNE_HIGH;
frskyx_rx_strobe_rx();
return 1000;
}
}
frskyx_rx_finetune += 1;
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
frskyx_rx_strobe_rx();
return 18000;
case FRSKYX_RX_TUNE_HIGH:
if (len >= packet_length) {
CC2500_ReadData(packet, packet_length);
if (frskyx_rx_check_crc()) {
tune_high = frskyx_rx_finetune;
frskyx_rx_finetune = (tune_low + tune_high) / 2;
CC2500_WriteReg(CC2500_0C_FSCTRL0, (int8_t)frskyx_rx_finetune);
if(tune_low < tune_high)
phase = FRSKYX_RX_BIND;
else
phase = FRSKYX_RX_TUNE_START;
frskyx_rx_strobe_rx();
return 1000;
}
}
frskyx_rx_finetune -= 1;
CC2500_WriteReg(CC2500_0C_FSCTRL0, frskyx_rx_finetune);
frskyx_rx_strobe_rx();
return 18000;
case FRSKYX_RX_BIND:
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]);
eeprom_write_byte((EE_ADDR)temp++, frskyx_rx_finetune);
for (ch = 0; ch < 47; ch++)
eeprom_write_byte((EE_ADDR)temp++, hopping_frequency[ch]);
BIND_DONE;
}
frskyx_rx_strobe_rx();
}
return 1000;
case FRSKYX_RX_DATA:
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

View File

@@ -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

View File

@@ -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,30 @@ 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 0 -> Volt_L Volt=(Volt_H*256+Volt_L)/10 V
data byte 1 -> Volt_H
data byte 2 -> AMP_L
data byte 3 -> 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
- frame 0x22 Unknown
*/
#endif

View File

@@ -52,4 +52,5 @@
52,ZSX,280
53,Flyzone,FZ-410
54,Scanner
55,FrskyX_RX,FCC,EU_LBT
63,XN_DUMP,250K,1M,2M

View File

@@ -19,7 +19,7 @@
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_REVISION 1
#define VERSION_PATCH_LEVEL 76
#define VERSION_PATCH_LEVEL 84
//******************
// Protocols
@@ -81,6 +81,7 @@ enum PROTOCOLS
PROTO_ZSX = 52, // =>NRF24L01
PROTO_FLYZONE = 53, // =>A7105
PROTO_SCANNER = 54, // =>CC2500
PROTO_FRSKYX_RX = 55, // =>CC2500
PROTO_XN297DUMP = 63, // =>NRF24L01
};
@@ -288,6 +289,11 @@ enum TRAXXAS
{
RX6519 = 0,
};
enum FRSKYX_RX
{
FRSKYX_FCC = 0,
FRSKYX_LBT
};
#define NONE 0
#define P_HIGH 1
@@ -303,6 +309,7 @@ struct PPM_Parameters
uint8_t power : 1;
uint8_t autobind : 1;
uint8_t option;
uint32_t chan_order;
};
// Telemetry
@@ -320,6 +327,8 @@ enum MultiPacketTypes
MULTI_TELEMETRY_SPORT_POLLING = 9,
MULTI_TELEMETRY_HITEC = 10,
MULTI_TELEMETRY_SCANNER = 11,
MULTI_TELEMETRY_AFHDS2A_AC = 12,
MULTI_TELEMETRY_RX_CHANNELS = 13,
};
// Macros
@@ -566,6 +575,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 + (1) freq_tune + (47) channels, 51 bytes per model, end is 178+51=229
//#define CONFIG_EEPROM_OFFSET 210 // Current configuration of the multimodule
//****************************************
@@ -639,6 +649,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
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
@@ -780,6 +791,9 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
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;
@@ -793,7 +807,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
@@ -850,6 +864,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
0x04 = protocol is valid
0x08 = module is in binding mode
0x10 = module waits a bind event to load the protocol
0x20 = current protocol supports failsafe
[5] major
[6] minor
[7] revision
@@ -864,7 +879,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
@@ -875,7 +889,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
@@ -888,8 +902,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
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
*/

View File

@@ -147,6 +147,7 @@ uint8_t protocol_flags=0,protocol_flags2=0;
// PPM variable
volatile uint16_t PPM_data[NUM_CHN];
volatile uint8_t PPM_chan_max=0;
uint32_t chan_order=0;
#endif
#if not defined (ORANGE_TX) && not defined (STM32_BOARD)
@@ -171,7 +172,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
@@ -435,9 +436,10 @@ void setup()
#endif
protocol = PPM_prot_line->protocol;
cur_protocol[1] = protocol;
cur_protocol[1] = protocol;
sub_protocol = PPM_prot_line->sub_proto;
RX_num = PPM_prot_line->rx_num;
chan_order = PPM_prot_line->chan_order;
//Forced frequency tuning values for CC2500 protocols
#if defined(FORCE_FRSKYD_TUNING) && defined(FRSKYD_CC2500_INO)
@@ -627,6 +629,8 @@ uint8_t Update_All()
#ifdef ENABLE_PPM
if(mode_select!=MODE_SERIAL && IS_PPM_FLAG_on) // PPM mode and a full frame has been received
{
uint32_t chan_or=chan_order;
uint8_t ch;
for(uint8_t i=0;i<PPM_chan_max;i++)
{ // update servo data without interrupts to prevent bad read
uint16_t val;
@@ -636,9 +640,20 @@ uint8_t Update_All()
val=map16b(val,PPM_MIN_100*2,PPM_MAX_100*2,CHANNEL_MIN_100,CHANNEL_MAX_100);
if(val&0x8000) val=CHANNEL_MIN_125;
else if(val>CHANNEL_MAX_125) val=CHANNEL_MAX_125;
Channel_data[i]=val;
if(chan_or)
{
ch=chan_or>>28;
if(ch)
Channel_data[ch-1]=val;
else
Channel_data[i]=val;
chan_or<<=4;
}
else
Channel_data[i]=val;
}
PPM_FLAG_off; // wait for next frame before update
PPM_failsafe();
update_channels_aux();
INPUT_SIGNAL_on; // valid signal received
last_signal=millis();
@@ -647,7 +662,7 @@ uint8_t Update_All()
update_led_status();
#if defined(TELEMETRY)
#if ( !( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) )
if( (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))
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
@@ -679,6 +694,32 @@ uint8_t Update_All()
return 0;
}
#ifdef ENABLE_PPM
void PPM_failsafe()
{
static uint8_t counter=0;
if(IS_BIND_IN_PROGRESS || IS_FAILSAFE_VALUES_on) // bind is not finished yet or Failsafe already being sent
return;
BIND_SET_INPUT;
BIND_SET_PULLUP;
if(IS_BIND_BUTTON_on)
{// bind button pressed
counter++;
if(counter>227)
{ //after 5s with PPM frames @22ms
counter=0;
for(uint8_t i=0;i<NUM_CHN;i++)
Failsafe_data[i]=Channel_data[i];
FAILSAFE_VALUES_on;
}
}
else
counter=0;
BIND_SET_OUTPUT;
}
#endif
// Update channels direction and Channel_AUX flags based on servo AUX positions
static void update_channels_aux(void)
{
@@ -913,7 +954,7 @@ static void protocol_init()
set_rx_tx_addr(MProtocol_id);
#ifdef FAILSAFE_ENABLE
InitFailsafe();
FAILSAFE_VALUES_off;
#endif
blink=millis();
@@ -1028,6 +1069,14 @@ static void protocol_init()
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)
@@ -1465,7 +1514,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%
@@ -1962,3 +2011,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

View File

@@ -18,8 +18,9 @@
#include "iface_cc2500.h"
#define SCAN_MAX_RADIOCHANNEL 249 // 2483 MHz
#define SCAN_CHANNEL_LOCK_TIME 300 // with precalibration, channel requires only 90 usec for synthesizer to settle
#define SCAN_AVERAGE_INTVL 30
#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;
@@ -96,25 +97,38 @@ static int __attribute__((unused)) Scanner_scan_rssi()
uint16_t Scanner_callback()
{
static uint8_t max_count, max_rssi;
uint8_t rssi;
switch (phase)
{
case SCAN_CHANNEL_CHANGE:
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;
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:
phase = SCAN_CHANNEL_CHANGE;
pkt[scan_tlm_index] = Scanner_scan_rssi();
if (scan_tlm_index == SCAN_CHANS_PER_PACKET)
{
// send data to TX
telemetry_link = 1;
scan_tlm_index = 0;
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;
@@ -124,6 +138,7 @@ 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);

View File

@@ -184,13 +184,26 @@ static void multi_send_status()
}
#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]);
@@ -1019,6 +1032,15 @@ void TelemetryUpdate()
}
#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();

View File

@@ -19,9 +19,9 @@
#endif
// Check for minimum board file definition version for DIY multi-module boards
#define MIN_AVR_BOARD 108
#define MIN_ORX_BOARD 108
#define MIN_STM32_BOARD 115
#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.
@@ -193,6 +193,7 @@
#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
@@ -250,12 +251,20 @@
#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)
#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
@@ -263,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)
@@ -296,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) && not defined(SCANNER_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

View File

@@ -123,11 +123,12 @@
/** Low Power **/
//Low power is reducing the transmit power of the multi module. This setting is configurable per model in PPM (table below) or Serial mode (radio GUI).
//It can be activated when flying indoor or small models since the distance is short or if a model is causing issues when flying closed to the TX.
//By default low power is completly disabled on all rf chips to prevent mistakes, but you can enable it by uncommenting the lines below:
//#define A7105_ENABLE_LOW_POWER
//#define CYRF6936_ENABLE_LOW_POWER
//#define CC2500_ENABLE_LOW_POWER
//#define NRF24L01_ENABLE_LOW_POWER
//By default low power selection is enabled on all rf chips, but you can disable it by commenting (add //) the lines below if you don't want to risk
//flying a model with low power.
#define A7105_ENABLE_LOW_POWER
#define CYRF6936_ENABLE_LOW_POWER
#define CC2500_ENABLE_LOW_POWER
#define NRF24L01_ENABLE_LOW_POWER
/*****************/
@@ -174,6 +175,7 @@
#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
@@ -239,25 +241,12 @@
/**************************/
/*** FAILSAFE SETTINGS ***/
/**************************/
//The module is using the same default failsafe values for all protocols which currently supports it:
// Devo, WK2x01, SFHSS, HISKY/HK310 and AFHDS2A
//All channels are centered except throttle which is forced low.
//If you want to diasble failsafe globally comment the line below using "//".
//The following protocols are supporting failsafe: FrSkyX, Devo, WK2x01, SFHSS, HISKY/HK310 and AFHDS2A
//In Serial mode failsafe is configured on the radio itself.
//In PPM mode and only after the module is up and fully operational, press the bind button for at least 5sec to send the current stick positions as failsafe to the RX.
//If you want to disable failsafe globally comment the line below using "//".
#define FAILSAFE_ENABLE
//Failsafe throttle low value in percentage.
//Value between -125% and +125%. Default -100.
#define FAILSAFE_THROTTLE_LOW -100
//The radio using serial protocol can set failsafe data.
// Two options are available:
// a. replace the default failsafe data with serial failsafe data when they are received.
// b. wait for the radio to provide failsafe before sending it. Enable advanced settings like "FAILSAFE NOT SET" or "FAILSAFE RX".
// Option a. is the default since you have a protection even if no failsafe has been set on the radio.
// You can force option b. by uncommenting the line below (remove the "//").
//#define FAILSAFE_SERIAL_ONLY
/**************************/
/*** TELEMETRY SETTINGS ***/
/**************************/
@@ -296,6 +285,7 @@
#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).
@@ -362,99 +352,99 @@
// short press the bind button multiple times until you reach the desired one. The bank number currently selected is indicated by the number of LED flash.
// Full procedure is located here: https://github.com/pascallanger/DIY-Multiprotocol-TX-Module/blob/master/Protocols_Details.md#protocol-selection-in-ppm-mode
//The parameter below indicates the number of desired banks between 1 and 5. Default is 5.
#define NBR_BANKS 5
//The parameter below indicates the number of desired banks between 1 and 5. Default is 1.
#define NBR_BANKS 1
const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
#if NBR_BANKS > 0
//****************************** BANK 1 ******************************
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option
/* 1 */ {PROTO_FLYSKY, Flysky , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 2 */ {PROTO_AFHDS2A, PWM_IBUS , 0 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 0
/* 3 */ {PROTO_AFHDS2A, PWM_IBUS , 1 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 1
/* 4 */ {PROTO_AFHDS2A, PWM_IBUS , 2 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 2
/* 5 */ {PROTO_AFHDS2A, PWM_IBUS , 3 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 3
/* 6 */ {PROTO_AFHDS2A, PWM_IBUS , 2 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 4
/* 7 */ {PROTO_AFHDS2A, PWM_IBUS , 3 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 5
/* 8 */ {PROTO_SFHSS, H107 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 9 */ {PROTO_FRSKYV, NONE , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
/* 10 */ {PROTO_FRSKYD, NONE , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
/* 11 */ {PROTO_FRSKYX, CH_16 , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
/* 12 */ {PROTO_FRSKYX, EU_16 , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
/* 13 */ {PROTO_DEVO , NONE , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 14 */ {PROTO_WK2x01, WK2801 , 0 , P_HIGH , NO_AUTOBIND , 0 },
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option Chan Order
/* 1 */ {PROTO_FLYSKY, Flysky , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 2 */ {PROTO_AFHDS2A, PWM_IBUS , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 }, // RX number 0
/* 3 */ {PROTO_AFHDS2A, PWM_IBUS , 1 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 }, // RX number 1
/* 4 */ {PROTO_AFHDS2A, PWM_IBUS , 2 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 }, // RX number 2
/* 5 */ {PROTO_AFHDS2A, PWM_IBUS , 3 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 }, // RX number 3
/* 6 */ {PROTO_AFHDS2A, PWM_IBUS , 2 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 }, // RX number 4
/* 7 */ {PROTO_AFHDS2A, PWM_IBUS , 3 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 }, // RX number 5
/* 8 */ {PROTO_SFHSS, H107 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 9 */ {PROTO_FRSKYV, NONE , 0 , P_HIGH , NO_AUTOBIND , 40 , 0x00000000 }, // option=fine freq tuning
/* 10 */ {PROTO_FRSKYD, NONE , 0 , P_HIGH , NO_AUTOBIND , 40 , 0x00000000 }, // option=fine freq tuning
/* 11 */ {PROTO_FRSKYX, CH_16 , 0 , P_HIGH , NO_AUTOBIND , 40 , 0x00000000 }, // option=fine freq tuning
/* 12 */ {PROTO_FRSKYX, EU_16 , 0 , P_HIGH , NO_AUTOBIND , 40 , 0x00000000 }, // option=fine freq tuning
/* 13 */ {PROTO_DEVO , NONE , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 14 */ {PROTO_WK2x01, WK2801 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
#endif
#if NBR_BANKS > 1
//****************************** BANK 2 ******************************
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option
/* 1 */ {PROTO_DSM , DSM2_11 , 0 , P_HIGH , NO_AUTOBIND , 6 }, // option=number of channels
/* 2 */ {PROTO_DSM , DSM2_22 , 0 , P_HIGH , NO_AUTOBIND , 6 }, // option=number of channels
/* 3 */ {PROTO_DSM , DSMX_11 , 0 , P_HIGH , NO_AUTOBIND , 6 }, // option=number of channels
/* 4 */ {PROTO_DSM , DSMX_22 , 0 , P_HIGH , NO_AUTOBIND , 6 }, // option=number of channels
/* 5 */ {PROTO_DSM , DSM2_11 , 0 , P_HIGH , NO_AUTOBIND , 8 }, // option=number of channels
/* 6 */ {PROTO_DSM , DSM2_22 , 0 , P_HIGH , NO_AUTOBIND , 8 }, // option=number of channels
/* 7 */ {PROTO_DSM , DSMX_11 , 0 , P_HIGH , NO_AUTOBIND , 8 }, // option=number of channels
/* 8 */ {PROTO_DSM , DSMX_22 , 0 , P_HIGH , NO_AUTOBIND , 8 }, // option=number of channels
/* 9 */ {PROTO_SLT , SLT_V1 , 0 , P_HIGH , NO_AUTOBIND , 6 },
/* 10 */ {PROTO_HUBSAN, H107 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 11 */ {PROTO_HUBSAN, H301 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 12 */ {PROTO_HUBSAN, H501 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 13 */ {PROTO_HISKY, Hisky , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 14 */ {PROTO_V2X2 , NONE , 0 , P_HIGH , NO_AUTOBIND , 0 },
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option Chan Order
/* 1 */ {PROTO_DSM , DSM2_11 , 0 , P_HIGH , NO_AUTOBIND , 6 , 0x00000000 }, // option=number of channels
/* 2 */ {PROTO_DSM , DSM2_22 , 0 , P_HIGH , NO_AUTOBIND , 6 , 0x00000000 }, // option=number of channels
/* 3 */ {PROTO_DSM , DSMX_11 , 0 , P_HIGH , NO_AUTOBIND , 6 , 0x00000000 }, // option=number of channels
/* 4 */ {PROTO_DSM , DSMX_22 , 0 , P_HIGH , NO_AUTOBIND , 6 , 0x00000000 }, // option=number of channels
/* 5 */ {PROTO_DSM , DSM2_11 , 0 , P_HIGH , NO_AUTOBIND , 8 , 0x00000000 }, // option=number of channels
/* 6 */ {PROTO_DSM , DSM2_22 , 0 , P_HIGH , NO_AUTOBIND , 8 , 0x00000000 }, // option=number of channels
/* 7 */ {PROTO_DSM , DSMX_11 , 0 , P_HIGH , NO_AUTOBIND , 8 , 0x00000000 }, // option=number of channels
/* 8 */ {PROTO_DSM , DSMX_22 , 0 , P_HIGH , NO_AUTOBIND , 8 , 0x00000000 }, // option=number of channels
/* 9 */ {PROTO_SLT , SLT_V1 , 0 , P_HIGH , NO_AUTOBIND , 6 , 0x00000000 },
/* 10 */ {PROTO_HUBSAN, H107 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 11 */ {PROTO_HUBSAN, H301 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 12 */ {PROTO_HUBSAN, H501 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 13 */ {PROTO_HISKY, Hisky , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 14 */ {PROTO_V2X2 , NONE , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
#endif
#if NBR_BANKS > 2
//****************************** BANK 3 ******************************
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option
/* 1 */ {PROTO_ESKY , NONE , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 2 */ {PROTO_ESKY150, NONE , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 3 */ {PROTO_ASSAN, NONE , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 4 */ {PROTO_CORONA, COR_V2 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 5 */ {PROTO_SYMAX, SYMAX , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 6 */ {PROTO_KN , WLTOYS , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 7 */ {PROTO_BAYANG, BAYANG , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 8 */ {PROTO_BAYANG, H8S3D , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 9 */ {PROTO_BAYANG, X16_AH , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 10 */ {PROTO_BAYANG, IRDRONE , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 11 */ {PROTO_H8_3D, H8_3D , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 12 */ {PROTO_H8_3D, H20H , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 13 */ {PROTO_H8_3D, H20MINI , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 14 */ {PROTO_H8_3D, H30MINI , 0 , P_HIGH , NO_AUTOBIND , 0 },
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option Chan Order
/* 1 */ {PROTO_ESKY , NONE , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 2 */ {PROTO_ESKY150, NONE , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 3 */ {PROTO_ASSAN, NONE , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 4 */ {PROTO_CORONA, COR_V2 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 5 */ {PROTO_SYMAX, SYMAX , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 6 */ {PROTO_KN , WLTOYS , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 7 */ {PROTO_BAYANG, BAYANG , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 8 */ {PROTO_BAYANG, H8S3D , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 9 */ {PROTO_BAYANG, X16_AH , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 10 */ {PROTO_BAYANG, IRDRONE , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 11 */ {PROTO_H8_3D, H8_3D , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 12 */ {PROTO_H8_3D, H20H , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 13 */ {PROTO_H8_3D, H20MINI , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 14 */ {PROTO_H8_3D, H30MINI , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
#endif
#if NBR_BANKS > 3
//****************************** BANK 4 ******************************
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option
/* 1 */ {PROTO_MJXQ , WLH08 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 2 */ {PROTO_MJXQ , X600 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 3 */ {PROTO_MJXQ , X800 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 4 */ {PROTO_MJXQ , H26D , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 5 */ {PROTO_MJXQ , E010 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 6 */ {PROTO_MJXQ , H26WH , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 7 */ {PROTO_HONTAI, HONTAI , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 8 */ {PROTO_HONTAI, JJRCX1 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 9 */ {PROTO_HONTAI, X5C1 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 10 */ {PROTO_HONTAI, FQ777_951 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 11 */ {PROTO_Q303 , Q303 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 12 */ {PROTO_Q303 , CX35 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 13 */ {PROTO_Q303 , CX10D , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 14 */ {PROTO_Q303 , CX10WD , 0 , P_HIGH , NO_AUTOBIND , 0 },
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option Chan Order
/* 1 */ {PROTO_MJXQ , WLH08 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 2 */ {PROTO_MJXQ , X600 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 3 */ {PROTO_MJXQ , X800 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 4 */ {PROTO_MJXQ , H26D , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 5 */ {PROTO_MJXQ , E010 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 6 */ {PROTO_MJXQ , H26WH , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 7 */ {PROTO_HONTAI, HONTAI , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 8 */ {PROTO_HONTAI, JJRCX1 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 9 */ {PROTO_HONTAI, X5C1 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 10 */ {PROTO_HONTAI, FQ777_951 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 11 */ {PROTO_Q303 , Q303 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 12 */ {PROTO_Q303 , CX35 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 13 */ {PROTO_Q303 , CX10D , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 14 */ {PROTO_Q303 , CX10WD , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
#endif
#if NBR_BANKS > 4
//****************************** BANK 5 ******************************
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option
/* 1 */ {PROTO_CX10 , CX10_GREEN , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 2 */ {PROTO_CX10 , CX10_BLUE , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 3 */ {PROTO_CX10 , DM007 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 4 */ {PROTO_CX10 , JC3015_1 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 5 */ {PROTO_CX10 , JC3015_2 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 6 */ {PROTO_CX10 , MK33041 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 7 */ {PROTO_Q2X2 , Q222 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 8 */ {PROTO_Q2X2 , Q242 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 9 */ {PROTO_Q2X2 , Q282 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 10 */ {PROTO_CG023, CG023 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 11 */ {PROTO_CG023, YD829 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 12 */ {PROTO_FQ777, NONE , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 13 */ {PROTO_YD717, YD717 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 14 */ {PROTO_MT99XX, MT99 , 0 , P_HIGH , NO_AUTOBIND , 0 },
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option Chan Order
/* 1 */ {PROTO_CX10 , CX10_GREEN , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 2 */ {PROTO_CX10 , CX10_BLUE , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 3 */ {PROTO_CX10 , DM007 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 4 */ {PROTO_CX10 , JC3015_1 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 5 */ {PROTO_CX10 , JC3015_2 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 6 */ {PROTO_CX10 , MK33041 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 7 */ {PROTO_Q2X2 , Q222 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 8 */ {PROTO_Q2X2 , Q242 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 9 */ {PROTO_Q2X2 , Q282 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 10 */ {PROTO_CG023, CG023 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 11 */ {PROTO_CG023, YD829 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 12 */ {PROTO_FQ777, NONE , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 13 */ {PROTO_YD717, YD717 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 14 */ {PROTO_MT99XX, MT99 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
#endif
};
// RX_Num is used for TX & RX match. Using different RX_Num values for each receiver will prevent starting a model with the false config loaded...
@@ -471,6 +461,15 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
// Option: the value is between -128 and +127.
// The option value is only valid for some protocols, read this page for more information: https://github.com/pascallanger/DIY-Multiprotocol-TX-Module/blob/master/Protocols_Details.md
// Chan order: if the value is different from 0, this setting will remap the first 8 channels in any given order before giving them to the protocol.
// It does not disable the automatic channel remapping of the protocol itself but changes the input of it.
// Even if your TX is sending less than 8 channels you have to respect the format like if it was.
// Examples:
// - 0x12345678 will give to the protocol the channels in the order 1,2,3,4,5,6,7,8 which is equivalent to 0x00000000.
// - 0x42315678 will give to the protocol the channels in the order 4,2,3,1,5,6,7,8 swapping channel 1 and 4.
// - 0x40010000 will give to the protocol the channels in the order 4,2,3,1,5,6,7,8 swapping channel 1 and 4. Note: 0 means leave the channel where it is.
// - 0x0000ABCD will give to the protocol the channels in the order 1,2,3,4,10,11,12,13 which potentially enables acces to channels not available on your TX. Note A=10,B=11,C=12,D=13,E=14,F=15.
/* Available protocols and associated sub protocols to pick and choose from (Listed in alphabetical order)
PROTO_AFHDS2A
PWM_IBUS
@@ -547,6 +546,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

View File

@@ -60,20 +60,20 @@
#define MY_PPM_PROT // Use the bellow protocol list
const PPM_Parameters My_PPM_prot[14*NBR_BANKS]={
//****************************** BANK 1 ******************************
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option
/* 1 */ {PROTO_KN , WLTOYS , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 2 */ {PROTO_FLYSKY, Flysky , 0 , P_HIGH , AUTOBIND , 0 },
/* 3 */ {PROTO_AFHDS2A, PWM_IBUS , 1 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 1
/* 4 */ {PROTO_AFHDS2A, PWM_IBUS , 2 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 2
/* 5 */ {PROTO_AFHDS2A, PWM_IBUS , 3 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 3
/* 6 */ {PROTO_AFHDS2A, PWM_IBUS , 2 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 4
/* 7 */ {PROTO_AFHDS2A, PWM_IBUS , 3 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 5
/* 8 */ {PROTO_SFHSS, H107 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 9 */ {PROTO_FRSKYV, NONE , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
/* 10 */ {PROTO_FRSKYD, NONE , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
/* 11 */ {PROTO_FRSKYX, CH_16 , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
/* 12 */ {PROTO_FRSKYX, EU_16 , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
/* 13 */ {PROTO_DEVO , NONE , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 14 */ {PROTO_WK2x01, WK2801 , 0 , P_HIGH , NO_AUTOBIND , 0 },
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option Chan Order
/* 1 */ {PROTO_KN , WLTOYS , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 2 */ {PROTO_FLYSKY, Flysky , 0 , P_HIGH , AUTOBIND , 0 , 0x00000000 },
/* 3 */ {PROTO_AFHDS2A, PWM_IBUS , 1 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 }, // RX number 1
/* 4 */ {PROTO_AFHDS2A, PWM_IBUS , 2 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 }, // RX number 2
/* 5 */ {PROTO_AFHDS2A, PWM_IBUS , 3 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 }, // RX number 3
/* 6 */ {PROTO_AFHDS2A, PWM_IBUS , 2 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 }, // RX number 4
/* 7 */ {PROTO_AFHDS2A, PWM_IBUS , 3 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 }, // RX number 5
/* 8 */ {PROTO_SFHSS, H107 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 9 */ {PROTO_FRSKYV, NONE , 0 , P_HIGH , NO_AUTOBIND , 40 , 0x00000000 }, // option=fine freq tuning
/* 10 */ {PROTO_FRSKYD, NONE , 0 , P_HIGH , NO_AUTOBIND , 40 , 0x00000000 }, // option=fine freq tuning
/* 11 */ {PROTO_FRSKYX, CH_16 , 0 , P_HIGH , NO_AUTOBIND , 40 , 0x00000000 }, // option=fine freq tuning
/* 12 */ {PROTO_FRSKYX, EU_16 , 0 , P_HIGH , NO_AUTOBIND , 40 , 0x00000000 }, // option=fine freq tuning
/* 13 */ {PROTO_DEVO , NONE , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
/* 14 */ {PROTO_WK2x01, WK2801 , 0 , P_HIGH , NO_AUTOBIND , 0 , 0x00000000 },
};
#endif

View File

@@ -84,11 +84,12 @@ CFlie|38|CFlie||||||||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|Flyzone|FZ410|||||||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
@@ -113,7 +114,7 @@ CFlie|38|CFlie||||||||NRF24L01|
[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|Traxxas|RX6519|||||||CYRF6936|
[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
@@ -341,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.
@@ -776,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)

View File

@@ -2,20 +2,18 @@
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 to use serial debug:
1. Edit the file [Multiprotocol.ino](../Multiprotocol/Multiprotocol.ino#L26)
1. Modify at the begining of the file the line: `//#define DEBUG_SERIAL` by removing the // leaving only: `#define DEBUG_SERIAL`
1. Save the file
1. Upload the firmware to the module:
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 Upload method:"Upload via USB"|Use the Upload method: "Upload via Serial (FTDI)|Use the Upload method: "Upload via Serial (FTDI)
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 it will be stuck with the status LED off.|Do not disconnect the USB cable. In case you have to do it, you have to power first the TX and 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
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.
5. Power on the TX
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 line commented: `//#define DEBUG_SERIAL` **
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"**

View File

@@ -1,25 +1,25 @@
# Compiling and Flashing (STM32)
Multiprotocol modules can be flashed with a precompiled firmware file (Option 1) or you can compile and upload your customized firmware using the Arduino IDE (Option 2).
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. [Option 1 - Update firmware using precompiled binaries](#option-1-update-firmware-using-precompiled-binaries)
1. [Option 2 - Compiling and updating firmware](#option-2-compiling-and-updating-firmware)
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. [Connect the module](#connect-the-module)
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. [Exporting compiled firmware](exporting-compiled-firmware)
1. [Upload the firmware](#upload-the-firmware)
1. [Troubleshooting](#troubleshooting)
## Tools required
@@ -67,10 +67,17 @@ 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>
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-2, Compile and flash update using Arduino IDE.
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.
# Option2 - Compiling and Updating Firmware
## Preparation
## 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
@@ -90,14 +97,14 @@ Multiprotocol firmware can be compiled and flashed with your customized firmware
1. Under **Tools -> Board** select **Multi 4-in-1 (STM32FC103)**
1. Under **Tools -> Debug Option** select **None**
## Configure the firmware
### Configure the firmware
Make any changes you require to 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.
@@ -109,15 +116,15 @@ Global variables use 4064 bytes (19%) of dynamic memory, leaving 16416 bytes for
```
You can proceed to the next step.
## Connect the module
### USB port
### 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).
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).
**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.
### USB-to-Serial adapter
#### 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:
@@ -148,15 +155,10 @@ In order to flash the bootloader the **BOOT0** jumper must be installed connecti
1. Install the **BOOT0** jumper as described above.
1. Switch on the transmitter
## Upload the firmware
### Upload the firmware
1. In the Arduino IDE click **Sketch -> Upload**, or press **Ctrl+U**
## Exporting compiled firmware
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
## 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:

BIN
docs/images/Debug1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB