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

0 Members and 1 Guest are viewing this topic.

Offline NeuromodulatorTopic starter

  • Regular Contributor
  • *
  • Posts: 67
  • Country: cl
Rigol ds1000z WFM file reverse engineering
« on: July 18, 2016, 10:17:07 pm »
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: 9057
  • Country: us
  • Lots of engineer-tweakable parts inside!
Re: Rigol ds1000z WFM file reverse engineering
« Reply #1 on: July 18, 2016, 10:18:55 pm »
Sounds like a very handy utility, Neuro. Thanks for digging into it. :-+
TEA is the way. | TEA Time channel
 

Offline BravoV

  • Super Contributor
  • ***
  • Posts: 7547
  • Country: 00
  • +++ ATH1
Re: Rigol ds1000z WFM file reverse engineering
« Reply #2 on: July 19, 2016, 10:23:32 am »
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 NeuromodulatorTopic starter

  • Regular Contributor
  • *
  • Posts: 67
  • Country: cl
Re: Rigol ds1000z WFM file reverse engineering
« Reply #3 on: July 19, 2016, 03:52:30 pm »
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 19, 2016, 03:56:06 pm by Neuromodulator »
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11537
  • Country: my
  • reassessing directives...
Re: Rigol ds1000z WFM file reverse engineering
« Reply #4 on: July 19, 2016, 04:09:36 pm »
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)
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 
The following users thanked this post: Neuromodulator

Offline NeuromodulatorTopic starter

  • Regular Contributor
  • *
  • Posts: 67
  • Country: cl
Re: Rigol ds1000z WFM file reverse engineering
« Reply #5 on: July 19, 2016, 04:43:28 pm »
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 19, 2016, 04:56:34 pm by Neuromodulator »
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11537
  • Country: my
  • reassessing directives...
Re: Rigol ds1000z WFM file reverse engineering
« Reply #6 on: July 19, 2016, 05:01:27 pm »
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.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline NeuromodulatorTopic starter

  • Regular Contributor
  • *
  • Posts: 67
  • Country: cl
Re: Rigol ds1000z WFM file reverse engineering
« Reply #7 on: July 19, 2016, 05:37:50 pm »
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: 3781
  • Country: de
Re: Rigol ds1000z WFM file reverse engineering
« Reply #8 on: July 19, 2016, 09:14:24 pm »
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: 21
  • Country: au
Re: Rigol ds1000z WFM file reverse engineering
« Reply #9 on: December 21, 2016, 02:04:11 pm »
I've started doing this too, how far have we all gotten?
 

Offline TheoB

  • Regular Contributor
  • *
  • Posts: 62
  • Country: nl
Re: Rigol ds1000z WFM file reverse engineering
« Reply #10 on: December 21, 2016, 09:43:31 pm »
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: 21
  • Country: au
Re: Rigol ds1000z WFM file reverse engineering
« Reply #11 on: December 21, 2016, 11:33:57 pm »
It's not always convenient or possible to be hooked up to a network or computer at time of sampling
 

Offline HardWareMan

  • Newbie
  • Posts: 3
Re: Rigol ds1000z WFM file reverse engineering
« Reply #12 on: February 10, 2019, 02:06:53 pm »
Hi! Is there any update with new WFM file?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf