Author Topic: Rigol DG1000Z RAF file format  (Read 792 times)

0 Members and 1 Guest are viewing this topic.

Offline mike47203

  • Contributor
  • Posts: 6
  • Country: us
Rigol DG1000Z RAF file format
« on: July 14, 2019, 04:52:50 pm »
I have a need to generate some tremendously large arbitrary waveforms for my Rigol DG1062Z (with 16M option) and the Rigol Ultra Sigma software just won't get the job done for me. My plan is to convert my waveforms directly into RAF files. I tried using CSV and they do work, but take an incredibly long time to load from a USB drive.

While Rigol provides the file format information there are two CRC's that are not standard calculations and they don't provide any details. I managed to reverse engineer them using Greg Cook's CRC RevEng tool. I just want to document them here in case this information can be of use to anyone else.

http://reveng.sourceforge.net/

You can use a standard CRC-16/CCITT-FALSE algorithm mentioned in the following link and XOR the output with 0x0069 or you can just use 0x1021 for the polynomial and 0xebcc for the intial value instead of the default values.

http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat.crc-16-ccitt-false

The CRC values are byte swapped. As such they will not work as is with CRC RevEng unless they are swapped. At least I can't figure out how.

The waveform CRC input data starts at byte 57 and runs to the end of the file
The header waveform is bytes 1 to 50. You have to calculate the waveform CRC first and place it in the header before you calculate the header CRC.

Interesting thing about the CRC is that the function generator doesn't tell you there is a bad CRC, but I get some strange results if it is. Maybe the sample rate is off or there can be a bad sample point. Seems to be fine with a good CRC. There could be something else going on, I haven't experimented with this too much. Maybe a firmware issue.

The Ultra Sigma software will give you an error and won't load the RAF file if the CRC is bad.

I hope to write some code (maybe in Python) to generate this file. When I do I will post it too.

A big thanks to this HACKADY article for pointing me to Greg's tool.
https://hackaday.com/2019/06/27/reverse-engineering-cyclic-redundancy-codes/


 

Online tv84

  • Super Contributor
  • ***
  • Posts: 1763
  • Country: pt
Re: Rigol DG1000Z RAF file format
« Reply #1 on: July 14, 2019, 05:58:18 pm »
Is the CRC16 different from these cases?

https://www.eevblog.com/forum/testgear/rigol-dsxxxx-gel-firmware-file-format/msg1415612/#msg1415612


Edit:

Sorry! :)

I never added this info to that post but some months ago i also discovered this CRC16, as it's used in many Rigol FWs:

                // check = 0x6809 residue = 0x0000 name = "CRC-16/RIGOL 2"
                0x1021, 0xEBCC, 0, false, false
« Last Edit: July 14, 2019, 06:03:41 pm by tv84 »
 

Offline mike47203

  • Contributor
  • Posts: 6
  • Country: us
Re: Rigol DG1000Z RAF file format
« Reply #2 on: July 14, 2019, 06:12:48 pm »
Yes. That's it. I never ran across it since I was only searching for information on the RAF files instead of the firmware.

No problem. At least we know it's the same.  :)
 

Online tv84

  • Super Contributor
  • ***
  • Posts: 1763
  • Country: pt
Re: Rigol DG1000Z RAF file format
« Reply #3 on: July 14, 2019, 06:20:23 pm »
After discovering it the hard way, as you, I saw the algo in decompilation as then it's extremely easy to find the init value in the code.

BTW, did you read?

https://www.eevblog.com/forum/testgear/rigol-dg4000-series-raf-file-format/msg559476/#msg559476
« Last Edit: July 14, 2019, 06:27:26 pm by tv84 »
 

Offline mike47203

  • Contributor
  • Posts: 6
  • Country: us
Re: Rigol DG1000Z RAF file format
« Reply #4 on: July 14, 2019, 06:27:36 pm »
Take a look at CRC RevEng when you get a chance. It's pretty nice. Was easy to figure out once I realized the bytes were swapped.

I plan to make use of it in the future.
 

Online tv84

  • Super Contributor
  • ***
  • Posts: 1763
  • Country: pt
Re: Rigol DG1000Z RAF file format
« Reply #5 on: July 14, 2019, 06:35:16 pm »
I know it.  ;)

But I've implemented my own search function based on theirs. Gives me flexibility to use in my programs.

BTW, they are not "swapped", they're in little-endian format as most of Rigol FW.
« Last Edit: July 14, 2019, 06:37:28 pm by tv84 »
 

Offline mike47203

  • Contributor
  • Posts: 6
  • Country: us
Re: Rigol DG1000Z RAF file format
« Reply #6 on: July 14, 2019, 06:47:15 pm »
Sorry, I had to "swap" them when I ran them through the reversing program to make it work. I fed the data in as files and I couldn't find any options that allowed them to stay in little-endian with the rest of the header.

I could be missing something simple in the settings.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf