Skip to content

Commit 565aaed

Browse files
committed
New XK2/P10 sub protocol
1 parent 2f520f2 commit 565aaed

File tree

7 files changed

+103
-16
lines changed

7 files changed

+103
-16
lines changed

Lua_scripts/MultiChan.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
62,1,XK,X420,1,FMode,TakeOf,Emerg,3D_6G,Pict,Video,Flip,Light
196196
62,2,XK,Cars,0,FMode,TakeOf,Emerg,3D_6G,Pict,Video,Flip,Light
197197
99,0,XK2,X4,0,Rate,Mode,Hover,Light
198+
99,1,XK2,P10,0,Rate,Mode,Hover,Light
198199
8,0,YD717,Std,1,Flip,Light,Pict,Video,HLess
199200
8,1,YD717,SkyWlkr,1,Flip,Light,Pict,Video,HLess
200201
8,2,YD717,Simax4,1,Flip,Light,Pict,Video,HLess

Multiprotocol/Multi.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
96,BumbleB
9696
97,SGF22,F22,F22S,J20
9797
98,Kyosho3
98-
99,XK2
98+
99,XK2,X4,P10
9999
100,YuXiang
100100
102,JIABAILE,STD,GYRO
101101
103,H36

Multiprotocol/Multi_Protos.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ const char STR_SUBTYPE_ESKY150[] = "\x03""4ch""7ch";
165165
const char STR_SUBTYPE_ESKY150V2[] = "\x05""150V2";
166166
const char STR_SUBTYPE_V911S[] = "\x05""V911S""E119\0";
167167
const char STR_SUBTYPE_XK[] = "\x04""X450""X420""Cars";
168+
const char STR_SUBTYPE_XK2[] = "\x03""X4\0""P10";
168169
const char STR_SUBTYPE_FRSKYR9[] = "\x07""915MHz\0""868MHz\0""915 8ch""868 8ch""FCC\0 ""--\0 ""FCC 8ch""-- 8ch\0";
169170
const char STR_SUBTYPE_ESKY[] = "\x03""Std""ET4";
170171
const char STR_SUBTYPE_PROPEL[] = "\x04""74-Z";
@@ -512,7 +513,7 @@ const mm_protocol_definition multi_protocols[] = {
512513
{PROTO_XK, STR_XK, STR_SUBTYPE_XK, 3, OPTION_RFTUNE, 0, 0, SW_NRF, XK_init, XK_callback },
513514
#endif
514515
#if defined(XK2_CCNRF_INO)
515-
{PROTO_XK2, STR_XK2, NO_SUBTYPE, 0, OPTION_RFTUNE, 0, 0, SW_NRF, XK2_init, XK2_callback },
516+
{PROTO_XK2, STR_XK2, STR_SUBTYPE_XK2, 2, OPTION_RFTUNE, 0, 0, SW_NRF, XK2_init, XK2_callback },
516517
#endif
517518
#if defined(XN297DUMP_NRF24L01_INO)
518519
{PROTO_XN297DUMP, STR_XN297DUMP, STR_SUBTYPE_XN297DUMP, 7, OPTION_RFCHAN, 0, 0, SW_NRF, XN297Dump_init, XN297Dump_callback },

Multiprotocol/Multiprotocol.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define VERSION_MAJOR 1
2020
#define VERSION_MINOR 3
2121
#define VERSION_REVISION 4
22-
#define VERSION_PATCH_LEVEL 30
22+
#define VERSION_PATCH_LEVEL 31
2323

2424
#define MODE_SERIAL 0
2525

@@ -500,6 +500,11 @@ enum JIABAILE
500500
JIABAILE_STD = 0,
501501
JIABAILE_GYRO = 1,
502502
};
503+
enum XK2
504+
{
505+
XK2_X4 = 0,
506+
XK2_P10 = 1,
507+
};
503508

504509
#define NONE 0
505510
#define P_HIGH 1

Multiprotocol/XK2_ccnrf.ino

Lines changed: 75 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ Multiprotocol is distributed in the hope that it will be useful,
1919
#include "iface_xn297.h"
2020

2121
//#define FORCE_XK2_ID
22+
//#define FORCE_XK2_P10_ID
2223

2324
#define XK2_RF_BIND_CHANNEL 71
25+
#define XK2_P10_RF_BIND_CHANNEL 69
2426
#define XK2_PAYLOAD_SIZE 9
2527
#define XK2_PACKET_PERIOD 4911
2628
#define XK2_RF_NUM_CHANNELS 4
@@ -46,7 +48,7 @@ static void __attribute__((unused)) XK2_send_packet()
4648
//Unknown
4749
packet[7] = 0x00;
4850
//Checksum seed
49-
packet[8] = 0xC0; //Constant?
51+
packet[8] = 0xC0;
5052
}
5153
else
5254
{
@@ -74,14 +76,16 @@ static void __attribute__((unused)) XK2_send_packet()
7476
| GET_FLAG(CH8_SW, 0x40); //Light
7577
//Telemetry not received=00, Telemetry received=01 but sometimes switch to 1 even if telemetry is not there...
7678
packet[6] = 0x00;
77-
//Unknown
79+
//RXID checksum
7880
packet[7] = crc8; //Sum RX_ID[0..2]
7981
//Checksum seed
8082
packet[8] = num_ch; //Based on TX ID
8183
}
8284
//Checksum
8385
for(uint8_t i=0; i<XK2_PAYLOAD_SIZE-1; i++)
8486
packet[8] += packet[i];
87+
if(sub_protocol == XK2_P10)
88+
packet[8] += 0x10;
8589

