This page documents the format of the Tytera DM380/Retevis RT-3 codeplug binary file. This is not an official format definition but it has been determined by changing settings with the “CPS RT3” program version V1.30.0.
This specification is used by the rdt2csv conversion utility to export/import codeplugs in the CSV format.

General rules

The codeplug, with extension “.rdt”, is a binary file of a fixed size of 262709 bytes. All information inside is allocated at fixed positions.

Records

Data inside the codeplug is divided in records. Every record has its own format. Some records are available in single instance (for example, the record describing the “General Settings”), while other records are repeated (for example, records describing the “Channel Information” have one record for each channel).
Multiple records are always allocated in sequence within the codeplug file. Records are always octet aligned.
For each set of records, the description below will give

  1. the offset in octets where the first record starts
  2. the length, in octets, of each record
  3. the number of records available in the file

Fields

The records are divided in fields. Each field represent an edit box, a check box or other field in the editor card. Fields can be as small as one bit or as long as 16 octets.
The field table will give the offset in bits of the field within the record and the length in bits of the field. So, bit #0 will be the MSB of the first octet of the record; bit #7 will be the LSB of the first octet, while bit #8 will be the MSB of the second octet and so on.
Fields are encoded according an encoding type among those specified below.

Encode: BCD

The BCD (Binary Coded Decimal) format divides a decimal number in digits and codes each digit in a group of 4 bits. In this case encoding is little-endian.
For example, value 12345678 is encoded as 0x78 0x56 0x34 0x12.

Encode: RevBCD

Same as BCD, but encoded big-endian.
For example, value 12345678 is encoded as 0x12 0x34 0x56 0x78.

Encode: BCDT

This is a BCD format with exception used only in CTCSS/DCS fields specification.
Tones are of three types: CTCSS (like 127.9) DCS-N (like D155N) and DCS-I (like D155I).
They are coded as two-octets little-endian BCD but with an exception: the two most significant bits of the second octet are to be extracted and used as follow: 00=CTCSS, 10=DCS-N, 11=DCS-I.
Once removed, the remaining BCD value is the number.
Example:

CTCSS 77.0  = x70 x07 
CTCSS 254.1 = x41 x25  
DCS   D023N = x23 x80  
DCS   D023I = x23 xC0

Encode: Binary

This is normal binary little-endian encoding. If size is less or equal to 8 bits, the field is always contained in a single octet. If the size is greater the 8 bits, then size is always a exact multiple of 8 bits and the field will be octet aligned.

Encode: Unicode

Unicode encoding is a sequence of little-endian 16-bit values.
Although it can host any 16-bit Unicode value, only values <= than 255 (U+00FF) are shown correctly.
The Unicode strings are always allocated to their maximum size; if shorter than their maximum size, unused characters are zeroed.
If the maximum size is used, no zero terminator is available.

Encode: Ascii

Ascii encoding is made of simple one-octet long characters.
The Ascii strings are always allocated to their maximum size; if shorter than their maximum size, unused characters are zeroed.
If the maximum size is used, no zero terminator is available.

Empty records

Tables supporting multiple records (for example Channel Information, Scan List, Zone Information, etc) have always all records allocated. So, if Channel Information supports a maximum of 1000 entries, in the codeplug file there will always be 1000 entries.
The unused entries are marked with one or more octets that are set to a given value when the record is not used.
When setting the a record to empty, the safest strategy is to set it to its “initial condition”. The “initial condition” is the configuraton used by the “CPS RT3” editor program when creates a new “default1.rdt” empty codeplug.
Some types of records are initialized to zero, while other are initialized to 0xFF. In every case, the Unicode and Ascii strings are to be initialized to zero.
The “Default zero value” in the table below specifies this detail.

Deletion markers

When a record is deleted, the CPS RT3 editor does not clear its contents to its initial state but simply sets one or bytes to a prefixed value. Therefore, the decoder must check these octets only to determine whether a record is active or deleted.
The bits to be checked are described in the “deletion markers” table of every record descriptor below.

Records specifications

The tables below describe all the available records and their internal format.

Table: ChannelInformation

Maximum number of lines1000
First record offset (octets)0x1F025 (127013)
Record length (octets)0x40 (64)
Number or records0x3E8
All records range0x1F025 - 0x2EA25
Default zero value0xFF

Deletion markers:

Offset bitsLen.bitsValue
12880xFF (255)

Fields format:

NameTypeOffset
bits
Len
bits
Notes
LoneWorkerBinary01 0=off, 1=on
SquelchBinary21 0=tight, 1=normal
AutoscanBinary31 0=off, 1=on
BandwidthBinary41 0=12.5, 1=25.0
ChannelModeBinary62 2=digital, 1=analog
ColorcodeBinary840<=N<=15
RepeaterSlotBinary122 1=slot1, 2=slot2
RxOnlyBinary141 0=off, 1=on
AllowTalkaroundBinary151 0=off, 1=on
DataCallConfBinary161 0=off, 1=on
PrivateCallConfBinary171 0=off, 1=on
PrivacyBinary182 0=none, 1=basic, 2=enhanced
PrivacyNoBinary2040<=N<=7 if privacy is enhanced; 0<=N<=15 if basic
DisplayPttIdBinary241 0=on, 1=off
CompressedUdpHdrBinary251 0=off, 1=on
EmergencyAlarmAckBinary281 0=off, 1=on
RxRefFrequencyBinary302 0=low, 1=medium, 2=high
AdmintCriteriaBinary322 0=always, 1=chFree, 2=CTCSS/DCS, 3=colorCode
PowerBinary341 0=low, 1=high
VoxBinary351 0=off, 1=on
QtReverseBinary361 0=180, 1=120
ReverseBurstBinary371 0=off, 1=on
TxRefFrequencyBinary382 0=low, 1=medium, 2=high
ContactNameBinary4816Set to a valid position in table DigitalContact.
0=none
TotBinary6660=infinite; otherwise time in seconds, s=15*N
TotRekeyDelayBinary728number of seconds
EmergencySystemBinary826
ScanListBinary888Set to a valid position in table ScanList.
0=none
GroupListBinary968Set to a valid position in table DigitalRxGroupList.
0=none
Decode18Binary1128 0=off, 1=on
RxFrequencyBCD12832Frequency * 10 Hz (for example, 43098570 = 430.98570 MHz)
TxFrequencyBCD16032Frequency * 10 Hz (for example, 43098570 = 430.98570 MHz)
CtcssDcsDecodeBCDT19216CTCSS/DCS tones - See description of BCDT
CtcssDcsEncodeBCDT20816CTCSS/DCS tones - See description of BCDT
TxSignalingSystBinary2373
RxSignalingSystBinary2293
NameUnicode256256Maximum length: 16 characters.

Table: DigitalContact

Maximum number of lines1000
First record offset (octets)0x61A5 (24997)
Record length (octets)0x24 (36)
Number or records0x3E8
All records range0x61A5 - 0xEE45
Default zero value0xFF

Deletion markers:

Offset bitsLen.bitsValue
080xFF (255)
880xFF (255)
1680xFF (255)

Fields format:

NameTypeOffset
bits
Len
bits
Notes
CallIdBinary024
CallReceiveToneBinary261 0=off, 1=on
CallTypeBinary302 1=group, 2=private, 3=all
NameUnicode32256Maximum length: 16 characters.

Table: DigitalRxGroupList

Maximum number of lines250
First record offset (octets)0xEE45 (60997)
Record length (octets)0x60 (96)
Number or records0xFA
All records range0xEE45 - 0x14C05
Default zero value0x00

Deletion markers:

Offset bitsLen.bitsValue
080x00 (0)

Fields format:

NameTypeOffset
bits
Len
bits
Notes
NameUnicode0256Maximum length: 16 characters.
ContactMember01Binary25616Set to a valid position in table DigitalContact.
ContactMember02Binary27216Set to a valid position in table DigitalContact.
ContactMember03Binary28816Set to a valid position in table DigitalContact.
ContactMember04Binary30416Set to a valid position in table DigitalContact.
ContactMember05Binary32016Set to a valid position in table DigitalContact.
ContactMember06Binary33616Set to a valid position in table DigitalContact.
ContactMember07Binary35216Set to a valid position in table DigitalContact.
ContactMember08Binary36816Set to a valid position in table DigitalContact.
ContactMember09Binary38416Set to a valid position in table DigitalContact.
ContactMember10Binary40016Set to a valid position in table DigitalContact.
ContactMember11Binary41616Set to a valid position in table DigitalContact.
ContactMember12Binary43216Set to a valid position in table DigitalContact.
ContactMember13Binary44816Set to a valid position in table DigitalContact.
ContactMember14Binary46416Set to a valid position in table DigitalContact.
ContactMember15Binary48016Set to a valid position in table DigitalContact.
ContactMember16Binary49616Set to a valid position in table DigitalContact.
ContactMember17Binary51216Set to a valid position in table DigitalContact.
ContactMember18Binary52816Set to a valid position in table DigitalContact.
ContactMember19Binary54416Set to a valid position in table DigitalContact.
ContactMember20Binary56016Set to a valid position in table DigitalContact.
ContactMember21Binary57616Set to a valid position in table DigitalContact.
ContactMember22Binary59216Set to a valid position in table DigitalContact.
ContactMember23Binary60816Set to a valid position in table DigitalContact.
ContactMember24Binary62416Set to a valid position in table DigitalContact.
ContactMember25Binary64016Set to a valid position in table DigitalContact.
ContactMember26Binary65616Set to a valid position in table DigitalContact.
ContactMember27Binary67216Set to a valid position in table DigitalContact.
ContactMember28Binary68816Set to a valid position in table DigitalContact.
ContactMember29Binary70416Set to a valid position in table DigitalContact.
ContactMember30Binary72016Set to a valid position in table DigitalContact.
ContactMember31Binary73616Set to a valid position in table DigitalContact.
ContactMember32Binary75216Set to a valid position in table DigitalContact.

Table: GeneralSettings

Maximum number of lines1
First record offset (octets)0x2265 (8805)
Record length (octets)0x90 (144)
Number or records0x1
All records range0x2265 - 0x22F5
Default zero value0xFF

Fields format:

NameTypeOffset
bits
Len
bits
Notes
InfoScreenLine1Unicode0160Maximum length: 10 characters.
InfoScreenLine2Unicode160160Maximum length: 10 characters.
MonitorTypeBinary5151 0=silent, 1=open
DisableAllLedsBinary5171 0=off, 1=on
TalkPermitToneBinary5202 0=none, 1=digital, 2=analog, 3=both
PasswordAndLockEnableBinary5221 1=off, 0=on
CHFreeIndicationToneBinary5231 1=off, 0=on
DisableAllToneBinary5251 1=off, 0=on
SaveModeReceiveBinary5261 0=off, 1=on
SavePreambleBinary5271 0=off, 1=on
IntroScreenBinary5311 0=charstring, 1=picture
RadioIdBinary54424max value is 16776415
TxPreambleBinary5768ms=N*60, where N<=0<=144
GroupCallHangTimeBinary5848time in ms, ms=N*100, N<=70, N must be multiple of 5
PrivateCallHangTimeBinary5928time in ms, ms=N*100, N<=70, N must be multiple of 5
VoxSensitivityBinary6008
RxLowBatteryIntervalBinary6248time in seconds, s=N*5, N<=127
CallAlertToneBinary63280=Continue, otherwise time in seconds, s=N*5, N<=240
LoneWorkerRespTimeBinary6408
LoneWorkerReminderTimeBinary6488
ScanDigitalHangTimeBinary6648time in ms, ms=N*5, 5<=N<=100; default N=10
ScanAnalogHangTimeBinary6728time in ms, ms=N*5, 5<=N<=100; default N=10
KeypadLockTimeBinary6888 1=5s, 2=10s, 3=15s, 255=manual
ModeBinary6968 0=mr, 255=ch
PowerOnPasswordRevBCD704328 digits
RadioProgPassowrdRevBCD736328 digits
PcProgPasswordAscii76864Converted to lower case; if not set, set to all 0xFF.
RadioNameUnicode896256Maximum length: 16 characters.

Table: ScanList

Maximum number of lines250
First record offset (octets)0x18A85 (100997)
Record length (octets)0x68 (104)
Number or records0xFA
All records range0x18A85 - 0x1F015
Default zero value0x00

