DSM2/X protocol errors

More
23 Sep 2016 16:50 - 26 Sep 2016 11:29 #54179 by vlad_vy
DSM2/X protocol errors was created by vlad_vy
I think we need correct DSM.txt file and dsm2_cyrf6936.c

Note: Values are LSB 1st
0 1 2 3 4
0 03BC6E8AEFBDFEF8 83F7A82D7A4464D3 405632D90FD95D97 C0908FBB7C8E2B8E E1D631265FBD4093
1 8817133B2DBF06D6 3F2C4EAA71487AC9 8E4AD0A9A7FF20CA 8069268008F849E7 DC68089997AEAF8C
2 F1943021A11C88A9 17FF9E213690C782 4C979DBFB83DB5BE 7D2D4954D08040C1 C30E01160E3206BA
3 D0D28EBC822FE3B4 BC5D9A5BEE7F42EB 0C5D24309FCA6DBD B6F2E61B805A36B4 E08301FAAB3E8FAC
4 8CFA479B83A566D0 24F5DDF87A7774E7 501433DEF17895AD 42AE9C1CDA6705F6 5CD59CB8469C7D84
5 07BD9F26C8310FB8 3D707C94DC84AD95 0C3CFAF9F0F210C9 9B75F7E0148DB580 F1C6FE5C9DA54FB7
6 EF039589B471619D 1E6AF037527B11D4 F4DA06DBBF4E6FB3 BF5498B9B7305A88 58B5B3DD0E28F1B0
7 40BA97D5864FCCD1 62F52BAAFC33BFAF 9E08D1AE595EE8F0 35D1FC9723D4C988 5F303B569645F4A1
8 D7A154B15E89AE86 405632D90FD95D97 C0908FBB7C8E2B8E 88E1D631265FBD40 03BC6E8AEFBDFEF8

Bold value is incorrect, it has to be E1D631265FBD4093

I found next:

DX7
Channel [channel=1, sop=83f7a82d7a4464d3, pn=62f52baafc33bfaf405632d90fd95d97, crc_lsb=11, crx_msb=b4]
Channel [channel=1, sop=83f7a82d7a4464d3, pn=62f52baafc33bfaf405632d90fd95d97, crc_lsb=ee, crx_msb=4b]
Channel [channel=2, sop=405632d90fd95d97, pn=9e08d1ae595ee8f0c0908fbb7c8e2b8e, crc_lsb=11, crx_msb=b4]
Channel [channel=2, sop=405632d90fd95d97, pn=9e08d1ae595ee8f0c0908fbb7c8e2b8e, crc_lsb=ee, crx_msb=4b]
Channel [channel=3, sop=c0908fbb7c8e2b8e, pn=35d1fc9723d4c988e1d631265fbd4093, crc_lsb=11, crx_msb=b4]
Channel [channel=3, sop=c0908fbb7c8e2b8e, pn=35d1fc9723d4c988e1d631265fbd4093, crc_lsb=ee, crx_msb=4b]
Channel [channel=4, sop=e1d631265fbd4093, pn=5f303b569645f4a103bc6e8aefbdfef8, crc_lsb=ee, crx_msb=4b]
Channel [channel=4, sop=e1d631265fbd4093, pn=5f303b569645f4a103bc6e8aefbdfef8, crc_lsb=11, crx_msb=b4]
Channel [channel=5, sop=03bc6e8aefbdfef8, pn=40ba97d5864fccd1d7a154b15e89ae86, crc_lsb=ee, crx_msb=4b]
Channel [channel=5, sop=03bc6e8aefbdfef8, pn=40ba97d5864fccd1d7a154b15e89ae86, crc_lsb=11, crx_msb=b4]

Row 3 Col 8 in pncodes[5][9][8] table exactly has to be e1d631265fbd4093. Most likely it is very old copy paste error.

By the way, Orange receivers have the same error.
Last edit: 26 Sep 2016 11:29 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
24 Sep 2016 07:26 - 24 Sep 2016 09:44 #54200 by vlad_vy
Replied by vlad_vy on topic DSM2/X protocol error
To avoid problems with Orange Rx we can add protocol option "OrangeRx" = "No", "Yes" with default "No" and use for Orange Rx incorrect 88E1D631265FBD40 value instead correct E1D631265FBD4093 value.