8690
// Send
8791
XN297_SetFreqOffset();
@@ -104,11 +108,22 @@ static void __attribute__((unused)) XK2_RF_init()
104108
XN297_SetRXAddr((uint8_t*)"\xcc\xcc\xcc\xcc\xcc", XK2_PAYLOAD_SIZE);
105109

106110
XN297_HoppingCalib(XK2_RF_NUM_CHANNELS);
107-
XN297_RFChannel(XK2_RF_BIND_CHANNEL);
111+
XN297_RFChannel(sub_protocol==XK2_X4?XK2_RF_BIND_CHANNEL:XK2_P10_RF_BIND_CHANNEL);
108112
}
109113

110114
static void __attribute__((unused)) XK2_initialize_txid()
111115
{
116+
rx_tx_addr[0] = rx_tx_addr[3]; // Use RX_num
117+
118+
num_ch = 0x21 + rx_tx_addr[0] - rx_tx_addr[1] + rx_tx_addr[2];
119+
120+
//RF frequencies for X4: 65=0x41, 69=0x45, 73=0x49, 77=0x4D
121+
//RF frequencies for P10: 67, unknown
122+
uint8_t start = 65;
123+
if(sub_protocol == XK2_P10) start += 2;
124+
for(uint8_t i=0;i<XK2_RF_NUM_CHANNELS;i++)
125+
hopping_frequency[i] = start + i*4;
126+
112127
#ifdef FORCE_XK2_ID
113128
if(rx_tx_addr[3]&1)
114129
{//Pascal
@@ -127,13 +142,15 @@ static void __attribute__((unused)) XK2_initialize_txid()
127142
//hopping frequencies 65=0x41, 69=0x45, 73=0x49, 77=0x4D
128143
}
129144
#endif
130-
rx_tx_addr[0] = rx_tx_addr[3]; // Use RX_num
131-
rx_tx_addr[3] = rx_tx_addr[4] = 0xCC;
132-
num_ch = 0x21 + rx_tx_addr[0] - rx_tx_addr[1] + rx_tx_addr[2];
133-
134-
for(uint8_t i=0;i<XK2_RF_NUM_CHANNELS;i++) // Are these RF frequencies always the same? It looks like yes...
135-
hopping_frequency[i] = 65 + i*4; //65=0x41, 69=0x45, 73=0x49, 77=0x4D
145+
#ifdef FORCE_XK2_P10_ID
146+
rx_tx_addr[0] = 0xE8;
147+
rx_tx_addr[1] = 0x25;
148+
rx_tx_addr[2] = 0x3B;
149+
num_ch = 0x1F;
150+
//hopping frequencies 67=0x43, =0x, =0x, =0x
151+
#endif
136152

153+
rx_tx_addr[3] = rx_tx_addr[4] = 0xCC;
137154
debugln("ID: %02X %02X %02X %02X %02X, OFFSET: %02X, HOP: %02X %02X %02X %02X",rx_tx_addr[0],rx_tx_addr[1],rx_tx_addr[2],rx_tx_addr[3],rx_tx_addr[4],num_ch,hopping_frequency[0],hopping_frequency[1],hopping_frequency[2],hopping_frequency[3]);
138155
}
139156