Deletion markers:

Offset bitsLen.bitsValue
080x00 (0)

Fields format:

NameTypeOffset
bits
Len
bits
Notes
NameUnicode0256Maximum length: 16 characters.
PriorityCh1Binary25616Set to a valid position in table ChannelInformation.
65535=none, 0=selected
PriorityCh2Binary27216Set to a valid position in table ChannelInformation.
65535=none, 0=selected
TXDesignatedChBinary28816Set to a valid position in table ChannelInformation.
65535=none, 0=last
SignHoldTimeBinary3128Time in ms, N * 25 = ms minMs=50 (n=2) maxMs=6375 (n=255)
PrioSamplTimeBinary3208Time in ms, N * 250 = ms minMs=750 (n=3) maxMs=6375 (n=255) maxMs=7750 (n=31)
ChannelMember01Binary33616Set to a valid position in table ChannelInformation.
ChannelMember02Binary35216Set to a valid position in table ChannelInformation.
ChannelMember03Binary36816Set to a valid position in table ChannelInformation.
ChannelMember04Binary38416Set to a valid position in table ChannelInformation.
ChannelMember05Binary40016Set to a valid position in table ChannelInformation.
ChannelMember06Binary41616Set to a valid position in table ChannelInformation.
ChannelMember07Binary43216Set to a valid position in table ChannelInformation.
ChannelMember08Binary44816Set to a valid position in table ChannelInformation.
ChannelMember09Binary46416Set to a valid position in table ChannelInformation.
ChannelMember10Binary48016Set to a valid position in table ChannelInformation.
ChannelMember11Binary49616Set to a valid position in table ChannelInformation.
ChannelMember12Binary51216Set to a valid position in table ChannelInformation.
ChannelMember13Binary52816Set to a valid position in table ChannelInformation.
ChannelMember14Binary54416Set to a valid position in table ChannelInformation.
ChannelMember15Binary56016Set to a valid position in table ChannelInformation.
ChannelMember16Binary57616Set to a valid position in table ChannelInformation.
ChannelMember17Binary59216Set to a valid position in table ChannelInformation.
ChannelMember18Binary60816Set to a valid position in table ChannelInformation.
ChannelMember19Binary62416Set to a valid position in table ChannelInformation.
ChannelMember20Binary64016Set to a valid position in table ChannelInformation.
ChannelMember21Binary65616Set to a valid position in table ChannelInformation.
ChannelMember22Binary67216Set to a valid position in table ChannelInformation.
ChannelMember23Binary68816Set to a valid position in table ChannelInformation.
ChannelMember24Binary70416Set to a valid position in table ChannelInformation.
ChannelMember25Binary72016Set to a valid position in table ChannelInformation.
ChannelMember26Binary73616Set to a valid position in table ChannelInformation.
ChannelMember27Binary75216Set to a valid position in table ChannelInformation.
ChannelMember28Binary76816Set to a valid position in table ChannelInformation.
ChannelMember29Binary78416Set to a valid position in table ChannelInformation.
ChannelMember30Binary80016Set to a valid position in table ChannelInformation.
ChannelMember31Binary81616Set to a valid position in table ChannelInformation.

Table: TextMessage

Maximum number of lines50
First record offset (octets)0x23A5 (9125)
Record length (octets)0x120 (288)
Number or records0x32
All records range0x23A5 - 0x5BE5
Default zero value0x00

Deletion markers:

Offset bitsLen.bitsValue
080x00 (0)

Fields format:

NameTypeOffset
bits
Len
bits
Notes
TextUnicode02304Maximum length: 144 characters.

Table: ZoneInformation

Maximum number of lines250
First record offset (octets)0x14C05 (84997)
Record length (octets)0x40 (64)
Number or records0xFA
All records range0x14C05 - 0x18A85
Default zero value0x00

Deletion markers:

Offset bitsLen.bitsValue
080x00 (0)

Fields format:

NameTypeOffset
bits
Len
bits
Notes
NameUnicode0256Maximum length: 16 characters.
ChannelMember01Binary25616Set to a valid position in table ChannelInformation.
ChannelMember02Binary27216Set to a valid position in table ChannelInformation.
ChannelMember03Binary28816Set to a valid position in table ChannelInformation.
ChannelMember04Binary30416Set to a valid position in table ChannelInformation.
ChannelMember05Binary32016Set to a valid position in table ChannelInformation.
ChannelMember06Binary33616Set to a valid position in table ChannelInformation.
ChannelMember07Binary35216Set to a valid position in table ChannelInformation.
ChannelMember08Binary36816Set to a valid position in table ChannelInformation.
ChannelMember09Binary38416Set to a valid position in table ChannelInformation.
ChannelMember10Binary40016Set to a valid position in table ChannelInformation.
ChannelMember11Binary41616Set to a valid position in table ChannelInformation.
ChannelMember12Binary43216Set to a valid position in table ChannelInformation.
ChannelMember13Binary44816Set to a valid position in table ChannelInformation.
ChannelMember14Binary46416Set to a valid position in table ChannelInformation.
ChannelMember15Binary48016Set to a valid position in table ChannelInformation.
ChannelMember16Binary49616Set to a valid position in table ChannelInformation.
  1. Great job.
    I see there are still a few uncharted segments.
    Here is a small hint on the content:

    http://www.dmrusers.co.uk/viewtopic.php?t=163


    Incidentally, if you want to use a CS-700 file with the MD-380, open the payload in a hex editor and substitute these bytes.
    Offset 125 126 127 128 129 130
    CS700 HEX 44 36 38 30 00 FF
    CS700 ASCII D 6 8 0 .
    MD-380 HEX 44 52 37 38 30 00
    MD-380 ASCII D R 7 8 0 .

    73
    Stefano IZ0MJE

  2. Hi, Thank you for you software. Btw, could you please add a cmd line param to allow to ignore duplicated entries and export files anyway?

    Also I think you are actually checking duplicates on channels list even for deleted channels, I have a codeplug file that I can’t really export as it detects duplicates for every deleted memory (i.e. say I have 200 memories, it detects duplicates on “lines” 201 to 1000) and I can get no exported files 🙁

    • Ooops, please delete my post above (and this one), I intended to post it at your rdt2csv page instead, I will post it there to keep things on right place… sorry…

  3. This is a terrific resource. Thanks for publishing it. On your Channel Information format, I think your CompressedUdpHdr are reversed.

  4. Hi…
    I had the following errors building on Ubuntu 16.04 LTS, gcc v 5.4.0, x86_64


    egerkav@elxa10t7k32:~/Development/rdt2csv/c$ make
    gcc -O2 -pedantic -Wall -Werror -DNDEBUG -c main.c -o out/main.o
    main.c: In function ‘analyzeCommandLine’:
    main.c:146:23: error: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Werror=format=]
    fprintf (stderr, "Error in parameter %d (%s): separator already defined on a previous parameter with -sc or -tab\n", PARNO, *argv);
    ^
    main.c:159:23: error: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Werror=format=]
    fprintf (stderr, "Error in parameter %d (%s): %s already defined in previous parameter\n", PARNO, *argv, (config->updateMode == modeExport ? "-e" : "-u"));
    ^
    main.c:163:23: error: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Werror=format=]
    fprintf (stderr, "Error in parameter %d (%s): missing .rdt file name\n", PARNO, *argv);
    ^
    main.c:172:23: error: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Werror=format=]
    fprintf (stderr, "Error in parameter %d (%s): out of memory\n", PARNO, *argv);
    ^
    main.c:198:23: error: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Werror=format=]
    fprintf (stderr, "Error in parameter %d (%s): %s\n", PARNO, *argv, err);
    ^
    cc1: all warnings being treated as errors
    Makefile:89: recipe for target 'out/main.o' failed
    make: *** [out/main.o] Error 1

    I cast parameter 3 (PARNO) to int, as follows (example):

    146 fprintf (stderr, "Error in parameter %d (%s): separator already defined on a previous parameter with -sc or -tab\n",(int)PARNO, *argv);

    Build was successful. However I can't verify if this breaks any other architecture, or 32bit Linux.

    Thanks for your work! Very useful tool.

    Regards
    Gerry

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>