static void set_sop_data_crc()
{
    u8 pn_row = get_pn_row(channels[chidx]);
    u8 data_code[16];
    //printf("Ch: %d Row: %d SOP: %d Data: %d\n", ch[chidx], pn_row, sop_col, data_col);
    CYRF_ConfigRFChannel(channels[chidx]);
    CYRF_ConfigCRCSeed(crcidx ? ~crc : crc);
    CYRF_ConfigSOPCode(pncodes[pn_row][sop_col]);
    memcpy(data_code, pncodes[pn_row][data_col], 8);
    if((pn_row == 3) && (data_col == 7) && (Model.proto_opts[PROTOOPTS_ORANGERX] == 1)){
        memcpy(data_code + 8, (void *)"\x88\xE1\xD6\x31\x26\x5F\xBD\x40", 8);
    } else {
        memcpy(data_code + 8, pncodes[pn_row][data_col + 1], 8);
    }
    CYRF_ConfigDataCode(data_code, 16);
    /* setup for next iteration */
    if(Model.protocol == PROTOCOL_DSMX)
        chidx = (chidx + 1) % 23;
    else
        chidx = (chidx + 1) % 2;
    crcidx = !crcidx;
}
Last edit: 24 Sep 2016 09:44 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
24 Sep 2016 07:36 - 24 Sep 2016 07:38 #54201 by petsmith
Replied by petsmith on topic DSM2/X protocol error
What does this affect? Will it cause dropout issues? Does this only affect Hobbyking's Orange receivers, not the original Spectrums? I've a few Orange R410X receivers running DSMX and all of them resulted in dropouts even for close range flying. I was thinking my Transmitter hardware was the culprit.
Last edit: 24 Sep 2016 07:38 by petsmith.

Please Log in or Create an account to join the conversation.

More
24 Sep 2016 07:41 - 24 Sep 2016 07:43 #54202 by vlad_vy
Replied by vlad_vy on topic DSM2/X protocol error
For current builds it's not the case for Orange Rx, but for others. Error isn't yet corrected. It can lead to incorrect Rx functioning, most likely dropped frames.

At any case it can appears rarely, it depends from your Tx ID and Fixed ID.
Last edit: 24 Sep 2016 07:43 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
24 Sep 2016 07:51 #54203 by petsmith
Replied by petsmith on topic DSM2/X protocol error

vlad_vy wrote: For current builds it's not the case for Orange Rx, but for others. Error isn't yet corrected. It can lead to incorrect Rx functioning, most likely dropped frames.

At any case it can appears rarely, it depends from your Tx ID and Fixed ID.


I see. So, my dropout issue is something else than. Thanks for the heads up.

Please Log in or Create an account to join the conversation.

More
24 Sep 2016 08:48 - 24 Sep 2016 08:51 #54204 by Thomas.Heiss
Replied by Thomas.Heiss on topic DSM2/X protocol error

vlad_vy wrote: For current builds it's not the case for Orange Rx, but for others. Error isn't yet corrected. It can lead to incorrect Rx functioning, most likely dropped frames.
At any case it can appears rarely, it depends from your Tx ID and Fixed ID.


Sorry I do not understand.

"others" means it affects all genuine Spektrum receivers??
Also TM1000 / TM1100 do RECEIVE frames on their own (listen before talk LBT) before sending back telemetry packets to TX! Lost packets would get you more often telemetry out-of-range errors if the TM1000 can not regularly send back.

Spektrum TX + receivers do it "right" (of course), so Spektrum receivers except the change while OrangeRX are coded wrong??

Did I understand you right?

How many frames would you except to be dropped max according to the old protocol DSM code Vlad?

My FlightLog shows me Fades A + Fades B or L < 100, FrameLosses 0 to max 10-20 (if ever), Holds 0. Same for release 5.0.0 as fcd0669. So I am very okay with that for DSMx.
I would care more if FlightLog Fades = 0xFF/255 (on all of two receivers/SAT) and FrameLosses >40-90 all the time or Holds >0.
Even genuine Spektrum DX8G1 +AR6210/AR600/AR8000 showed Fades + some FrameLosses (not always F=0) :)
Last edit: 24 Sep 2016 08:51 by Thomas.Heiss.

Please Log in or Create an account to join the conversation.

