The recent Tytera MD-380, also known as Retevis RT-3, is very nice DMR portable UHF rig. However, one of its weak points is the programming software. While DMR for utility use often requires simple programming, when used for HAM radio, the big and evolving number of available repeaters, users and zones makes programming a big hassle.
The included programming software allows to do basic editing of the codeplug, but all the job has to be done manually. Inserting hundreds of records by hands is not what we expect to be doing in the computer era. Unfortunately the programming software does not have an export/import feature.
The specification of the binary format of the codeplug is available at this link.
The rdt2csv utility
This is why I studied the binary format of the codeplug, a file with extension .rdt that is saved and loaded by the Tytera/Retevis programming utility, and created rdt2csv, a command line utility that exports and imports the contents in CSV files.
CSV files are text files organized in lines, where each line is divided in fields, as specified by rfc4180. These files can be processed by Excel or OpenOffice Calc, editted with a simple text editor or processed by automatic utilities.
The rdt2csv utility exports the various tables in different CSV files. For example, it exports a file for the Channel Information table, adding one line for every defined channel. Same it does for the Zone Information, for the Scan List, the Digital RX Group List and so on.
Single entries, like General Settings, is exported as a CSV file containing a single line.
Note: from build 19020, rdt2csv detects and handles also the .bin/.img files generated by the md380-dfu command from the md380tools.
Cross tables references
The codeplug records contain references to each other. For example, inside a “Channel Information” the “Contact Name” field is a reference of a record in the “Digital Contacts” list. The codeplug stores this reference as the position in the target table: for example, if channel “ABC” has “Contact Name” internally set to 3, it means that it refers to the third entry of the “Digital Contacts” list. Maybe this is one of the reasons why the programming software does not allow to change the position of the records, who known.
The rdt2csv utility. instead of the number, uses the “Name” field of the referenced record. For example, if an exported channel has Contact Name referencing “John”, it will be exported as “John” and not using the internal number. In this way, the order of the records can be changed in the CSV files without loosing the right references.
Using the rdt2csv utility
rdt2csv is a command-line utility. This means that you will have to open an old “DOS” window and type in the command with parameters. I might later release a graphic version of this utility.
This is the command line help:
rdt2csv r.19000 - (c)2016 by Davide Achilli IZ2UUF - firstname.lastname@example.org USAGE: rdt2csv [-e|-u] <file.rdt> [-sc|-tab] <csv-files> -e export .rdt file to listed .csv files -u update .rdt file from listed .csv files -sc use semicolon (;) as CSV separator instead of comma -tab use tab as CSV separator instead of comma <csv-files>: -ch .csv filename for ChannelInformation -cont .csv filename for DigitalContact -rxgrp .csv filename for DigitalRxGroupList -gen .csv filename for GeneralSettings -scan .csv filename for ScanList -txt .csv filename for TextMessage -zone .csv filename for ZoneInformation This program can be freely redistributed.
Export from .rdt file
If the -e parameter is specified, the program will read the indicated .rdt file and it will export its contents in the listed .csv files.
rdt2csv -e myCodeplug.rdt -ch channels.csv -scan scan.csv
The example above reads the codeplug myCodeplug.rdt and exports its “Channel Information” table into a file called “channels.csv” and its “Scan List” in a file called “scan.csv”.
Update the rdt file
If the -u parameter is specified, the program will read the listed .csv files and merge their contents in the indicated .rdt file.
rdt2csv -u myCodeplug.rdt -ch channels.csv -scan scan.csv
The example above reads the files called “channels.csv” and “scan.csv” and merges them in the indicated codeplug myCodeplug.rdt. The word merging means that, in the example above, all the channels will be overwritten by “channels.csv”, all the scan lists will be overwrittend by “scan.csv”, but all the other information stored in the codeplug will not be touched.
The rfc4180 specification defines a CSV file to be separated by commas. After all, “CSV” is an acronym for “Comma Separated Values”. However, in many countries, including Italy, comma is used as decimal separator instead of the usual dot. For this reason, programs like Excel, when used in such countries, use a semicolon or a tab as separator. These separators can be used specifying the parameters -sc (semicolon) or -tab (tabulator).
Tables and fields
The CSV files are required to have headers. In other words, the first line is to be dedicated to give a name to each column. For example:
CallId,CallReceiveTone,CallType,Name 5057,on,private,"APRS Server" 2229192,on,group,"Wires-X" 1,off,group,"TG1 WW"
The names of the columns (i.e. “CallId”, “CallReceiveTone”, etc.) are specified in the description below. Also, some cells are required to assume one among some listed values. For example “CallType” can be one among group, private, all. Any other string will be refused.
The valid names and values for every available table are described in the tables below.
DISCLAIMER: use this utility at your own risk. I give no guarantee that the modified codeplugs will not brick your radio or cause other issues.
DISCLAIMER: this is a beta version, please help testing and report problems and suggestions! Thank you.
Download R.20974: rdt2csv.exe
Source code can be downloaded at macrocoding.tech.
Linux/MacOS/etc. users, hold on a little: I’m about to publish sources to allow building on any platform. The program is written in ANSI-C without any library call other than usual stdio/string/stdlib stuff: it can be built as-is on any platform.
05-June-2016 – Build 19004
– added support for field “Mode” in “General” (tnx IU2CIQ Emanuele)
– empty PC programming password now stored in CSV as empty string and not as ‘FF FF FF FF FF FF FF FF’
– PC programming password is converted to lowercase (as the programming program does)
07-June-2016 – Build 19010
– now DigitalContacts are referenced by CallId; contacts with dupe names are now handled correctly.
12-June-2016 – Build 19020
– rdt2csv now automatically detects and handles the .img/.bin files obtained by “md380-dfu read” command.
04-Sep-2016 – Build 19424
– fixed a bug: the tool was still considering in its checks the older records if their number was greater than the number of the new ones reporting false errors.
07-November-2017 – Build 20974
– Fixed crash on linux 64bit (thanks to Fabrizio IW2FDK)
– Changed detection of end of valid digital contacts (thanks to Dale Farnsworth)
grazie per il programma, è prevista una versione da riga di comando per linux?
Ho provato con wine ma mi da degli errori:
Record DigitalContact, line 898, field Name, violation: Dupe entry (already found at line 547)
Record ChannelInformation, line 21, field ContactName, violation: line number ‘964’ not found in table DigitalContact
wine: Unhandled page fault on write access to 0x0015fad8 at address 0x7bc47b15 (thread 0009), starting debugger…
err:seh:raise_exception Unhandled exception code c0000005 flags 0 addr 0x7bc49590
Per quanto riguarda i primi due errori inoltre (Dupe entry), purtroppo il software di programmazione non controlla eventuali doppioni in tabella, oppure un utente con lo stesso nominativo che ha richiesto più DMR-ID.
Spero di esserti stao utile, tu a me tantissimo!
I’m sorry, i didn’t realize this is an english blog…
After a manual revision of the .rdt, now with wine the utility works fine… the only problem is for dupe conctactname files.
A solution might be to use the CallId instead of name field.
Regarding Linux, don’t worry I’m about to release the portable sources.
Thanks for the suggestion of using callid instead of the name as key for the Digital Contacts, but the original codeplug editing program I used as a reference (CPS RT3) forbids multiple contacts with the same name. I would prefer to avoid the rdt2csv to generate codeplugs that could cause the original utility to crash.
Vy 73 de Davide IZ2UUF
I understand the requirement for unique ContactID’s, but it there a way to bypass that requirement so that they can be eliminated with out manually editing the rdt file?
ho riscontrato un problema con il file General.csv nel campo PcProgPassword vi erano 8 simboli “y” con dieresi.
Facendo l’upgrade mi dava l’errore PcProgPassword too long. Pertanto ho deciso di cancellare il campo password e lasciarlo vuoto.
Facendo l’upgrade infatti è andato a buon fine. Tuttavia ora non riesco più ne a leggere ne a scrivere il codeplug nella radio perchè mi richiede la password che tuttavia doveva essere nulla avendo lasciato il campo vuoto.
Sapresti dirmi come risolvere la situazione ?
Purtroppo non so dirti come risolvere il problema. Le otto “y” erano gli otto caratteri 0xFF che mette quando la password è nulla. Poco dopo ho modificato il programma in modo che le “y” non fossero mostrate e ho pubblicato subito l’aggiornamento su facebook.
Essendo il programma ancora in beta, avresti dovuto segnalarmi subito il problema senza procedere.
Probabilmente si può realizzare un’utility di reset della password. Stiamo lavorando in questo senso per ovviare a questo inconveniente.
grazie per la risposta anche se al momento non risolutiva.
Domanda, conoscendo la locazione di memoria della eeprom dove è memorizzata la password è possibile con un programmatore a basso livello forzare il valore a 0xFF per tutti gli 8 byte ?
FIXED. In case of unknown PC Programming Password, there is now a unlocking procedure.
Essentially a draw, but Romney understands that the economy is the key. He was very careful to emphasise agreement with the 2014 withdrawal from Afghanistan ; he understood that he could not afford to repeat Ryan's blunder re this in the veep debates &, Romney, to his credit, adroitly avoided doing so. That was the 1 worry I had before the debate. 3d debate summary : Obama : my position on country X is blah, blah, blahRomney : I agreeObama : my position on country Y is blah, blah, blah Romney : I agreeObama : my position on country Z is blah, blah, blahRomney : I agree –dragon/dinosaur
When i do an export from rdt to csv, the command box shows alot of errors about digital contacts.
When I do an update from csv to rdt, all the contacts except 1 are deleted wjen I look at the codeplug in the radio software.
1) version of rtd2csv
2) what errors you received
If you don’t want to make them public, feel free to sent them to my email iz2uuf ad iz2uuf dot net.
Vy 73 de Davide IZ2UUF
I have altered my rdt file “so” many times now, I feel it was corrupt in some way.
I created a new rdt file and the contacts are not affected now.
Your rdt2csv software is very useful to me now and makes editing much easier, thanks. Are you working on a GUI version soon?
Also, can you alter the .csv output to have channel name in column A, RX freq column B, TX freq column C?
Thank you again for useful software
thanks so much for sharing your great work.
I’m trying to merge two different code plugs I have found in internet. With the second codeplug I receive the error dupe entry.
I agree this is a good check in the upload, but what about avoiding it in the export phase?
Thank you again.
I find this very usefull software to put my generated csv files into the codeplug. I automated the proces of generating the CSV files CSV from scratch, using a downloaded list of DMR repeaters. This makes the channels in the zones always consistent.
The MD390 also has GPS settings, do you plan to create a version which also handles the MD390 rdt files with the GPS settings?
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
I generated a csv file using the command: rdt2csv -e radio.rdt -ch radio.csv -scan scanradio.csv
I’ve inserted 4 lines taken from another csv file obtained the same command.
then I to update radio.rdt using the command: rdt2csv -u radio.rdt -ch radio.csv -scan scanradio.csv, but I always get the folllowing error:
ERROR: file radio.csv, line 2, field ‘LoneWorker’: invalid value ‘off,normal,off,”12.5″,digital,1,slot1,off,off,off,off,none,0,off,on,off,low,always,low,off,180,on,low,13579012,4,0,0,none,43887’.
Valid values are ‘off’ and on’
under LoneWorker I have only off value
Don’t understand the issue can you help me?
bmmcwhirt >master > ./rdt2csv -e ../../../../my390.bin -ch my390.csv -scan scan.csv
rdt2csv r.20294 – (c)2017 by Davide Achilli IZ2UUF – email@example.com
Segmentation fault: 11
bmmcwhirt > master > uname -a
Darwin Bryans-MacBook-Pro.local 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64
I have not looked at the code at all, been a rough week but I will unless you have a solution before I get a chance.
This issue should be fixed with build 20974
Hi, what about this issues ?
rdt2csv r.19424 – (c)2016 by Davide Achilli IZ2UUF – firstname.lastname@example.org
Record GeneralSettings, field TxPreamble, violation: max value is 144
Record GeneralSettings, field VoxSensitivity, violation: allowed range 1…10
Record GeneralSettings, field RxLowBatteryInterval, violation: max value is 127
Record GeneralSettings, field ScanDigitalHangTime, violation: value between 5 and 100, multiple of 5
Record GeneralSettings, field ScanAnalogHangTime, violation: value between 5 and 100, multiple of 5
Record DigitalContact, line 56, field CallId, violation: Dupe entry (already found at line 55)
Found 6 rules violation(s) in input file ‘C:\TDMR\CPS_RETEVIS\RT3_IK4IDY.rdt’
Installazione di R.20974: rdt2csv.exe sotto Win 7 non possibile. Non ricevere un messaggio di errore. L’inizio di rdt2csv apre solo una finestra (<1sec)
Chiedi una spiegazione.
Ho trovato un’informazione e ho inserito la seguente riga di comando: (DOS CMD)
C:\rdt2csv —e md380BHB9SOI.rdt —ch channals.csu —scan scan.csu
rdt2csu r.2B294 — (0)2317 by Dauide Hchilli IZZUUF — email@example.com
Record DigitalContact, line 69, field Callld, violation: Dupe entry (already found at line 1)
Record DigitalContact, line 735, field Callld, violation: Dupe entry (already found at line B4)
Record DigitalContact, line 743, field Callld, uiolation: Dupe entry (already found at line 2)
Found 3 rules violation(s) in input file ‘md3BBHB9SOI.rdt’
tuttavia non sono stati creati file CSV
cosa sto sbagliando?
I have problem exporting codeplug from Tytera MD380-G software.
When I try to export channels I receive the following error:
Record ChannelInformation, line 999, field Name, violation: Dupe entry (already found at line 178)
What might be the cause?
Is a similar tool available that will convert MD-2017 rdt files to csv?
that would be really helpful.
This software was extremely helpful. I used it to combine codeplugs as well as generate working codeplugs for other radios. It sped the process up significantly. I got the following errors and thought I would report them to you as asked.
rdt2csv r.20294 – (c)2017 by Davide Achilli IZ2UUF – firstname.lastname@example.org
Record ChannelInformation, line 45, field ContactName, violation: line number ’74’ not found in table DigitalContact
Love the idea for this software, but I can’t generate any output. Version R.20294.