Difference between revisions of "DSM"

From PaparazziUAV
Jump to navigation Jump to search
 
(24 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== What is DSM (DSM2/DSMX) ==
== What is DSM (DSM2/DSMX) ==
DSM2 and DSMX are widely used radio protocols for 2.4gHz spektrum RC transmitters and receivers. It is also used in the [[SuperbitRF]] project as datalink. The protocol makes it possible to have multiple receiver/transmitters in the 2.4gHz spektrum without much interference.
DSM2 and DSMX are widely used radio protocols for 2.4GHz spektrum RC transmitters and receivers. It is also used in the [[SuperbitRF]] project as datalink. The protocol makes it possible to have multiple receiver/transmitters in the 2.4GHz spektrum without much interference.


== What is the difference between DSM2 and DSMX ==
=== The difference between DSM2 and DSMX ===
There is only a small difference between DSM2 and DSMX, which is the way they hop between different channels. In the DSM2 protocol the transmitter will choose two random channels, where the transmitter will look for the two best channels in the optimal case. In the DSMX protocol the transmitter and receiver both use the transmitter radio chip ID,which is send during the binding process, for generating 23 channels. Each time the transmitter transmits a packet or the receiver receives a packet they will hop to the next channel.
There is only a small difference between DSM2 and DSMX; The difference is the method how to hop between different channels. In the DSM2 protocol the transmitter will choose two random channels, where the transmitter will look for the two best channels in the optimal case. In the DSMX protocol the transmitter and receiver both use the transmitter radio chip ID,which is send during the binding process, for generating 23 channels. Each time the transmitter transmits a packet or the receiver receives a packet they will hop to the next channel.


From this information you can conclude that when you use DSM2, and both the channels that were chosen are getting used by alot of other users your reception will drop enormously. In the DSMX protcol this problem was solved and makes it possible to have alot more transmitters/receivers at the same bandwith.
From this information you can conclude that when you use DSM2, and both the channels that were chosen are getting used by a lot of other users your reception will drop enormously. In the DSMX protocol this problem was solved and makes it possible to have a lot more transmitters/receivers at the same bandwidth.


== How does it work ==
== How does it work ==
''Note that this is reverse engineered and will contain errors.''
In general you have three phases, being:


In general you have three fases, the binding procedure, the syncing procedure and the normal transfer procedure. The transmitter doesn't have a syncing procedure, because it determines the timing for the receiver.
# the binding procedure
# the syncing procedure  
# and the normal transfer procedure.  
 
The transmitter doesn't have a syncing procedure, because it determines the timing for the receiver.


=== The binding procedure ===
=== The binding procedure ===
At the binding procedure both the transmitter and receiver will change to [[DSM#Definitions|SDR mode]], a data code of 64 bits, a [[DSM#Definitions|SOP Code]] of 64 bits and disable the [[DSM#Definitions|CRC Checksum]]. The transmitter will then choose a random odd channel and starts sending the bind packet at a very high rate. The receiver will start at the first odd channel and waits a bit longer then the rate the transmitters sends at. When it does receive a packet, it will check if it is a valid bind packet and goes to syncing mode. When it doesn't receive a valid packet it will go to the next channel and will repeat this.
At the binding procedure both the transmitter and receiver will change to [[DSM#Definitions|SDR (Single Data Rate) mode]], a data code of 64 bits, a [[DSM#Definitions|SOP (Start Of Packet) Code]] of 64 bits and disable the [[DSM#Definitions|CRC Checksum]]. The transmitter will then choose a random odd channel and starts sending the [[DSM#Binding packet|binding packet]] at a very high rate. The receiver will start at the first odd channel and waits a bit longer then the rate the transmitters sends at. When it does receive a packet, it will check if it is a valid bind packet and goes to syncing mode. When it doesn't receive a valid packet it will go to the next channel and will repeat this.
 
During the binding procedure the transmitter also sends the amount of RC channels that it has and in which amount of packets this channels will fit. They will either transmit all the channels in one packet or in two packets after each other.


=== The syncing procedure ===
=== The syncing procedure ===
Because the transmitter doesn't have a syncing procedure, the transmitter is already in the transfer procedure. The receiver on the other hand needs to synchronise itself with the transmitter.
TODO
TODO


=== The transfer procedure ===
=== The transfer procedure ===
TODO
TODO


== Descriptions ==
== References ==
Some general information about the DSM2/DSMX protocol.
Some general information about the DSM2/DSMX protocol.


=== Definitions ===
=== Definitions ===
* '''Channel''': The channel in the 2.4GHz band(2.400GHz to 2.483GHz) which is used to transmit or receive. Each channel is 100mHz higher then the previous one starting by 0, and the 2.4gHz band is devided into 98 channels.
* '''Channel''': The channel in the 2.4GHz band(2.400GHz to 2.483GHz) which is used to transmit or receive. Each channel is 100mHz higher then the previous one starting by 0, and the 2.4GHz band is divided into 98 channels.
* '''(Transmission) Mode''': The mode at which the transmitter, or receiver is sending/receiving. There are  four differnt modes the transmitter/receiver could be in: GFSK, 8DR, DDR, SDR. The ones used are 8DR and SDR, in SDR mode one bit is encoded in each derived code symbol transmitted. In 8DR mode eight bits are encoded in each derived code symbol transmitted.
* '''(Transmission) Mode''': The mode at which the transmitter, or receiver is sending/receiving. There are  four different modes the transmitter/receiver could be in: GFSK(Gaussian Frequency Shift Keying), 8DR(Octal Data Rate), DDR(Double Data Rate), SDR(Single Data Rate). The ones used are 8DR and SDR, in SDR mode one bit is encoded in each derived code symbol transmitted. In 8DR mode eight bits are encoded in each derived code symbol transmitted.
* '''GFSK''': Gaussian Frequency Shift Keying Transfer mode. CYRF6936 in this mode data is transmitted at 1 Mbps, without any DSSS.
* '''8DR''': Octal Data Rate. CYRF6936 in this mode eight bits are encoded in each derived code symbol transmitted.
* '''DDR''': Double Data Rate. CYRF6936 in this mode two bits are encoded in each derived code symbol transmitted.
* '''SDR''': Single Data Rate. CYRF6936 in this mode one bit is encoded in each derived code symbol transmitted.
* '''SOP code''': Start Of Packet code, are one or two bytes which are added at the start of the packet by the radio chip. These bytes are used to identify if a packet is received at a certain channel.
* '''SOP code''': Start Of Packet code, are one or two bytes which are added at the start of the packet by the radio chip. These bytes are used to identify if a packet is received at a certain channel.
* '''Packet length''': The packet length(one byte) is send after the SOP code, and only includes the length of the payload data. Because it is one byte the limit of the payload length is 255, but because 8DR and SDR only transmit 16byte packets they will be automaticly split up into multiple packets.
* '''Packet length''': The packet length(one byte) is send after the SOP code, and only includes the length of the payload data. Because it is one byte the limit of the payload length is 255, but because 8DR and SDR only transmit 16byte packets they will be automatically split up into multiple packets.
* '''CRC (Checksum)''': The CRC Checksum are two bytes which are send at the end of the packet to check if the received packet was valid. It can detect the following errors: any one bit error, aby two bits error, any odd number of bits in error and an error burst as wide as the checksum itself.
* '''CRC (Checksum)''': The CRC Checksum are two bytes which are send at the end of the packet to check if the received packet was valid. It can detect the following errors: any one bit error, any two bits error, any odd number of bits in error and an error burst as wide as the checksum itself.
* '''CYRF6936''': A radio chip used in several transmitters and the SuperbitRF project.
 
=== Packet example ===
Here is an image of an example packet including the Preamble, SOP, Length, Payload Data and the CRC.
 
[[File:DSM_packet_example.png|600px]]


=== Binding packet ===
=== Binding packet ===
The binding packet has a length of 16 bytes, the exact size the SDR can send at once.
The binding packet has a length of 16 bytes, the exact size the SDR mode can send at once.
  [00] radio chip ID byte 0 (inverted)
  [00] radio chip ID byte 0 (inverted)
  [01] radio chip ID byte 1 (inverted)
  [01] radio chip ID byte 1 (inverted)
Line 45: Line 65:
  [10] 0x01 (not known yet)
  [10] 0x01 (not known yet)
  [11] number of RC channels
  [11] number of RC channels
  [12] protcol used (0x01:DSM2 1packet, 0x02: DSM2 2packets, 0x10: DSM2 SuperbitRF, 0x11: DSMX SuperbitRF, 0xA2: DSMX 1packet, 0xB2: DSMX 2packets)
  [12] protocol used (0x01:DSM2 1packet, 0x02: DSM2 2packets, 0x10: DSM2 SuperbitRF, 0x11: DSMX SuperbitRF, 0xA2: DSMX 1packet, 0xB2: DSMX 2packets)
  [13] 0x00 (not known yet)
  [13] 0x00 (not known yet)
  [14] (sum 00->13 + 384 - 16) MSB
  [14] (sum 00->13 + 384 - 16) MSB
  [15] (sum 00->13 + 384 - 16) LSB
  [15] (sum 00->13 + 384 - 16) LSB
=== Transfer packet ===
The transfer packet has a length of 16 bytes, the exact size 8DR mode can send at once.
[00] radio chip ID byte 2
[01] radio chip ID byte 3 (+packet loss bit in SuperbitRF)
[02-15] data
==Raw DSM data capture files==
To aid the understanding of the various DSM protocols, data was captured using the following hardware:
*Main receiver: Spektrum AR9020
*Satellite receivers: 2x Spektrum 9645 connected to Ant B and Ant R ports
*[http://www.saleae.com/logic Saleae Logic] set to capture signal wires of satellite receivers:
**Channel 0 = Ant B
**Channel 1 = Ant R
**GROUND = ground of Ant R
The capture data has been split into separate runs to abide by the file size limits of this wiki :-)
The Mac/Win/Linux software to read/parse/export the data is downloadable from the Saleae [http://www.saleae.com/downloads website].
===DSM data 1===
[[File:DSM_data_1_-_DX7s.zip]]
Transmitter: Spektrum DX7s
Data capture runs @ 500KHz:
*11ms DSM2
*11ms DSMX
*22ms DSM2
*22ms DSMX
Bind:
*Logic set to trigger on rising edge.
*RXes powered on with bind plug in place
*TX switched on while holding down bind button
*wait for satellite LEDs to go solid on
*TX switched off
*power down RXes
*stop capture
Channel movement:
*Logic set to trigger on rising edge.
*RXes powered on
*TX switched on
*wait for satellite LEDs to power on/servos to center
*each channel individually moved (DSM channel #)
**throttle (0)
**aileron (1)
**elevator (2)
**rudder (3)
**gear (4)
**aux1/flap (5)
**aux2 (6)
*TX switched off
*power down RXes
*stop capture
===DSM data 2===
[[File:DSM_data_2_part_1_-_DX18.zip‎]] (DSM2 runs)
[[File:DSM_data_2_part_2_-_DX18.zip‎]] (DSMX runs)
Transmitter: Spektrum DX18
Data capture runs @ 500KHz:
*11ms DSM2
*11ms DSMX
*22ms DSM2
*22ms DSMX
*22ms DSM2 Xplus
*22ms DSMX Xplus
Bind:
*Logic set to trigger on rising edge.
*RXes powered on with bind plug in place
*TX switched on while holding down bind button
*wait for satellite LEDs to go solid on
*TX switched off
*power down RXes
*stop capture
Channel movement:
*Logic set to trigger on rising edge.
*RXes powered on
*TX switched on
*wait for satellite LEDs to power on/servos to center
*each channel individually moved (DSM channel #)
**throttle (0)
**aileron (1)
**elevator (2)
**rudder (3)
**gear (4)
**aux1/flap (5)
**aux2 (6)
**aux3 (7)
**aux4 (8)
**aux5 (9)
*TX switched off
*power down RXes
*stop capture
===DSM data 3===
[[File:DSM_data_3_-_DX18_Xplus_channels.zip]]
Transmitter: Spektrum DX18
Data capture runs @ 500 KHz:
*22ms DSM2 Xplus
*22ms DSMX Xplus
Channel movement:
*Logic set to trigger on rising edge.
*RXes powered on
*TX switched on
*wait for satellite LEDs to power on/servos to center
*each channel individually moved (DSM channel #)
**throttle (0) mixed with X+1
**X+2
**X+3
**X+4
**X+5
**X+6
**X+7
**X+8
 
*TX switched off
*power down RXes
*stop capture
===DSM data 4===
[[File:DSM_data_4_part_1_-_DX18_Xplus_channels_12_MHz_capture.zip‎]] (DSM2 run)
[[File:DSM_data_4_part_2_-_DX18_Xplus_channels_12_MHz_capture.zip‎]] (DSMX run)
Transmitter: Spektrum DX18
Data capture runs @ 12 MHz:
*22ms DSM2 Xplus
*22ms DSMX Xplus
Channel movement:
*Logic set to trigger on rising edge.
*RXes powered on
*TX switched on
*wait for satellite LEDs to power on/servos to center
*each channel individually moved (DSM channel #)
**throttle (0) mixed with X+1
**X+2
**X+3
**X+4
**X+5
**X+6
**X+7
**X+8
 
*TX switched off
*power down RXes
*stop capture
===DSM data 5===
[[File:DSM_data_5_part_1_-_DX18_RSSI.zip‎]] (DSM2 runs)
[[File:DSM_data_5_part_2_-_DX18_RSSI.zip]] (DSMX runs)
Transmitter: Spektrum DX18 in range test mode
Data capture runs @ 1 MHz:
*11ms DSM2
*11ms DSMX
*22ms DSM2
*22ms DSMX
*22ms DSM2 Xplus
*22ms DSMX Xplus
RSSI test:
*Logic set to trigger on rising edge.
*TX switched on and set to range test mode
*Power on RXes/start capture
*Press range test button (reduce TX power)
*Move TX away from RX while moving elevator (2) channel repeatedly until servo no longer moves/satellite LEDs are out
*release range test button (normal TX power)
*stop capture
== External References ==
* [http://www.cypress.com/?docID=28606 CYRF6936 Data Sheet]
* [http://www.deviationtx.com/ Deviation Firmware]
* [https://sites.google.com/site/mrdunk/interfacing-cypress-cyrf6936-to-avr-microcontrollers Interfacing with the CYRF6936]
* [http://www.rcgroups.com/forums/showthread.php?t=1759502 RCGroups: DSMX Hacking]
* [http://www.deviationtx.com/forum/7-development/2088-18-channels-for-dsm2-dsmx Deviation forum: 18 channel thread]

Latest revision as of 10:06, 7 January 2015

What is DSM (DSM2/DSMX)

DSM2 and DSMX are widely used radio protocols for 2.4GHz spektrum RC transmitters and receivers. It is also used in the SuperbitRF project as datalink. The protocol makes it possible to have multiple receiver/transmitters in the 2.4GHz spektrum without much interference.

The difference between DSM2 and DSMX

There is only a small difference between DSM2 and DSMX; The difference is the method how to hop between different channels. In the DSM2 protocol the transmitter will choose two random channels, where the transmitter will look for the two best channels in the optimal case. In the DSMX protocol the transmitter and receiver both use the transmitter radio chip ID,which is send during the binding process, for generating 23 channels. Each time the transmitter transmits a packet or the receiver receives a packet they will hop to the next channel.

From this information you can conclude that when you use DSM2, and both the channels that were chosen are getting used by a lot of other users your reception will drop enormously. In the DSMX protocol this problem was solved and makes it possible to have a lot more transmitters/receivers at the same bandwidth.

How does it work

In general you have three phases, being:

  1. the binding procedure
  2. the syncing procedure
  3. and the normal transfer procedure.

The transmitter doesn't have a syncing procedure, because it determines the timing for the receiver.

The binding procedure

At the binding procedure both the transmitter and receiver will change to SDR (Single Data Rate) mode, a data code of 64 bits, a SOP (Start Of Packet) Code of 64 bits and disable the CRC Checksum. The transmitter will then choose a random odd channel and starts sending the binding packet at a very high rate. The receiver will start at the first odd channel and waits a bit longer then the rate the transmitters sends at. When it does receive a packet, it will check if it is a valid bind packet and goes to syncing mode. When it doesn't receive a valid packet it will go to the next channel and will repeat this.

During the binding procedure the transmitter also sends the amount of RC channels that it has and in which amount of packets this channels will fit. They will either transmit all the channels in one packet or in two packets after each other.

The syncing procedure

Because the transmitter doesn't have a syncing procedure, the transmitter is already in the transfer procedure. The receiver on the other hand needs to synchronise itself with the transmitter.

TODO

The transfer procedure

TODO

References

Some general information about the DSM2/DSMX protocol.

Definitions

  • Channel: The channel in the 2.4GHz band(2.400GHz to 2.483GHz) which is used to transmit or receive. Each channel is 100mHz higher then the previous one starting by 0, and the 2.4GHz band is divided into 98 channels.
  • (Transmission) Mode: The mode at which the transmitter, or receiver is sending/receiving. There are four different modes the transmitter/receiver could be in: GFSK(Gaussian Frequency Shift Keying), 8DR(Octal Data Rate), DDR(Double Data Rate), SDR(Single Data Rate). The ones used are 8DR and SDR, in SDR mode one bit is encoded in each derived code symbol transmitted. In 8DR mode eight bits are encoded in each derived code symbol transmitted.
  • GFSK: Gaussian Frequency Shift Keying Transfer mode. CYRF6936 in this mode data is transmitted at 1 Mbps, without any DSSS.
  • 8DR: Octal Data Rate. CYRF6936 in this mode eight bits are encoded in each derived code symbol transmitted.
  • DDR: Double Data Rate. CYRF6936 in this mode two bits are encoded in each derived code symbol transmitted.
  • SDR: Single Data Rate. CYRF6936 in this mode one bit is encoded in each derived code symbol transmitted.
  • SOP code: Start Of Packet code, are one or two bytes which are added at the start of the packet by the radio chip. These bytes are used to identify if a packet is received at a certain channel.
  • Packet length: The packet length(one byte) is send after the SOP code, and only includes the length of the payload data. Because it is one byte the limit of the payload length is 255, but because 8DR and SDR only transmit 16byte packets they will be automatically split up into multiple packets.
  • CRC (Checksum): The CRC Checksum are two bytes which are send at the end of the packet to check if the received packet was valid. It can detect the following errors: any one bit error, any two bits error, any odd number of bits in error and an error burst as wide as the checksum itself.
  • CYRF6936: A radio chip used in several transmitters and the SuperbitRF project.

Packet example

Here is an image of an example packet including the Preamble, SOP, Length, Payload Data and the CRC.

DSM packet example.png

Binding packet

The binding packet has a length of 16 bytes, the exact size the SDR mode can send at once.

[00] radio chip ID byte 0 (inverted)
[01] radio chip ID byte 1 (inverted)
[02] radio chip ID byte 2 (inverted)
[03] radio chip ID byte 3 (inverted)
[04] radio chip ID byte 0 (inverted)
[05] radio chip ID byte 1 (inverted)
[06] radio chip ID byte 2 (inverted)
[07] radio chip ID byte 3 (inverted)
[08] (sum 00->07 + 384 - 16) MSB
[09] (sum 00->07 + 384 - 16) LSB
[10] 0x01 (not known yet)
[11] number of RC channels
[12] protocol used (0x01:DSM2 1packet, 0x02: DSM2 2packets, 0x10: DSM2 SuperbitRF, 0x11: DSMX SuperbitRF, 0xA2: DSMX 1packet, 0xB2: DSMX 2packets)
[13] 0x00 (not known yet)
[14] (sum 00->13 + 384 - 16) MSB
[15] (sum 00->13 + 384 - 16) LSB

Transfer packet

The transfer packet has a length of 16 bytes, the exact size 8DR mode can send at once.

[00] radio chip ID byte 2
[01] radio chip ID byte 3 (+packet loss bit in SuperbitRF)
[02-15] data

Raw DSM data capture files

To aid the understanding of the various DSM protocols, data was captured using the following hardware:

  • Main receiver: Spektrum AR9020
  • Satellite receivers: 2x Spektrum 9645 connected to Ant B and Ant R ports
  • Saleae Logic set to capture signal wires of satellite receivers:
    • Channel 0 = Ant B
    • Channel 1 = Ant R
    • GROUND = ground of Ant R

The capture data has been split into separate runs to abide by the file size limits of this wiki :-)

The Mac/Win/Linux software to read/parse/export the data is downloadable from the Saleae website.

DSM data 1

File:DSM data 1 - DX7s.zip

Transmitter: Spektrum DX7s

Data capture runs @ 500KHz:

  • 11ms DSM2
  • 11ms DSMX
  • 22ms DSM2
  • 22ms DSMX

Bind:

  • Logic set to trigger on rising edge.
  • RXes powered on with bind plug in place
  • TX switched on while holding down bind button
  • wait for satellite LEDs to go solid on
  • TX switched off
  • power down RXes
  • stop capture

Channel movement:

  • Logic set to trigger on rising edge.
  • RXes powered on
  • TX switched on
  • wait for satellite LEDs to power on/servos to center
  • each channel individually moved (DSM channel #)
    • throttle (0)
    • aileron (1)
    • elevator (2)
    • rudder (3)
    • gear (4)
    • aux1/flap (5)
    • aux2 (6)
  • TX switched off
  • power down RXes
  • stop capture

DSM data 2

File:DSM data 2 part 1 - DX18.zip (DSM2 runs)

File:DSM data 2 part 2 - DX18.zip (DSMX runs)

Transmitter: Spektrum DX18

Data capture runs @ 500KHz:

  • 11ms DSM2
  • 11ms DSMX
  • 22ms DSM2
  • 22ms DSMX
  • 22ms DSM2 Xplus
  • 22ms DSMX Xplus

Bind:

  • Logic set to trigger on rising edge.
  • RXes powered on with bind plug in place
  • TX switched on while holding down bind button
  • wait for satellite LEDs to go solid on
  • TX switched off
  • power down RXes
  • stop capture

Channel movement:

  • Logic set to trigger on rising edge.
  • RXes powered on
  • TX switched on
  • wait for satellite LEDs to power on/servos to center
  • each channel individually moved (DSM channel #)
    • throttle (0)
    • aileron (1)
    • elevator (2)
    • rudder (3)
    • gear (4)
    • aux1/flap (5)
    • aux2 (6)
    • aux3 (7)
    • aux4 (8)
    • aux5 (9)
  • TX switched off
  • power down RXes
  • stop capture

DSM data 3

File:DSM data 3 - DX18 Xplus channels.zip

Transmitter: Spektrum DX18

Data capture runs @ 500 KHz:

  • 22ms DSM2 Xplus
  • 22ms DSMX Xplus

Channel movement:

  • Logic set to trigger on rising edge.
  • RXes powered on
  • TX switched on
  • wait for satellite LEDs to power on/servos to center
  • each channel individually moved (DSM channel #)
    • throttle (0) mixed with X+1
    • X+2
    • X+3
    • X+4
    • X+5
    • X+6
    • X+7
    • X+8
  • TX switched off
  • power down RXes
  • stop capture

DSM data 4

File:DSM data 4 part 1 - DX18 Xplus channels 12 MHz capture.zip (DSM2 run)

File:DSM data 4 part 2 - DX18 Xplus channels 12 MHz capture.zip (DSMX run)

Transmitter: Spektrum DX18

Data capture runs @ 12 MHz:

  • 22ms DSM2 Xplus
  • 22ms DSMX Xplus

Channel movement:

  • Logic set to trigger on rising edge.
  • RXes powered on
  • TX switched on
  • wait for satellite LEDs to power on/servos to center
  • each channel individually moved (DSM channel #)
    • throttle (0) mixed with X+1
    • X+2
    • X+3
    • X+4
    • X+5
    • X+6
    • X+7
    • X+8
  • TX switched off
  • power down RXes
  • stop capture

DSM data 5

File:DSM data 5 part 1 - DX18 RSSI.zip (DSM2 runs)

File:DSM data 5 part 2 - DX18 RSSI.zip (DSMX runs)

Transmitter: Spektrum DX18 in range test mode

Data capture runs @ 1 MHz:

  • 11ms DSM2
  • 11ms DSMX
  • 22ms DSM2
  • 22ms DSMX
  • 22ms DSM2 Xplus
  • 22ms DSMX Xplus

RSSI test:

  • Logic set to trigger on rising edge.
  • TX switched on and set to range test mode
  • Power on RXes/start capture
  • Press range test button (reduce TX power)
  • Move TX away from RX while moving elevator (2) channel repeatedly until servo no longer moves/satellite LEDs are out
  • release range test button (normal TX power)
  • stop capture

External References