More
24 Sep 2016 09:20 #54205 by vlad_vy
Replied by vlad_vy on topic DSM2/X protocol error
Yes, at current state it affects all genuine Spektrum, Lemon receivers, probably any other, except Orange.

Please Log in or Create an account to join the conversation.

More
24 Sep 2016 09:50 #54206 by vlad_vy
Replied by vlad_vy on topic DSM2/X protocol error
It will be:

Attachments:

Please Log in or Create an account to join the conversation.

More
24 Sep 2016 10:24 - 01 Oct 2016 15:34 #54207 by vlad_vy
Replied by vlad_vy on topic DSM2/X protocol error
Since current DSM code do not allow to add even one line of code and fit to Devo7e, I partially rewrite code and it fit to Devo7e with added changes. At least new code work at the bench with Spektrum AR6210 and AR8000. Probably someone can add it to main repository.

File deleted, see below.
Last edit: 01 Oct 2016 15:34 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
25 Sep 2016 12:55 - 01 Oct 2016 15:35 #54246 by vlad_vy
Replied by vlad_vy on topic DSM2/X protocol error
Added "HighSpeed" 11ms protocol option. Once again, I partially rewrite the code and it fit to Devo7e with added changes.

High Speed 11ms work with number of channels 8-10, at channels 2, 3, 4, 6 (Aileron, Elevator, Rudder, Pitch/Flap/AUX01). Other channels have refresh rate 22ms.

Probably someone can add it to main repository.




File deleted, see below.
Attachments:
Last edit: 01 Oct 2016 15:35 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
25 Sep 2016 13:30 - 25 Sep 2016 13:38 #54247 by Thomas.Heiss
Replied by Thomas.Heiss on topic DSM2/X protocol error
Hi Vlad,

great findings / enhancements. Thanks!
Wasn't there in a thread a x-plus 16/18 channel protocol code some time ago too? :)


I don't understand about high speed 11ms on CH1, CH5 and CH7.

There are guys who setup 4-aileron-type gliders on THR + CH5/GEAR ports or
CH5 flap + CH7 if e-motor glider on THR port.

For Spektrum ailerons will always be AIL + AUX1.

Then there is the dual elevator stuff on ELEV+AUX7...

If CH 2,3,4,6 + 8-10 is fixed for 11ms I am fine with that too of course.
Best would be to write it into the GUI-window as a notice?
Or maybe an info in the (servo) channel configuration list itself (e.g as a info field if 11ms or 22ms if choosen HighSpeed)?
I somehow don't like that it is written on a forum but not in the firmware itself :) Is a text notice / channel info too big for Devo7E?

Thanks for your support Vlad!

Thomas
Last edit: 25 Sep 2016 13:38 by Thomas.Heiss.

Please Log in or Create an account to join the conversation.

More
25 Sep 2016 14:22 - 25 Sep 2016 14:34 #54249 by vlad_vy
Replied by vlad_vy on topic DSM2/X protocol error
Protocol module for Devo 7e kill all possible modifications for DSM2/X protocol. Now I can't add even single line of code, it doesn't fit to Devo7e. Now some strange things has place with code, if I exchange two adjacent lines of code, it doesn't fit to Devo7e since protocol module size increased or decreased by about 56 bytes. Why? I don't know.

If CH 2,3,4,6 + 8-10 is fixed for 11ms I am fine with that too of course.


It's not my invention, it's Spektrum and DSM protocol physical limitation.
We need 2 packets (11ms + 11ms) = so we need >7 channels
We have 7 channels at each packet, total 14 = 10 + 4(repeated) = 14, so we limited by max 10 channels

Originally Posted by AndyKunz
If you set it to 11ms, you'll have 11ms on AILE, ELEV, and AUX1 ports. If you are using a DX10t, DX18, or DX18QQ you will also have 11ms on RUDD. Channels 11 & 12 will always be 2048/22ms in DSMX mode.

Andy

Last edit: 25 Sep 2016 14:34 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
25 Sep 2016 22:12 #54270 by mwm
Replied by mwm on topic DSM2/X protocol error

vlad_vy wrote: Protocol module for Devo 7e kill all possible modifications for DSM2/X protocol. Now I can't add even single line of code, it doesn't fit to Devo7e. Now some strange things has place with code, if I exchange two adjacent lines of code, it doesn't fit to Devo7e since protocol module size increased or decreased by about 56 bytes. Why? I don't know.

[/quote]

Up until 5.0, this was the case with the flash code as well. It's why the 7E may not be supported in the next release. We're no longer holding features back for the 7E. Yeah, it sucks all the way around.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
26 Sep 2016 10:14 #54282 by Thomas.Heiss
Replied by Thomas.Heiss on topic DSM2/X protocol error

vlad_vy wrote:

If CH 2,3,4,6 + 8-10 is fixed for 11ms I am fine with that too of course.


It's not my invention, it's Spektrum and DSM protocol physical limitation.
We need 2 packets (11ms + 11ms) = so we need >7 channels
We have 7 channels at each packet, total 14 = 10 + 4(repeated) = 14, so we limited by max 10 channels

Originally Posted by AndyKunz
If you set it to 11ms, you'll have 11ms on AILE, ELEV, and AUX1 ports. If you are using a DX10t, DX18, or DX18QQ you will also have 11ms on RUDD. Channels 11 & 12 will always be 2048/22ms in DSMX mode.
Andy


Oh I was not caring for channels 11-12.
Probably I would have to read a spec or read / understand the C sources but, but on a higher-level spoken:

How are channels
CH1/THR
CH5/GEAR and
CH7/AUX2

transmitted (lower-level) in those two packets that they are 22ms for those three channels and can not be 11ms as well as?

So 6 channel Spektrum receivers like AR600, AR610, AR6210 would not to be supported for 11ms? e.g Heli flybar receivers.
Or if they are, in what configuration? 8-channel Deviation configuration?
Do you mean ">7" channels or ">=7" channels for this 2x 7 channels transmit?

I am just asking because for e.g 4-wing aileron type gliders having 4x ail/flap + elev / rudder would be nice, where the flaps are used as real inner ailerons (up and down, additional movement to outer ailerons).

Having to exactly know as a pilot what channels (8-10 + 6/AUX1) can transmit in 11ms but e.g not 5+7 channels would have to be really good documented :)
I already see threads and threads about that popup on the forum - just like with the heli configurations ;)

Thomas

Please Log in or Create an account to join the conversation.

More
26 Sep 2016 10:46 - 26 Sep 2016 12:15 #54283 by vlad_vy
Replied by vlad_vy on topic DSM2/X protocol error
Channels mapping for Normal 22ms (11ch and 12ch):
static const u8 ch_map11[] = {3, 2, 1, 5, 0, 4, 6, 7, 8, 9, 10, 0xff, 0xff, 0xff};
static const u8 ch_map12[] = {3, 2, 1, 5, 0, 4, 6, 7, 8, 9, 10, 11, 0xff, 0xff};

So we can'r repeat 4 channels.


Channels mapping for High Speed 11ms:

// High Speed 11ms
static const u8 ch_map13[] = {1, 5, 2, 3, 4, 0xff, 0xff, 1, 5, 2, 3, 0, 7, 6}; //8ch - Guess
static const u8 ch_map14[] = {1, 5, 2, 3, 4, 8, 0xff, 1, 5, 2, 3, 0, 7, 6}; //9ch - Guess
static const u8 ch_map15[] = {1, 5, 2, 3, 4, 8, 9, 1, 5, 2, 3, 0, 7, 6}; //10ch - DX18

i.e. for 10ch Tx you can't change anything, for 9ch Tx you can add one more channel to 11ms but it is out of standard, for 8ch Tx you can add two more channel to 11ms but it is out of standard. I'm no doubt it will work, but it is out of standard. Any receiver <=7 channels can use one packet per frame only (7 channels and 22ms). Only 7ch "High Speed" receivers (for example, AR7610) can use two packets per frame, I think they are really 8ch, but without 8ch output. Any =>8ch DSMX receiver is "High Speed".
Last edit: 26 Sep 2016 12:15 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
26 Sep 2016 11:14 - 26 Sep 2016 11:42 #54284 by vlad_vy
Replied by vlad_vy on topic DSM2/X protocol error
By the way, cyrf6936.c has possible errors at CYRF_FindBestChannels(u8 *channels, u8 len, u8 minspace, u8 min, u8 max) function:

1) rssi[x] = CYRF_ReadRegister(CYRF_13_RSSI); ==> RSSI is 5 digits only, it has to be rssi[x] = CYRF_ReadRegister(CYRF_13_RSSI) & 0x1F;
2) CYRF_ConfigRFChannel(i); ===> slow channel require 270usec for synthesizer to settle, so we need delay after CYRF_ConfigRFChannel(i).
3) CYRF_StartReceive() "This bit must not be set again until after it self clears.", so we need check and reseat RX mode if needed.

It can be:
//NOTE: This routine will reset the CRC Seed
void CYRF_FindBestChannels(u8 *channels, u8 len, u8 minspace, u8 min, u8 max)
{
    #define NUM_FREQ 80
    #define FREQ_OFFSET 4
    u8 rssi[NUM_FREQ];

    if (min < FREQ_OFFSET)
        min = FREQ_OFFSET;
    if (max > NUM_FREQ)
        max = NUM_FREQ;

    int i;
    int j;
    memset(channels, 0, sizeof(u8) * len);
    CYRF_ConfigCRCSeed(0x0000);
    CYRF_SetTxRxMode(RX_EN);
    //Wait for pre-amp to switch from send to receive
    Delay(1000);
    for(i = 0; i < NUM_FREQ; i++) {
        CYRF_ConfigRFChannel(i); //slow channel require 270usec for synthesizer to settle 
        Delay(300); //??? what is the real delay???
        if ( !(CYRF_ReadRegister(CYRF_05_RX_CTRL) & 0x80)) {
            CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x80); //Prepare to receive
            Delay(10);
            CYRF_ReadRegister(CYRF_13_RSSI); //dummy read
        }
        rssi[i] = CYRF_ReadRegister(CYRF_13_RSSI) & 0x1F;        
    }

    for (i = 0; i < len; i++) {
        channels[i] = min;
        for (j = min; j < max; j++) {
            if (rssi[j] < rssi[channels[i]]) {
                channels[i] = j;
            }            
        }
        for (j = channels[i] - minspace; j < channels[i] + minspace; j++) {
            //Ensure we don't reuse any channels within minspace of the selected channel again
            if (j < 0 || j >= NUM_FREQ)
                continue;
            rssi[j] = 0xff;
        }
    }
    CYRF_SetTxRxMode(TX_EN);
}

I have one question only: what is the real delay for Delay() fuction?
Last edit: 26 Sep 2016 11:42 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
26 Sep 2016 15:55 - 26 Sep 2016 16:05 #54288 by vlad_vy
Replied by vlad_vy on topic DSM2/X protocol errors
I don't see any difference with changed cyrf6936.c. At both cases two channels select for DSM2 protocol look like random, independent from external RF noises (WiFi and so on). So I leave it as is.

What's about changed DSM2/X protocol, up to now it tested with 5 receivers: AR6210, AR8000, Blade 200QX, and two micro quads with integrated DSM2 receiver. While I don't see any problems.
Last edit: 26 Sep 2016 16:05 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
27 Sep 2016 04:47 - 27 Sep 2016 05:39 #54313 by vlad_vy
Replied by vlad_vy on topic DSM2/X protocol errors
I know what is the problem with channels scanning for DSM2 protocol, but don't understand how to implement new algorithm for scanning, I get tight loop and Tx reboot. I need something similar to channels scanning at "scanner_page.c" for Devo6, Devo8 and Devo12 (RF scanner). I need numerous scans (at least 40 times) for all channels (80) with maximum possible speed and measure peak RSSI for every channel, since 2.4 RF signals are periodical, not permanent.
Last edit: 27 Sep 2016 05:39 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
27 Sep 2016 05:57 #54315 by MacGyverek
Replied by MacGyverek on topic DSM2/X protocol errors
Could you explain what was wrong with old DSM2/DSMX code?? I using 4.01 version with orange RX without any issue.

Please Log in or Create an account to join the conversation.

More
27 Sep 2016 06:14 - 27 Sep 2016 06:21 #54316 by vlad_vy
Replied by vlad_vy on topic DSM2/X protocol errors
It can happen with some combination Tx ID and Fixed ID, and selected RF channel , at common case the chances are about 1/(7*35). With v4.0.1 Orage Rx work without any problems, since Deviation has the same error, but you can have possible problems with Spektrum, Lemon and other Rx.
Last edit: 27 Sep 2016 06:21 by vlad_vy.

Please Log in or Create an account to join the conversation.

Time to create page: 0.074 seconds
Powered by Kunena Forum