mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2026-08-18 15:23:20 +00:00
Compare commits
3 Commits
3d50a39efb
...
97fcd0bde0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97fcd0bde0 | ||
|
|
463978939b | ||
|
|
0a7f74dc06 |
@@ -241,3 +241,4 @@
|
||||
105,0,Shenqi2,Std,1
|
||||
106,0,WL91x,Std,0
|
||||
107,0,WPL,Std,0,Light,TH_DR,ST_DR
|
||||
108,0,Ares,6HPA_Tx,0,CH5,CH6
|
||||
|
||||
254
Multiprotocol/Ares_cc2500.ino
Normal file
254
Multiprotocol/Ares_cc2500.ino
Normal file
@@ -0,0 +1,254 @@
|
||||
/*
|
||||
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 ARES 6HPA transmitter
|
||||
|
||||
#if defined(ARES_CC2500_INO)
|
||||
|
||||
#include "iface_cc2500.h"
|
||||
|
||||
//#define ARES_FORCE_ID
|
||||
|
||||
#define ARES_COARSE 0
|
||||
|
||||
#define ARES_PACKET_LEN 17
|
||||
#define ARES_NUM_FREQUENCIES 60
|
||||
|
||||
enum {
|
||||
ARES_START = 0x00,
|
||||
ARES_CALIB = 0x01,
|
||||
ARES_PREP = 0x02,
|
||||
ARES_DATA = 0x03,
|
||||
};
|
||||
|
||||
// CC2500 register init values captured from the ARES 6HPA transmitter
|
||||
const PROGMEM uint8_t ARES_init_values[] = {
|
||||
/* 00 */ 0x06, 0x2E, 0x2E, 0x07, 0x5A, 0x60, 0x30, 0x04,
|
||||
/* 08 */ 0x05, 0x00, 0x00, 0x06, 0x00, 0x5C, 0xB1, 0x3B + ARES_COARSE,
|
||||
/* 10 */ 0x6A, 0xF8, 0x03, 0x23, 0x7A, 0x44, 0x07, 0x30,
|
||||
/* 18 */ 0x18, 0x16, 0x6C, 0x43, 0x40, 0x91, 0x87, 0x6B,
|
||||
/* 20 */ 0xF8, 0x56, 0x10, 0xA9, 0x0A, 0x00, 0x11
|
||||
};
|
||||
|
||||
// Fixed hopping sequence captured from the ARES 6HPA transmitter.
|
||||
// This is a permutation of 60 channel values spread across the band.
|
||||
static const PROGMEM uint8_t ARES_hop[] = {
|
||||
0xB0, 0x6F, 0x1D, 0xB4, 0x74, 0x20, 0xB8, 0xD8,
|
||||
0x24, 0xBC, 0xDC, 0x28, 0x48, 0xE0, 0x2C, 0x4C,
|
||||
0xE4, 0x90, 0x50, 0xE8, 0x94, 0x54, 0xEC, 0x00,
|
||||
0x98, 0x58, 0x04, 0x9B, 0x5C, 0x08, 0xA0, 0xC0,
|
||||
0x0C, 0xA4, 0xC3, 0x10, 0x30, 0xC6, 0x14, 0x34,
|
||||
0xCC, 0x78, 0x38, 0xD0, 0x7C, 0x3C, 0xD4, 0x80,
|
||||
0x40, 0x60, 0x84, 0x44, 0x64, 0x88, 0xA8, 0x68,
|
||||
0x8C, 0xAC, 0x6C, 0x18
|
||||
};
|
||||
|
||||
static void __attribute__((unused)) ARES_CC2500_init()
|
||||
{
|
||||
CC2500_Strobe(CC2500_SRES);
|
||||
delayMilliseconds(1);
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
|
||||
for (uint8_t i = 0; i < 39; ++i)
|
||||
CC2500_WriteReg(i, pgm_read_byte_near(&ARES_init_values[i]));
|
||||
|
||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
|
||||
prev_option = option;
|
||||
|
||||
// Write PATABLE to max power (0xFF for all 8 entries) as captured
|
||||
for (uint8_t i = 0; i < 8; i++)
|
||||
CC2500_WriteReg(CC2500_3E_PATABLE, 0xFF);
|
||||
|
||||
CC2500_SetTxRxMode(TX_EN);
|
||||
CC2500_SetPower();
|
||||
}
|
||||
|
||||
// Load hopping table
|
||||
static void __attribute__((unused)) ARES_RF_channels()
|
||||
{
|
||||
for (uint8_t i = 0; i < ARES_NUM_FREQUENCIES; i++)
|
||||
hopping_frequency[i] = pgm_read_byte_near(&ARES_hop[i]);
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) ARES_tune_chan()
|
||||
{
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency[hopping_frequency_no]);
|
||||
CC2500_Strobe(CC2500_SFTX);
|
||||
CC2500_Strobe(CC2500_SCAL);
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) ARES_change_chan_fast()
|
||||
{
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency[hopping_frequency_no]);
|
||||
CC2500_WriteReg(CC2500_25_FSCAL1, calData[hopping_frequency_no]);
|
||||
}
|
||||
|
||||
// Advance the hop counter: cycles through 0-58 with step, inserting 59 when wrapping through 0
|
||||
static uint8_t __attribute__((unused)) ARES_next_counter(uint8_t current, uint8_t step)
|
||||
{
|
||||
if (current == 59)
|
||||
return 0;
|
||||
uint8_t next = (current + step) % 59;
|
||||
if (next == 0)
|
||||
return 59;
|
||||
return next;
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) ARES_build_packet()
|
||||
{
|
||||
// Length byte: 16 data bytes follow
|
||||
packet[0] = 0x10;
|
||||
|
||||
// TX ID
|
||||
packet[1] = rx_tx_addr[1];
|
||||
packet[2] = rx_tx_addr[2];
|
||||
packet[3] = rx_tx_addr[3];
|
||||
|
||||
// 6 channels encoded as interleaved 12-bit values in bytes 4-12
|
||||
uint16_t ch[6];
|
||||
for (uint8_t i = 0; i < 6; i++)
|
||||
ch[i] = convert_channel_16b_nolimit(i, 1820, 3300, false);
|
||||
|
||||
packet[4] = ch[0] >> 4;
|
||||
packet[5] = ((ch[0] & 0x0F) << 4) | (ch[1] & 0x0F);
|
||||
packet[6] = ch[1] >> 4;
|
||||
packet[7] = ch[2] >> 4;
|
||||
packet[8] = ((ch[2] & 0x0F) << 4) | (ch[3] & 0x0F);
|
||||
packet[9] = ch[3] >> 4;
|
||||
packet[10] = ch[4] >> 4;
|
||||
packet[11] = ((ch[4] & 0x0F) << 4) | (ch[5] & 0x0F);
|
||||
packet[12] = ch[5] >> 4;
|
||||
|
||||
// Byte 16: counter step size (stored in crc, set to 1-58 in ARES_init)
|
||||
uint8_t step = crc;
|
||||
|
||||
// Bytes 13-15: running counter with rotating bit 7 frame indicator
|
||||
// The counter cycles 0-58 with a step, inserting 59 before wrapping to 0
|
||||
// Each group of 3 packets has 3 consecutive counter values
|
||||
// packet_count holds the current counter value
|
||||
uint8_t c0 = packet_count;
|
||||
uint8_t c1 = ARES_next_counter(c0, step);
|
||||
uint8_t c2 = ARES_next_counter(c1, step);
|
||||
|
||||
// Frame indicator: each data frame is sent 3 times
|
||||
// bind_phase tracks position 0/1/2 within the group of 3
|
||||
packet[13] = c0;
|
||||
packet[14] = c1;
|
||||
packet[15] = c2;
|
||||
packet[16] = step;
|
||||
|
||||
// Set the rotating frame bit (bit 7) on one of bytes 13-15
|
||||
switch (bind_phase)
|
||||
{
|
||||
case 0:
|
||||
packet[13] |= 0x80;
|
||||
break;
|
||||
case 1:
|
||||
packet[14] |= 0x80;
|
||||
break;
|
||||
case 2:
|
||||
packet[15] |= 0x80;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) ARES_send_packet()
|
||||
{
|
||||
ARES_change_chan_fast();
|
||||
CC2500_SetPower();
|
||||
CC2500_WriteData(packet, ARES_PACKET_LEN);
|
||||
}
|
||||
|
||||
#define ARES_PACKET_PERIOD 6670 // 6.67ms between packets
|
||||
#define ARES_PREP_TIMING 2000
|
||||
|
||||
uint16_t ARES_callback()
|
||||
{
|
||||
switch(phase)
|
||||
{
|
||||
case ARES_START:
|
||||
ARES_CC2500_init();
|
||||
hopping_frequency_no = 0;
|
||||
bind_phase = 0;
|
||||
ARES_tune_chan();
|
||||
phase = ARES_CALIB;
|
||||
return ARES_PREP_TIMING;
|
||||
case ARES_CALIB:
|
||||
calData[hopping_frequency_no] = CC2500_ReadReg(CC2500_25_FSCAL1);
|
||||
hopping_frequency_no++;
|
||||
if (hopping_frequency_no < ARES_NUM_FREQUENCIES)
|
||||
ARES_tune_chan();
|
||||
else
|
||||
{
|
||||
hopping_frequency_no = 0;
|
||||
phase = ARES_PREP;
|
||||
}
|
||||
return ARES_PREP_TIMING;
|
||||
case ARES_PREP:
|
||||
if (prev_option != option)
|
||||
{
|
||||
phase = ARES_START;
|
||||
return ARES_PREP_TIMING;
|
||||
}
|
||||
#ifdef MULTI_SYNC
|
||||
telemetry_set_input_sync(ARES_PACKET_PERIOD);
|
||||
#endif
|
||||
ARES_build_packet();
|
||||
phase = ARES_DATA;
|
||||
// Fall through
|
||||
case ARES_DATA:
|
||||
ARES_send_packet();
|
||||
hopping_frequency_no++;
|
||||
if (hopping_frequency_no >= ARES_NUM_FREQUENCIES)
|
||||
hopping_frequency_no = 0;
|
||||
bind_phase++;
|
||||
if (bind_phase >= 3)
|
||||
{
|
||||
bind_phase = 0;
|
||||
// Advance counter to start of next group
|
||||
uint8_t step = crc;
|
||||
packet_count = ARES_next_counter(packet_count, step);
|
||||
packet_count = ARES_next_counter(packet_count, step);
|
||||
packet_count = ARES_next_counter(packet_count, step);
|
||||
}
|
||||
phase = ARES_PREP;
|
||||
return ARES_PACKET_PERIOD;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ARES_init()
|
||||
{
|
||||
BIND_DONE; // Autobind protocol - no TX-initiated bind phase
|
||||
ARES_RF_channels();
|
||||
|
||||
// rx_tx_addr[1] and [2] are already set from MProtocol_id by the framework
|
||||
// RX_num (0-63) in byte 3 provides model match
|
||||
rx_tx_addr[3] = RX_num;
|
||||
|
||||
// Counter step and start from capture
|
||||
crc = 23;
|
||||
packet_count = 35;
|
||||
|
||||
#ifdef ARES_FORCE_ID
|
||||
rx_tx_addr[1] = 0xDC;
|
||||
rx_tx_addr[2] = 0xCC;
|
||||
rx_tx_addr[3] = 0x00;
|
||||
#endif
|
||||
phase = ARES_START;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -8,7 +8,7 @@
|
||||
8,YD717,YD717,SKYWLKR,SYMAX4,XINXUN,NIHUI
|
||||
9,KN,WLTOYS,FEILUN
|
||||
10,SymaX,SYMAX,SYMAX5C
|
||||
11,SLT,SLT_V1,SLT_V2,Q100,Q200,MR100,V1_4CH,RF_SIM
|
||||
11,SLT,SLT_V1,SLT_V2,Q100,Q200,MR100,V1_4CH,RF_SIM,SLT6TX
|
||||
12,CX10,GREEN,BLUE,DM007,---,J3015_1,J3015_2,MK33041
|
||||
13,CG023,CG023,YD829
|
||||
14,Bayang,Bayang,H8S3D,X16_AH,IRDRONE,DHD_D4,QX100
|
||||
@@ -103,3 +103,4 @@
|
||||
105,Shenqi2
|
||||
106,WL91x
|
||||
107,WPL
|
||||
108,0,Ares
|
||||
@@ -119,6 +119,7 @@ const char STR_JIABAILE[] ="JIABAILE";
|
||||
const char STR_KAMTOM[] ="KAMTOM";
|
||||
const char STR_WL91X[] ="WL91x";
|
||||
const char STR_WPL[] ="WPL";
|
||||
const char STR_ARES[] ="ARES";
|
||||
|
||||
const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20";
|
||||
const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501";
|
||||
@@ -139,7 +140,7 @@ const char STR_SUBTYPE_DEVO[] = "\x04""8ch\0""10ch""12ch""6ch\0""7ch\0";
|
||||
const char STR_SUBTYPE_YD717[] = "\x07""Std\0 ""SkyWlkr""Syma X4""XINXUN\0""NIHUI\0 ";
|
||||
const char STR_SUBTYPE_KN[] = "\x06""WLtoys""FeiLun";
|
||||
const char STR_SUBTYPE_SYMAX[] = "\x03""Std""X5C";
|
||||
const char STR_SUBTYPE_SLT[] = "\x06""V1_6ch""V2_8ch""Q100\0 ""Q200\0 ""MR100\0""V1_4ch""RF_SIM";
|
||||
const char STR_SUBTYPE_SLT[] = "\x06""V1_6ch""V2_8ch""Q100\0 ""Q200\0 ""MR100\0""V1_4ch""RF_SIM""SLT6TX";
|
||||
const char STR_SUBTYPE_CX10[] = "\x07""Green\0 ""Blue\0 ""DM007\0 ""-\0 ""JC3015a""JC3015b""MK33041";
|
||||
const char STR_SUBTYPE_CG023[] = "\x05""Std\0 ""YD829";
|
||||
const char STR_SUBTYPE_BAYANG[] = "\x07""Std\0 ""H8S3D\0 ""X16 AH\0""IRDrone""DHD D4\0""QX100\0 ";
|
||||
@@ -231,6 +232,9 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
#if defined(MULTI_CONFIG_INO)
|
||||
{PROTO_CONFIG, STR_CONFIG, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, 0, CONFIG_init, CONFIG_callback },
|
||||
#endif
|
||||
#if defined(ARES_CC2500_INO)
|
||||
{PROTO_ARES, STR_ARES, NO_SUBTYPE, 0, OPTION_RFTUNE, 0, 0, SW_CC2500, ARES_init, ARES_callback },
|
||||
#endif
|
||||
#if defined(ASSAN_NRF24L01_INO)
|
||||
{PROTO_ASSAN, STR_ASSAN, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, ASSAN_init, ASSAN_callback },
|
||||
#endif
|
||||
@@ -488,7 +492,7 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
{PROTO_SKYARTEC, STR_SKYARTEC, NO_SUBTYPE, 0, OPTION_RFTUNE, 0, 1, SW_CC2500, SKYARTEC_init, SKYARTEC_callback },
|
||||
#endif
|
||||
#if defined(SLT_CCNRF_INO)
|
||||
{PROTO_SLT, STR_SLT, STR_SUBTYPE_SLT, 7, OPTION_RFTUNE, 0, 1, SW_NRF, SLT_init, SLT_callback },
|
||||
{PROTO_SLT, STR_SLT, STR_SUBTYPE_SLT, 8, OPTION_RFTUNE, 0, 1, SW_NRF, SLT_init, SLT_callback },
|
||||
#endif
|
||||
#if defined(SYMAX_NRF24L01_INO)
|
||||
{PROTO_SYMAX, STR_SYMAX, STR_SUBTYPE_SYMAX, 2, OPTION_NONE, 0, 0, SW_NRF, SYMAX_init, SYMAX_callback },
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_REVISION 4
|
||||
#define VERSION_PATCH_LEVEL 61
|
||||
#define VERSION_PATCH_LEVEL 63
|
||||
|
||||
#define MODE_SERIAL 0
|
||||
|
||||
@@ -135,6 +135,7 @@ enum PROTOCOLS
|
||||
PROTO_SHENQI2 = 105, // =>NRF24L01
|
||||
PROTO_WL91X = 106, // =>CC2500 & NRF24L01
|
||||
PROTO_WPL = 107, // =>NRF24L01
|
||||
PROTO_ARES = 108, // =>CC2500
|
||||
|
||||
PROTO_NANORF = 126, // =>NRF24L01
|
||||
PROTO_TEST = 127, // =>CC2500
|
||||
@@ -216,6 +217,7 @@ enum SLT
|
||||
MR100 = 4,
|
||||
SLT_V1_4 = 5,
|
||||
RF_SIM = 6,
|
||||
SLT6TX = 7,
|
||||
};
|
||||
enum CX10
|
||||
{
|
||||
@@ -1149,6 +1151,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
||||
MR100 4
|
||||
SLT_V1_4CH 5
|
||||
RF_SIM 6
|
||||
SLT6TX 7
|
||||
sub_protocol==E01X
|
||||
E012 0
|
||||
E015 1
|
||||
|
||||
@@ -104,7 +104,7 @@ uint16_t packet_period;
|
||||
uint8_t packet_count;
|
||||
uint8_t packet_sent;
|
||||
uint8_t packet_length;
|
||||
#if defined(HOTT_CC2500_INO) || defined(ESKY150V2_CC2500_INO) || defined(MLINK_CYRF6936_INO)
|
||||
#if defined(HOTT_CC2500_INO) || defined(ESKY150V2_CC2500_INO) || defined(MLINK_CYRF6936_INO) || defined(ARES_CC2500_INO)
|
||||
uint8_t hopping_frequency[78];
|
||||
#else
|
||||
uint8_t hopping_frequency[50];
|
||||
@@ -130,7 +130,7 @@ uint16_t pps_counter;
|
||||
#ifdef CC2500_INSTALLED
|
||||
#ifdef SCANNER_CC2500_INO
|
||||
uint8_t calData[255];
|
||||
#elif defined(HOTT_CC2500_INO) || defined(ESKY150V2_CC2500_INO)
|
||||
#elif defined(HOTT_CC2500_INO) || defined(ESKY150V2_CC2500_INO) || defined(ARES_CC2500_INO)
|
||||
uint8_t calData[75];
|
||||
#else
|
||||
uint8_t calData[50];
|
||||
@@ -635,7 +635,11 @@ void setup()
|
||||
option = FORCE_HOTT_TUNING; // Use config-defined tuning value for HOTT
|
||||
else
|
||||
#endif
|
||||
option = (uint8_t)PPM_prot_line->option; // Use radio-defined option value
|
||||
#if defined(FORCE_ARES_TUNING) && defined(ARES_CC2500_INO)
|
||||
if (protocol==PROTO_ARES)
|
||||
option = FORCE_ARES_TUNING; // Use config-defined tuning value for ARES
|
||||
else
|
||||
#endif option = (uint8_t)PPM_prot_line->option; // Use radio-defined option value
|
||||
|
||||
if(PPM_prot_line->power) POWER_FLAG_on;
|
||||
if(PPM_prot_line->autobind)
|
||||
@@ -1376,6 +1380,11 @@ void update_serial_data()
|
||||
if (protocol==PROTO_HOTT)
|
||||
option=FORCE_HOTT_TUNING; // Use config-defined tuning value for HOTT
|
||||
else
|
||||
#endif
|
||||
#if defined(FORCE_ARES_TUNING) && defined(ARES_CC2500_INO)
|
||||
if (protocol==PROTO_ARES)
|
||||
option=FORCE_ARES_TUNING; // Use config-defined tuning value for ARES
|
||||
else
|
||||
#endif
|
||||
option=rx_ok_buff[3]; // Use radio-defined option value
|
||||
|
||||
|
||||
@@ -16,13 +16,25 @@
|
||||
|
||||
#include "iface_nrf250k.h"
|
||||
|
||||
#if defined(CC2500_INSTALLED) && defined(NRF24L01_INSTALLED)
|
||||
extern bool xn297_rf;
|
||||
#endif
|
||||
|
||||
uint8_t cc2500_nrf_tx_addr[5], cc2500_nrf_addr_len;
|
||||
|
||||
static void __attribute__((unused)) NRF250K_SetTXAddr(uint8_t* addr, uint8_t len)
|
||||
{
|
||||
if (len > 5) len = 5;
|
||||
if (len < 3) len = 3;
|
||||
#if defined(CC2500_INSTALLED)
|
||||
#if defined(CC2500_INSTALLED) && defined(NRF24L01_INSTALLED)
|
||||
cc2500_nrf_addr_len = len;
|
||||
memcpy(cc2500_nrf_tx_addr, addr, len);
|
||||
if(xn297_rf == XN297_NRF)
|
||||
{
|
||||
NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, len-2);
|
||||
NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, addr, len);
|
||||
}
|
||||
#elif defined(CC2500_INSTALLED)
|
||||
cc2500_nrf_addr_len = len;
|
||||
memcpy(cc2500_nrf_tx_addr, addr, len);
|
||||
#elif defined(NRF24L01_INSTALLED)
|
||||
@@ -33,6 +45,22 @@ static void __attribute__((unused)) NRF250K_SetTXAddr(uint8_t* addr, uint8_t len
|
||||
|
||||
static void __attribute__((unused)) NRF250K_WritePayload(uint8_t* msg, uint8_t len)
|
||||
{
|
||||
#if defined(NRF24L01_INSTALLED)
|
||||
#if defined(CC2500_INSTALLED)
|
||||
if(xn297_rf == XN297_NRF)
|
||||
#endif
|
||||
{
|
||||
if(len<=32)
|
||||
{
|
||||
NRF24L01_FlushTx();
|
||||
NRF24L01_WriteReg(NRF24L01_07_STATUS, _BV(NRF24L01_07_TX_DS) | _BV(NRF24L01_07_RX_DR) | _BV(NRF24L01_07_MAX_RT));
|
||||
NRF24L01_WritePayload(msg, len);
|
||||
}
|
||||
#if defined(CC2500_INSTALLED)
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if defined(CC2500_INSTALLED)
|
||||
#if defined(ESKY150V2_CC2500_INO)
|
||||
uint8_t buf[158];
|
||||
@@ -106,13 +134,6 @@ static void __attribute__((unused)) NRF250K_WritePayload(uint8_t* msg, uint8_t l
|
||||
CC2500_WriteRegisterMulti(CC2500_3F_TXFIFO, buff, last);
|
||||
CC2500_Strobe(CC2500_STX);
|
||||
}
|
||||
#elif defined(NRF24L01_INSTALLED)
|
||||
if(len<=32)
|
||||
{
|
||||
NRF24L01_FlushTx();
|
||||
NRF24L01_WriteReg(NRF24L01_07_STATUS, _BV(NRF24L01_07_TX_DS) | _BV(NRF24L01_07_RX_DR) | _BV(NRF24L01_07_MAX_RT));
|
||||
NRF24L01_WritePayload(msg, len);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
#define SLT_NFREQCHANNELS 15
|
||||
#define SLT_TXID_SIZE 4
|
||||
#define SLT_BIND_CHANNEL 0x50
|
||||
#define SLT6_CH_MIN 182 // 10-bit AETR minimum (captures: 180-185, symmetric around 512)
|
||||
#define SLT6_CH_MAX 842 // 10-bit AETR maximum (captures: 829-843, symmetric around 512)
|
||||
#define SLT6_SW_THRESHOLD 273 // ~33% of half-range (820/3) for 3-position switch zones
|
||||
|
||||
enum{
|
||||
// flags going to packet[6] (Q200)
|
||||
@@ -54,9 +57,32 @@ enum {
|
||||
SLT_BIND2,
|
||||
};
|
||||
|
||||
// SLT6 sub-cycle states: 3 sub-cycles per triple, each with 2 copies
|
||||
enum {
|
||||
SLT6_BUILD_A=0, // Build packet, configure for 7B sub-cycle
|
||||
SLT6_DATA_A1, // Send 7B copy 1
|
||||
SLT6_DATA_A2, // Send 7B copy 2, configure for 6B sub-cycle
|
||||
SLT6_DATA_B1, // Send 6B copy 1
|
||||
SLT6_DATA_B2, // Send 6B copy 2, configure for 5B sub-cycle
|
||||
SLT6_DATA_C1, // Send 5B copy 1
|
||||
SLT6_DATA_C2, // Send 5B copy 2
|
||||
SLT6_BIND, // Send bind packet
|
||||
};
|
||||
|
||||
// SLT6 address XOR values for the 3 sub-cycles
|
||||
#define SLT6_ADDR_XOR_A 0x00 // 7B sub-cycle: base address
|
||||
#define SLT6_ADDR_XOR_B 0x06 // 6B sub-cycle: byte[0] XOR 0x06
|
||||
#define SLT6_ADDR_XOR_C 0x09 // 5B sub-cycle: byte[0] XOR 0x09
|
||||
|
||||
// SLT6 timing (from capture 12b, in microseconds)
|
||||
#define SLT6_TIMING_SUBCYCLE 5994 // ~6000us between sub-cycle starts
|
||||
#define SLT6_TIMING_PAIR 1633 // ~1633us between the two copies within a sub-cycle
|
||||
#define SLT6_TIMING_BUILD 1000 // Build+config time at start of each triple
|
||||
#define SLT6_TIMING_TRIPLE (3 * SLT6_TIMING_SUBCYCLE) // ~18ms triple period
|
||||
|
||||
static void __attribute__((unused)) SLT_RF_init()
|
||||
{
|
||||
NRF250K_Init();
|
||||
NRF250K_Init(option == 0); // SLT: option==0 uses NRF24L01, option!=0 uses CC2500 with freq tuning
|
||||
NRF250K_SetTXAddr(rx_tx_addr, SLT_TXID_SIZE);
|
||||
}
|
||||
|
||||
@@ -152,8 +178,6 @@ static void __attribute__((unused)) SLT_build_packet()
|
||||
packet[5] = convert_channel_8b(CH5);
|
||||
packet[6] = convert_channel_8b(CH6);
|
||||
|
||||
//->V1 stops here
|
||||
|
||||
if(sub_protocol == Q200)
|
||||
packet[6] = GET_FLAG(CH9_SW , FLAG_Q200_FMODE)
|
||||
|GET_FLAG(CH10_SW, FLAG_Q200_FLIP)
|
||||
@@ -188,6 +212,47 @@ static void __attribute__((unused)) SLT_build_packet()
|
||||
calib_counter = 0;
|
||||
}
|
||||
|
||||
// SLT6: build 7-byte data packet from current channel values
|
||||
static void __attribute__((unused)) SLT6_build_packet()
|
||||
{
|
||||
// aileron, elevator, throttle, rudder (10-bit, limited range)
|
||||
uint8_t e = 0;
|
||||
for (uint8_t i = 0; i < 4; ++i)
|
||||
{
|
||||
uint16_t v = convert_channel_16b_limit(CH_AETR[i], SLT6_CH_MIN, SLT6_CH_MAX);
|
||||
packet[i] = v;
|
||||
e = (e >> 2) | (uint8_t) ((v >> 2) & 0xC0);
|
||||
}
|
||||
packet[4] = e;
|
||||
|
||||
// Flight mode: 3 positions at ~33% each
|
||||
if(Channel_data[CH5] > CHANNEL_MID + SLT6_SW_THRESHOLD)
|
||||
packet[5] = 0xD0;
|
||||
else if(Channel_data[CH5] < CHANNEL_MID - SLT6_SW_THRESHOLD)
|
||||
packet[5] = 0x30;
|
||||
else
|
||||
packet[5] = 0x80;
|
||||
|
||||
// Panic: only active when CH6 is below -33%, center and up = no panic
|
||||
if(Channel_data[CH6] < CHANNEL_MID - SLT6_SW_THRESHOLD)
|
||||
packet[6] = 0x30;
|
||||
else
|
||||
packet[6] = 0xD0;
|
||||
}
|
||||
|
||||
// SLT6: configure radio for a sub-cycle (set address and channel)
|
||||
static void __attribute__((unused)) SLT6_configure_radio(uint8_t addr_xor, uint8_t hop_offset)
|
||||
{
|
||||
SLT_wait_radio();
|
||||
// Set TX address with XOR on byte[0]
|
||||
uint8_t addr[SLT_TXID_SIZE];
|
||||
memcpy(addr, rx_tx_addr, SLT_TXID_SIZE);
|
||||
addr[0] ^= addr_xor;
|
||||
NRF250K_SetTXAddr(addr, SLT_TXID_SIZE);
|
||||
// Set RF channel
|
||||
NRF250K_Hopping((hopping_frequency_no + hop_offset) % SLT_NFREQCHANNELS);
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) SLT_send_bind_packet()
|
||||
{
|
||||
SLT_wait_radio();
|
||||
@@ -197,7 +262,7 @@ static void __attribute__((unused)) SLT_send_bind_packet()
|
||||
BIND_DONE;
|
||||
NRF250K_SetTXAddr((uint8_t *)"\x7E\xB8\x63\xA9", SLT_TXID_SIZE);
|
||||
memcpy((void*)packet, (void*)rx_tx_addr, SLT_TXID_SIZE);
|
||||
if(phase == SLT_BIND2)
|
||||
if(phase == SLT_BIND2 || phase == SLT6_BIND)
|
||||
SLT_send_packet(SLT_TXID_SIZE);
|
||||
else // SLT_BIND1
|
||||
SLT_send_packet(SLT_PAYLOADSIZE_V2);
|
||||
@@ -210,8 +275,71 @@ static void __attribute__((unused)) SLT_send_bind_packet()
|
||||
#define SLT_V1_TIMING_BIND2 1000
|
||||
#define SLT_V2_TIMING_BIND1 6507
|
||||
#define SLT_V2_TIMING_BIND2 2112
|
||||
|
||||
// SLT6 callback: triple-address state machine
|
||||
// Each triple: 3 sub-cycles (7B, 6B, 5B), each sent twice, with different addresses and channels
|
||||
static uint16_t __attribute__((unused)) SLT6_callback()
|
||||
{
|
||||
switch (phase)
|
||||
{
|
||||
case SLT6_BUILD_A:
|
||||
#ifdef MULTI_SYNC
|
||||
telemetry_set_input_sync(SLT6_TIMING_TRIPLE);
|
||||
#endif
|
||||
SLT6_build_packet();
|
||||
NRF250K_SetPower();
|
||||
SLT6_configure_radio(SLT6_ADDR_XOR_A, 0); // 7B sub-cycle: base address, hop+0
|
||||
phase = SLT6_DATA_A1;
|
||||
return SLT6_TIMING_BUILD;
|
||||
case SLT6_DATA_A1:
|
||||
SLT_send_packet(7);
|
||||
phase = SLT6_DATA_A2;
|
||||
return SLT6_TIMING_PAIR; // 1633us between copies
|
||||
case SLT6_DATA_A2:
|
||||
SLT_send_packet(7);
|
||||
SLT6_configure_radio(SLT6_ADDR_XOR_B, 3); // 6B sub-cycle: XOR 0x06 address, hop+3
|
||||
phase = SLT6_DATA_B1;
|
||||
return SLT6_TIMING_SUBCYCLE - SLT6_TIMING_PAIR; // 4361us to next sub-cycle TX
|
||||
case SLT6_DATA_B1:
|
||||
SLT_send_packet(6);
|
||||
phase = SLT6_DATA_B2;
|
||||
return SLT6_TIMING_PAIR;
|
||||
case SLT6_DATA_B2:
|
||||
SLT_send_packet(6);
|
||||
SLT6_configure_radio(SLT6_ADDR_XOR_C, 6); // 5B sub-cycle: XOR 0x09 address, hop+6
|
||||
phase = SLT6_DATA_C1;
|
||||
return SLT6_TIMING_SUBCYCLE - SLT6_TIMING_PAIR; // 4361us
|
||||
case SLT6_DATA_C1:
|
||||
SLT_send_packet(5);
|
||||
phase = SLT6_DATA_C2;
|
||||
return SLT6_TIMING_PAIR;
|
||||
case SLT6_DATA_C2:
|
||||
SLT_send_packet(5);
|
||||
// Advance hopping for next triple
|
||||
if (++hopping_frequency_no >= SLT_NFREQCHANNELS)
|
||||
hopping_frequency_no = 0;
|
||||
if (++packet_count >= 100)
|
||||
{// Send bind packet periodically
|
||||
packet_count = 0;
|
||||
phase = SLT6_BIND;
|
||||
return SLT_V1_TIMING_BIND2;
|
||||
}
|
||||
phase = SLT6_BUILD_A;
|
||||
return SLT6_TIMING_SUBCYCLE - SLT6_TIMING_PAIR - SLT6_TIMING_BUILD; // Gap before next build
|
||||
case SLT6_BIND:
|
||||
SLT_send_bind_packet();
|
||||
phase = SLT6_BUILD_A;
|
||||
return SLT6_TIMING_SUBCYCLE - SLT6_TIMING_PAIR - SLT6_TIMING_BUILD;
|
||||
}
|
||||
return SLT6_TIMING_TRIPLE;
|
||||
}
|
||||
|
||||
uint16_t SLT_callback()
|
||||
{
|
||||
// SLT6 has its own state machine
|
||||
if(sub_protocol == SLT6TX)
|
||||
return SLT6_callback();
|
||||
|
||||
switch (phase)
|
||||
{
|
||||
case SLT_BUILD:
|
||||
@@ -285,7 +413,15 @@ void SLT_init()
|
||||
packet_sent = 0;
|
||||
hopping_frequency_no = 0;
|
||||
|
||||
if(sub_protocol == SLT_V1)
|
||||
if(sub_protocol == SLT6TX)
|
||||
{
|
||||
hopping_frequency_no = 1; // SLT6 starts hopping at index 1 (verified from captures)
|
||||
// packet_length not used for SLT6 (lengths vary per sub-cycle)
|
||||
#ifdef MULTI_SYNC
|
||||
packet_period = SLT6_TIMING_TRIPLE;
|
||||
#endif
|
||||
}
|
||||
else if(sub_protocol == SLT_V1)
|
||||
{
|
||||
packet_length = SLT_PAYLOADSIZE_V1;
|
||||
#ifdef MULTI_SYNC
|
||||
@@ -326,7 +462,10 @@ void SLT_init()
|
||||
SLT_RF_init();
|
||||
SLT_set_freq();
|
||||
|
||||
phase = SLT_BUILD;
|
||||
if(sub_protocol == SLT6TX)
|
||||
phase = SLT6_BUILD_A;
|
||||
else
|
||||
phase = SLT_BUILD;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -69,6 +69,11 @@
|
||||
|
||||
// Check forced tuning values are valid
|
||||
//CC2500
|
||||
#ifdef FORCE_ARES_TUNING
|
||||
#if ( FORCE_ARES_TUNING < -127 ) || ( FORCE_ARES_TUNING > 127 )
|
||||
#error "The ARES 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."
|
||||
@@ -276,6 +281,7 @@
|
||||
#endif
|
||||
|
||||
#if not defined(CC2500_INSTALLED) || defined MULTI_EU
|
||||
#undef ARES_CC2500_INO
|
||||
#undef CORONA_CC2500_INO
|
||||
#undef E016HV2_CC2500_INO
|
||||
#undef ESKY150V2_CC2500_INO
|
||||
@@ -410,6 +416,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef MULTI_SURFACE
|
||||
#undef ARES_CC2500_INO
|
||||
#undef BUGS_A7105_INO
|
||||
#undef HEIGHT_A7105_INO
|
||||
#undef HUBSAN_A7105_INO
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
//#define FORCE_REDPINE_TUNING 0
|
||||
//#define FORCE_FUTABA_TUNING 0
|
||||
//#define FORCE_SKYARTEC_TUNING 0
|
||||
//#define FORCE_ARES_TUNING 0
|
||||
|
||||
/** A7105 Fine Frequency Tuning **/
|
||||
//This is required in rare cases where some A7105 modules and/or RXs have an inaccurate crystal oscillator.
|
||||
@@ -205,6 +206,7 @@
|
||||
#define WK2x01_CYRF6936_INO
|
||||
|
||||
//The protocols below need a CC2500 to be installed
|
||||
#define ARES_CC2500_INO
|
||||
#define CORONA_CC2500_INO
|
||||
#define E016HV2_CC2500_INO
|
||||
#define ESKY150V2_CC2500_INO
|
||||
@@ -213,11 +215,11 @@
|
||||
#define FRSKYV_CC2500_INO
|
||||
#define FRSKYX_CC2500_INO //Include FRSKYX2 protocol
|
||||
#define FRSKY_RX_CC2500_INO
|
||||
#define FUTABA_CC2500_INO
|
||||
#define HITEC_CC2500_INO
|
||||
#define HOTT_CC2500_INO
|
||||
//#define IKEAANSLUTA_CC2500_INO // This is mostly a "for-fun" kind of a thing, not needed for most users
|
||||
#define SCANNER_CC2500_INO
|
||||
#define FUTABA_CC2500_INO
|
||||
#define SKYARTEC_CC2500_INO
|
||||
#define REDPINE_CC2500_INO
|
||||
#define RLINK_CC2500_INO
|
||||
@@ -565,6 +567,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
||||
// - 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_ARES
|
||||
NONE
|
||||
PROTO_AFHDS2A
|
||||
PWM_IBUS
|
||||
PPM_IBUS
|
||||
@@ -858,6 +862,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
||||
MR100
|
||||
V1_4CH
|
||||
RF_SIM
|
||||
SLT6TX
|
||||
PROTO_SYMAX
|
||||
SYMAX
|
||||
SYMAX5C
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
//////////////
|
||||
// Functions
|
||||
#define NRF250K_Init() XN297_Configure(XN297_CRCEN, XN297_SCRAMBLED, XN297_250K)
|
||||
#define NRF250K_Init(X) XN297_Configure(XN297_CRCEN, XN297_SCRAMBLED, XN297_250K, X)
|
||||
#define NRF250K_HoppingCalib(X) XN297_HoppingCalib(X)
|
||||
#define NRF250K_Hopping(X) XN297_Hopping(X)
|
||||
#define NRF250K_RFChannel(X) XN297_RFChannel(X)
|
||||
|
||||
@@ -63,6 +63,7 @@ You've upgraded the module but the radio does not display the name of the protoc
|
||||
|
||||
Protocol Name|Build|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
|
||||
---|---|---|---|---|---|---|---|---|---|---|---|---
|
||||
[Ares](Protocols_Details.md#Ares---108)|AIR|108|||||||||CC2500|
|
||||
[Assan](Protocols_Details.md#ASSAN---24)|AIR/SFC|24|||||||||NRF24L01|
|
||||
[Bayang](Protocols_Details.md#BAYANG---14)|AIR/SFC|14|Bayang|H8S3D|X16_AH|IRDRONE|DHD_D4|QX100|||NRF24L01|XN297
|
||||
[Bayang RX](Protocols_Details.md#BAYANG-RX---59)|AIR/SFC|59|Multi|CPPM|||||||NRF24L01|XN297
|
||||
@@ -146,7 +147,7 @@ CFlie|AIR|38|CFlie||||||||NRF24L01|
|
||||
[Shenqi](Protocols_Details.md#Shenqi---19)||19|Shenqi||||||||NRF24L01|LT8900
|
||||
[Shenqi2](Protocols_Details.md#Shenqi2---105)||105|Shenqi2||||||||NRF24L01|XN297
|
||||
[Skyartec](Protocols_Details.md#Skyartec---68)||68|||||||||CC2500|CC2500
|
||||
[SLT](Protocols_Details.md#SLT---11)||11|SLT_V1|SLT_V2|Q100|Q200|MR100|V1_4CH|RF_SIM||NRF24L01|CC2500
|
||||
[SLT](Protocols_Details.md#SLT---11)||11|SLT_V1|SLT_V2|Q100|Q200|MR100|V1_4CH|RF_SIM|SLT6TX|NRF24L01|CC2500
|
||||
[SymaX](Protocols_Details.md#Symax---10)||10|SYMAX|SYMAX5C|||||||NRF24L01|
|
||||
[Traxxas](Protocols_Details.md#Traxxas---43)||43|TQ2|TQ1|||||||CYRF6936|
|
||||
[V2x2](Protocols_Details.md#V2X2---5)||5|V2x2|JXD506|MR101||||||NRF24L01|
|
||||
@@ -761,6 +762,24 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9
|
||||
***
|
||||
# CC2500 RF Module
|
||||
|
||||
## Ares - *108*
|
||||
Models: ARES Gamma 370, P-51D Mustang 350, RTF models with 6HPA-Tx and AZS12006-Rx (6 channel).
|
||||
|
||||
Autobind protocol:
|
||||
- to bind, power on the TX first
|
||||
- then power on the receiver - LED slow flash
|
||||
- press receiver bind button - LED faster flash
|
||||
- receiver LED will flash quickly (15 seconds) when bound LED turns solid
|
||||
|
||||
Receiver numbers (0-63) available for model match, MPM global ID used for unique module identifier. Changing the TX module or RX number will require re-binding the receiver.
|
||||
|
||||
Option for this protocol corresponds to fine frequency tuning. 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.
|
||||
|
||||
CH1|CH2|CH3|CH4|CH5|CH6
|
||||
---|---|---|---|---|---
|
||||
CH1|CH2|CH3|CH4|CH5|CH6
|
||||
|
||||
## CORONA - *37*
|
||||
Models: Corona 2.4GHz FSS and DSSS receivers.
|
||||
|
||||
@@ -1532,6 +1551,16 @@ Please save radio-profile with a new name without setting reset-button in RF8. T
|
||||
|
||||
Find the [Reset21] section and change Input=INT:-1 to Input=INT:9
|
||||
|
||||
### Sub_protocol SLT6TX - *7*
|
||||
Models: Blade Revolution 90 FP helicopter (SLT6 transmitter)
|
||||
|
||||
CH1|CH2|CH3|CH4|CH5|CH6
|
||||
---|---|---|---|---|---
|
||||
A|E|T|R|FMODE|PANIC
|
||||
|
||||
FMODE: flight mode switch (3-position)
|
||||
|
||||
PANIC: panic/recovery button
|
||||
|
||||
## V911S - *46*
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ mv build/Multiprotocol.ino.bin ./binaries/mm-avr-usbasp-aetr-A7105-inv-v$MULTI_V
|
||||
printf "\e[33;1mBuilding mm-avr-usbasp-aetr-CC2500-inv-v$MULTI_VERSION.bin\e[0m\n";
|
||||
opt_disable $ALL_PROTOCOLS;
|
||||
opt_enable $CC2500_PROTOCOLS;
|
||||
opt_disable HITEC_CC2500_INO REDPINE_CC2500_INO OMP_CC2500_INO SKYARTEC_CC2500_INO SCANNER_CC2500_INO FRSKYL_CC2500_INO;
|
||||
opt_disable HITEC_CC2500_INO REDPINE_CC2500_INO OMP_CC2500_INO SKYARTEC_CC2500_INO SCANNER_CC2500_INO FRSKYL_CC2500_INO ARES_CC2500_INO;
|
||||
buildMulti;
|
||||
exitcode=$((exitcode+$?));
|
||||
mv build/Multiprotocol.ino.bin ./binaries/mm-avr-usbasp-aetr-CC2500-inv-v$MULTI_VERSION.bin;
|
||||
|
||||
@@ -14,7 +14,7 @@ mv build/Multiprotocol.ino.bin ./binaries/mm-avr-txflash-aetr-A7105-inv-v$MULTI_
|
||||
printf "\e[33;1mBuilding mm-avr-txflash-aetr-CC2500-inv-v$MULTI_VERSION.bin\e[0m\n";
|
||||
opt_disable $ALL_PROTOCOLS;
|
||||
opt_enable $CC2500_PROTOCOLS;
|
||||
opt_disable HITEC_CC2500_INO REDPINE_CC2500_INO OMP_CC2500_INO SKYARTEC_CC2500_INO SCANNER_CC2500_INO FRSKYL_CC2500_INO RLINK_CC2500_INO;
|
||||
opt_disable HITEC_CC2500_INO REDPINE_CC2500_INO OMP_CC2500_INO SKYARTEC_CC2500_INO SCANNER_CC2500_INO FRSKYL_CC2500_INO RLINK_CC2500_INO ARES_CC2500_INO;
|
||||
buildMulti;
|
||||
exitcode=$((exitcode+$?));
|
||||
mv build/Multiprotocol.ino.bin ./binaries/mm-avr-txflash-aetr-CC2500-inv-v$MULTI_VERSION.bin;
|
||||
|
||||
Reference in New Issue
Block a user