@@ -160,6 +177,8 @@ uint16_t XK2_callback()
160177
crc8 = 0xBF;
161178
for(uint8_t i=0; i<XK2_PAYLOAD_SIZE-1; i++)
162179
crc8 += packet[i];
180+
if(sub_protocol == XK2_P10)
181+
crc8 += 0x10;
163182
if(crc8 != packet[8])
164183
{
165184
phase = XK2_BIND1;
@@ -292,8 +311,8 @@ P[5] = flags
292311
08=6g/3d=short_press_right sequece also switches for a few packets to C1 if 8 C0 if 0
293312
P[6] = 00 telemetry nok
294313
01 telemetry ok but sometimes switch to 1 also when telemetry is nok...
295-
P[7] = 5A -> ?? RX_ID checksum ?? => sum RX_ID[0..2]
296-
P[8] = sum P[0..7] + 7F
314+
P[7] = 5A -> sum RX_ID[0..2]
315+
P[8] = sum P[0..7] + TX_ID[0] - TX_ID[1] + TX_ID[2] + 21
297316
298317
Telemetry
299318
RX on channel: 69, Time: 3408us P: 66 4F 47 00 00 00 00 00 C8
@@ -313,4 +332,49 @@ RF
313332
2477 151753 5769
314333
2465 155330 3577
315334
335+
*/
336+
/* P10 Piper CUB
337+
Bind
338+
----
339+
Phase 1
340+
Plane sends these packets:
341+
250K C=69 S=Y A= CC CC CC CC CC P(9)= 9C BB CC DD 84 24 20 00 97
342+
P[0] = 9C bind phase 1
343+
P[1] = Dummy TX_ID
344+
P[2] = Dummy TX_ID
345+
P[3] = Dummy TX_ID
346+
P[4] = RX_ID[0]
347+
P[5] = RX_ID[1]
348+
P[6] = RX_ID[2]
349+
P[7] = 00
350+
P[8] = sum P[0..7] + BF + 10
351+
352+
Normal
353+
------
354+
TX sends
355+
C=67 -> only one channel when telemetry is working
356+
A= E8 25 3B CC CC P(9)= 32 32 00 32 A0 40 01 C8 6E
357+
P[0] = A 00..32..64
358+
P[1] = E 00..32..64
359+
P[2] = T 00..64
360+
P[3] = R 00..32..64
361+
P[4] = alternates 20,60,A0,E0
362+
trims
363+
A 01..20..3F
364+
E 41..60..7F
365+
R 81..A0..BF
366+
telemetry
367+
E0 present when the telemetry works
368+
6g/3d
369+
C1 few times if P[6] flag 00->08
370+
C0 few times if P[6] = flag 08->00
371+
P[5] = flags
372+
01=high rate
373+
20=hover=long_press_left
374+
40=light -> temporary
375+
08=6g/3d=short_press_right sequece also switches for a few packets to C1 if 8 C0 if 0
376+
P[6] = 00 telemetry nok
377+
01 telemetry ok but sometimes switch to 1 also when telemetry is nok...
378+
P[7] = C8 -> sum RX_ID[0..2]
379+
P[8] = sum P[0..7] + TX_ID[0] - TX_ID[1] + TX_ID[2] + 21 +10
316380
*/

Multiprotocol/_Config.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
873873
X420
874874
XK_CARS
875875
PROTO_XK2
876-
NONE
876+
XK2_X4
877+
XK2_P10
877878
PROTO_YD717
878879
YD717
879880
SKYWLKR

Protocols_Details.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ CFlie|38|CFlie||||||||NRF24L01|
155155
[WK2x01](Protocols_Details.md#WK2X01---30)|30|WK2801|WK2401|W6_5_1|W6_6_1|W6_HEL|W6_HEL_I|||CYRF6936|
156156
[XERALL](Protocols_Details.md#XERALL---91)|91|Tank||||||||NRF24L01|XN297
157157
[XK](Protocols_Details.md#XK---62)|62|X450|X420|Cars||||||NRF24L011&CC2500|XN297
158-
[XK2](Protocols_Details.md#XK2---99)|99|X4||||||||NRF24L01&CC2500|XN297
158+
[XK2](Protocols_Details.md#XK2---99)|99|X4|P10|||||||NRF24L01&CC2500|XN297
159159
[YD717](Protocols_Details.md#YD717---8)|8|YD717|SKYWLKR|SYMAX4|XINXUN|NIHUI||||NRF24L01|
160160
[YuXiang](Protocols_Details.md#YuXiang---100)|100|||||||||NRF24L01|XN297
161161
[ZSX](Protocols_Details.md#ZSX---52)|52|280||||||||NRF24L01|XN297
@@ -1535,6 +1535,21 @@ The plane does not need to be bound each time if it is powered on **after** the
15351535

15361536
The rudder trim is driven from the rudder channel to increase the range (Original TX rudder has no range once the motor has been turned on...).
15371537

1538+
### Sub_protocol P10 - *1*
1539+
Model: Park10 J3-CUB
1540+
1541+
If a CC2500 is installed it will be used for this sub protocol. Option in this case is used for fine frequency tuning like any CC2500 protocols so check the [Frequency Tuning page](/docs/Frequency_Tuning.md).
1542+
1543+
If only a NRF24L01 is installed then this sub protocol might be problematic because it is using the xn297L emulation with a transmission speed of 250kbps which doesn't work very well with every NRF24L01, this is an hardware issue with the authenticity and accuracy of the components.
1544+
1545+
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
1546+
---|---|---|---|---|---|---|---
1547+
A|E|T|R|Rate|Mode|Hover|Light
1548+
1549+
The plane does not need to be bound each time if it is powered on **after** the radio/protocol is on.
1550+
1551+
The rudder trim is driven from the rudder channel to increase the range (Original TX rudder has no range once the motor has been turned on...).
1552+
15381553
***
15391554
# NRF24L01 RF Module
15401555

0 commit comments

Comments
 (0)