Author Topic: Rigol ds1000z WFM file reverse engineering  (Read 1337 times)

0 Members and 1 Guest are viewing this topic.

Offline Neuromodulator

  • Contributor
  • Posts: 37
Rigol ds1000z WFM file reverse engineering
« on: July 19, 2016, 08:17:07 AM »
Hello,

I've been working a bit in reverse engineering the WFM file format so as to convert it to the more friendly CSV. So far the code I have looks like junk so I have no usable utility yet, but I've identified some key data fields in the file, like the time base, voltage range, active channels, and the time series. As soon as I write a program to do the WFM to CSV conversion I'll post it here. If there is interest I could post what I've found so far as well.

 
The following users thanked this post: BravoV

Offline bitseeker

  • Super Contributor
  • ***
  • Posts: 3276
  • Country: us
  • Lots of engineer-tweakable parts inside!
Re: Rigol ds1000z WFM file reverse engineering
« Reply #1 on: July 19, 2016, 08:18:55 AM »
Sounds like a very handy utility, Neuro. Thanks for digging into it. :-+
Got GAS? Get TEA.
 

Offline BravoV

  • Super Contributor
  • ***
  • Posts: 4200
  • Country: id
  • An EEE (Eternal Electronics Enthusiast)
Re: Rigol ds1000z WFM file reverse engineering
« Reply #2 on: July 19, 2016, 08:23:32 PM »
Neuromodulator, thank you !  :-+ Subscribed.

.......  but I've identified some key data fields in the file, like the time base, voltage range, active channels, and the time series.

If its ok with you, please post the fields details you've discovered so far, tia.

Offline Neuromodulator

  • Contributor
  • Posts: 37
Re: Rigol ds1000z WFM file reverse engineering
« Reply #3 on: July 20, 2016, 01:52:30 AM »
Sure, here is what I've found so far (which I haven't double checked so may contain errors):

header =\
(
    ('az',    8, 'Model'),
    ('az',   28, 'Firmware'),
    ('i32',  88, 'Active Channels'),   # bit n = Ch(n-1)
    ('i32', 116, 'Points'),
    ('f32', 120, 'Time Base (s)'),
    ('ch',  124, 'Ch1'),
    ('ch',  152, 'Ch2'),
    ('ch',  180, 'Ch3'),
    ('ch',  208, 'Ch4'),
)

channel =\
(
    ('u8',   0, 'Active'),                 # 0 = Yes, 0 = No
    ('u8',   1, 'Coupling'),               # 0 = DC,  1 = DC
    ('u8',   2, 'Bandwidth Limit'),        # 0 = Enabled,  1 = Disabled
    ('i32',  4, 'Unknown'),                # Changes depending on if the channel is active and some other factor
    ('f32',  8, 'Voltage (v)'),
    ('f32', 12, 'Position (v)'),
    ('u8',  16, 'Inverted'),               # 0 = No, 1 = Yes
    ('u8',  17, 'Unit'),                   # 1 = A, 2 = V
)

az = ascii zero

The channel time series begins at position 3198, and is interleaved.

I'm also wondering if there is any tool to describe a binary file as a context free grammar and parse it automagically.
« Last Edit: July 20, 2016, 01:56:06 AM by Neuromodulator »
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 7445
  • Country: my
  • reassessing directives...
Re: Rigol ds1000z WFM file reverse engineering
« Reply #4 on: July 20, 2016, 02:09:36 AM »
I'm also wondering if there is any tool to describe a binary file as a context free grammar and parse it automagically.
automagically? in our dream. not automagically? thats called hex editor. btw, maybe you'll find my log file helpfull (attached)
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
 
The following users thanked this post: Neuromodulator

Offline Neuromodulator

  • Contributor
  • Posts: 37
Re: Rigol ds1000z WFM file reverse engineering
« Reply #5 on: July 20, 2016, 02:43:28 AM »
automagically? in our dream. not automagically? thats called hex editor. btw, maybe you'll find my log file helpfull (attached)

Thanks for the file, gonna take a look at it. When I talked about parsing, I ment parsing after the grammar has been defined, not detecting the grammar. There are tools that do that, but they are tailored to computer language parsing.
« Last Edit: July 20, 2016, 02:56:34 AM by Neuromodulator »
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 7445
  • Country: my
  • reassessing directives...
Re: Rigol ds1000z WFM file reverse engineering
« Reply #6 on: July 20, 2016, 03:01:27 AM »
I ment parsing after the grammar has been defined, not detecting the grammar. There are tools that do that, but they are tailored to computer language parsing.
what grammar? its just content... binary file format. if you already know the grammar (i mean file chunk format) then you should be able to make a simple parser script. this is what i did when reverse enginerring the WFM on many files output to make content comparison.
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
 

Offline Neuromodulator

  • Contributor
  • Posts: 37
Re: Rigol ds1000z WFM file reverse engineering
« Reply #7 on: July 20, 2016, 03:37:50 AM »
what grammar? its just content... binary file format. if you already know the grammar (i mean file chunk format) then you should be able to make a simple parser script. this is what i did when reverse enginerring the WFM on many files output to make content comparison.

I know, I was just looking for a standard way to describe a binary file grammar and a tool that could read the file and parse the binary. Since that apparently doesn't exist I'll continue doing it manually with code.
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 1717
  • Country: fr
Re: Rigol ds1000z WFM file reverse engineering
« Reply #8 on: July 20, 2016, 07:14:24 AM »
I know, I was just looking for a standard way to describe a binary file grammar and a tool that could read the file and parse the binary. Since that apparently doesn't exist I'll continue doing it manually with code.

Uff, I think you are overthinking it a bit - the file format is not likely to change, so a grammar and a generic parser would be an enormous overkill for this.
 

Offline freman

  • Contributor
  • Posts: 6
  • Country: au
Re: Rigol ds1000z WFM file reverse engineering
« Reply #9 on: December 22, 2016, 01:04:11 AM »
I've started doing this too, how far have we all gotten?
 

Offline TheoB

  • Regular Contributor
  • *
  • Posts: 56
  • Country: nl
Re: Rigol ds1000z WFM file reverse engineering
« Reply #10 on: December 22, 2016, 08:43:31 AM »
Just curious. Why would you want to use this method? I just ask the scope for the raw sample data. You only need a USB or network connection. It's all well documented.
 

Offline freman

  • Contributor
  • Posts: 6
  • Country: au
Re: Rigol ds1000z WFM file reverse engineering
« Reply #11 on: December 22, 2016, 10:33:57 AM »
It's not always convenient or possible to be hooked up to a network or computer at time of sampling
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

http://opalkelly.com/