Rigol DG4000 series RAF file format - Page 1
Forum section: electronics / testgear

author: boeserbaer
author_rank: Contributor
timestamp: November 28, 2014, 07:11:37 pm
content: Hi all,I just purchased a Rigol DG4062, and first off, I am very pleased with the unit.One thing I had a lot of trouble locating was a descriptor of the file format.After creating some signals using the UltraStation software, I determined that the file format is a very simple 16 bit offset binary. Little Endian. No HeaderBasically there are 16384 samples in the file. Each sample is in the range 0 to 16383.Also, To force the DG4000 to output at 500MSPS, set the period to 32.768 us.16383 is positive full scale8192 is zero volts0 is negative full scaleFor those of you who use QT, here is a snippet :QString outFN = base_fn;outFN += QString::number(i);outFN += ".raf";QFile saveFile(outFN);if (!saveFile.open(QFile::WriteOnly)){qDebug() << "saveFile() unable to open" << outFN;return -1;}qDebug() << "saveData()" << outFN;QDataStream ds(&saveFile);ds.setByteOrder(QDataStream::LittleEndian);for (int j=0;j< 16384;j++){double val = indata; // indata is pre-filled with values in the range -1.0 to 1.0val *= 8192.0; // now in the range -8192 to 8192val += 8192.0; // now 0 - 16384if (val <0)val = 0.0;quint16 outInt = val;if (val > 16383)val = 16383;ds << outInt;}saveFile.close();edit: corrected formatting of "C" code

author: Murray
author_rank: Newbie
timestamp: November 29, 2014, 03:06:15 am
content: Thank you so much!I have a DG4162, and I expect this information tol come in very handy.Murray

author: biot
author_rank: Regular Contributor
timestamp: December 03, 2014, 12:08:27 pm
content: Quote from: boeserbaer on November 28, 2014, 07:11:37 pmThanks very much for figuring this out and documenting it.We're going to be documenting and writing sigrok input/output modules for this file format. I realize you've basically described the whole thing here, but I wonder if I could impose on you to send me a few files like these generated by your DG4062? Sine, square, ... it would really help to have "real world" files to test against when writing implementations, as testing an implementation against your own synthesized data is just asking for trouble.

author: boeserbaer
author_rank: Contributor
timestamp: December 03, 2014, 04:26:31 pm
content: Hi,I am not sure what you are asking for? If you want a file which I have created using my QT program, I can certainly give you one.What I have are basically recorded detector signals, translated for playback by the 4062. Let me know what you mean, and I will post something.Best Regards, Mike

author: Sparky
author_rank: Frequent Contributor
timestamp: December 03, 2014, 04:29:32 pm
content: Quote from: boeserbaer on December 03, 2014, 04:26:31 pmMaybebiotrefers to the waveforms you created using the official Rigol UltraStation software -- you mentioned in your original post you created some test signals to help determine the file format.

author: Carrington
author_rank: Super Contributor
timestamp: December 03, 2014, 04:40:06 pm
content: Quote from: Sparky on December 03, 2014, 04:29:32 pmSure!http://www.sigrok.org/wiki/TODO

author: biot
author_rank: Regular Contributor
timestamp: December 03, 2014, 04:47:31 pm
content: Quote from: Sparky on December 03, 2014, 04:29:32 pmAh, I was under the impression you could save waveforms which the hardware had on board to a USB stick or something. If that's not possible, sure -- the ones generated by that software will do. As long as I know they work well on the hardware, they'll serve for the purpose.

author: boeserbaer
author_rank: Contributor
timestamp: December 03, 2014, 06:25:04 pm
content: Any suggestions on how to upload a .raf file here?

author: boeserbaer
author_rank: Contributor
timestamp: December 03, 2014, 06:41:05 pm
content: I am so used to gmail examining the contents of zip files, that I forgot about zipping it. Duhh.

author: Teneyes
author_rank: Frequent Contributor
timestamp: December 03, 2014, 07:25:13 pm
content: @ boeserbaer , is this your Wave?

author: boeserbaer
author_rank: Contributor
timestamp: December 03, 2014, 08:21:26 pm
content: That looks exactly like what I put in, but I cannot tell the horizontal scale. The pulses should be separated by 408ns.

author: Teneyes
author_rank: Frequent Contributor
timestamp: December 03, 2014, 08:40:22 pm
content: Quote from: boeserbaer on December 03, 2014, 08:21:26 pmLook again, Zoom 408nsec /divEDIT , changed pix to your 408ns/div

author: Sparky
author_rank: Frequent Contributor
timestamp: July 09, 2018, 03:14:32 am
content: Just wanted to post that Rigol did provide a specification of the Arb. Wave Gen format across the DG1000/4000/5000 series. It was written in Jan 2015 but probably came out much later than that. I just found it when looking for info on the .RAF file format.Sparky