Difference between revisions of "Input output formats"

From sigrok
Jump to navigation Jump to search
m
Line 1: Line 1:
== Input formats ==
[[libsigrok]] supports a number of different input modules (a.k.a. file formats) and output modules, and has a generic API which allows easily adding more input/output modules.
 
== Supported input/output formats ==


{| border="0" style="font-size: smaller" class="alternategrey sortable sigroktable"
{| border="0" style="font-size: smaller" class="alternategrey sortable sigroktable"
|-
|-
!Input format
!Name
!Status
!Input
!Comments
!Output
!Description
|-
| [[File format:analog|Analog]]
| bgcolor="yellow" | —
| bgcolor="lime" | supported
| Analog data and types.
|-
| [[File format:ascii|ASCII]]
| bgcolor="yellow" | —
| bgcolor="lime" | supported
| ASCII art.
|-
|-
| Logic analyzer
| [[File format:binary|Binary]]
| bgcolor="lime" | 100%
| bgcolor="lime" | supported
| Getting samples directly from the logic analyzer hardware.
| bgcolor="lime" | supported
| Raw binary data output without any metadata attached.
|-
|-
| sigrok session
| [[File format:bits|Bits]]
| bgcolor="lime" | 100%
| bgcolor="yellow" | —
| Getting samples from existing sigrok session files (*.sr).
| bgcolor="lime" | supported
| 0/1 digits.
|-
|-
| ChronoVu LA8
| [[File format:chronovu_la8|ChronoVu LA8]]
| bgcolor="yellow" | 80%
| bgcolor="lime" | supported
| bgcolor="lime" | supported
| [[ChronoVu LA8]] software file format (usually with .kdt file extension).
| [[ChronoVu LA8]] software file format (usually with .kdt file extension).
|-
|-
| Binary
| [[File format:csv|CSV]]
| bgcolor="lime" | 100%
| bgcolor="lime" | supported
| Raw, binary data input without any metadata attached.
| bgcolor="lime" | supported
|}
| Comma-separated values.
 
=== Logic analyzer ===
 
Getting data directly from a logic analyzer device.
 
=== sigrok session ===
 
The [[File format:sigrok|sigrok session]] file format (*.sr).
 
=== ChronoVu LA8 ===
 
See [[Input output formats#ChronoVu_LA8_2|below]].
 
=== Binary ===
 
Raw, binary input format without any metadata.
 
== Output formats ==
 
{| border="0" style="font-size: smaller" class="alternategrey sortable sigroktable"
|-
|-
!Output format
| [[File format:gnuplot|gnuplot]]
!Status
| bgcolor="yellow" | —
!Comments
| bgcolor="lime" | supported
| Gnuplot data file format (tab-separated columns of '1' and '0' characters). You need another gnuplot input file such as [http://sigrok.org/gitweb/?p=libsigrok.git;a=blob;f=contrib/gnuplot_usbeesx.gpi this one] in addition.
|-
|-
| sigrok session
| [[File format:hex|hex]]
| bgcolor="lime" | 100%
| bgcolor="yellow" | —
| The sigrok session file format (*.sr). This is the default (and recommended) format to save dumps to file.
| bgcolor="lime" | supported
| Hexadecimal digits.
|-
|-
| ASCII bits
| [[File format:ols|ols]]
| bgcolor="lime" | 100%
| bgcolor="yellow" | —
| —
| bgcolor="lime" | supported
| The file format used by the [http://www.lxtreme.nl/ols/ "Alternative" Java client] for the [[Openbench Logic Sniffer]].
|-
|-
| ASCII hexdump
| [[File format:srzip|srzip]]
| bgcolor="lime" | 100%
| bgcolor="lime" | supported
| —
| bgcolor="lime" | supported
| The current (v2) sigrok session file format (*.sr).
|-
|-
| Binary
| [[File format:vcd|VCD]]
| bgcolor="lime" | 100%
| bgcolor="lime" | supported
| Raw, binary data output without any metadata attached.
| bgcolor="lime" | supported
| The [http://en.wikipedia.org/wiki/Value_change_dump Value Change Dump] format (can also be visualized in [http://gtkwave.sourceforge.net/ gtkwave], for instance).
|-
|-
| Gnuplot
| [[File format:wav|WAV]]
| bgcolor="lime" | 100%
| bgcolor="lime" | supported
| Gnuplot data file format (tab-separated columns of '1' and '0' characters). You need another gnuplot input file such as [http://sigrok.git.sourceforge.net/git/gitweb.cgi?p=sigrok/sigrok;a=blob;f=libsigrok/contrib/gnuplot_usbeesx.gpi this one] in addition.
| bgcolor="lime" | supported
| The [http://en.wikipedia.org/wiki/WAV waveform audio] (WAV) file format.
 
|}
 
== Possible candidates for future input/output formats ==
 
{| border="0" style="font-size: smaller" class="alternategrey sortable sigroktable"
|-
|-
| VCD
!Name
| bgcolor="lime" | 100%
!Description
| The [http://en.wikipedia.org/wiki/Value_change_dump Value Change Dump] format can be visualized in [http://gtkwave.sourceforge.net/ gtkwave], for instance.
|-
|-
| OLS
| Scanalogic
| bgcolor="lime" | 100%
| Used by the [[IKALOGIC Scanalogic-2]] and [[IKALOGIC ScanaPLUS]] logic analyzers.
| The file format used by the [http://www.lxtreme.nl/ols/ "Alternative" Java client] for the [[Openbench Logic Sniffer]].
|-
|-
| ChronoVu LA8
| [[File format:rigol_rof|Rigol ROF]]
| bgcolor="yellow" | 80%
| Used by the [[Rigol DP800 series]] power supplies.
| [[ChronoVu LA8]] software file format (usually with .kdt file extension).
|-
|-
| CSV
| Rigol RAF
| bgcolor="yellow" | 80%
| Used by the Rigol DG1000Z, DG4000, and DG5000 series signal generators. See [http://www.batronix.com/pdf/Rigol/UserGuide/DG1000Z_UserGuide_EN.pdf DG1000Z User Guide] page 2-75, also [http://www.eevblog.com/forum/testgear/rigol-dg4000-series-raf-file-format/msg559443/ this post] at eevblog.
| Comma-separated values.
|}
|}
=== sigrok session ===
The sigrok session file format (*.sr). This is the default (and recommended) format to save dumps to file.
=== Bits ===
<small>
$ '''sigrok-cli --output-format bits --samples 1000'''
Acquisition with 8/8 probes at 200 KHz
1:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
2:00000000 00011111 11111111 11100000 00000000 00011111 11111111 11110000
3:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
4:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
5:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
6:01111000 01001100 01111100 01100000 00011100 01101100 00011100 00100011
7:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
8:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
1:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
2:00000000 00001111 11111111 11110000 00000000 00000111 11111111 11111000
3:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
4:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
5:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
6:00011110 00100111 00001110 00110000 01001110 00110010 01101110 00010000
7:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
8:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
[...]
</small>
=== ASCII ===
<small>
$ '''sigrok-cli --config samplerate=1M --probes 1,2 --output-format ascii --time 10'''
Acquisition with 2/16 probes at 1 MHz
1:/""""""""\.........../""""""""\.........../""""""""\.........../""""""""\.
2 :........../"""""""""""""""""""\...................../"""""""""""""""""""\.
1:........./"""""""""\........../"""""""""\........../"""""""""\........../"
2:..................../"""""""""""""""""""\..................../""""""""""""
1:""""""""\........../""""""""\.........../""""""""\.........../""""""""\...
2:"""""""\...................../"""""""""""""""""""\...................../""
1:......../""""""""\........../"""""""""\........../"""""""""\........../"""
2:"""""""""""""""""\...................../"""""""""""""""""""\..............
1:""""""\........../"""""""""\........../""""""""\.........../""""""""\.....
2:....../"""""""""""""""""""\...................../"""""""""""""""""""\.....
</small>
=== Hex ===
<small>
$ '''sigrok-cli --output-format hex --samples 1000'''
Acquisition with 8/8 probes at 200 KHz
1:ff ff ff ff ff ff ff ff
2:00 7f ff c0 00 3f ff c0
3:ff ff ff ff ff ff ff ff
4:ff ff ff ff ff ff ff ff
5:ff ff ff ff ff ff ff ff
6:71 b2 71 8f 70 9f 78 c0
7:ff ff ff ff ff ff ff ff
8:ff ff ff ff ff ff ff ff
1:ff ff ff ff ff ff ff ff
2:00 3f ff e0 00 1f ff e0
3:ff ff ff ff ff ff ff ff
4:ff ff ff ff ff ff ff ff
5:ff ff ff ff ff ff ff ff
6:f8 d8 f8 c0 3c 4c 1c 63
7:ff ff ff ff ff ff ff ff
8:ff ff ff ff ff ff ff ff
[...]
</small>
=== Binary ===
Raw, binary output format without any metadata. In the example below every byte contains one sample consisting of 8 probe values (each bit denotes the high or low value of one probe; bit 0 corresponds to probe 0, and so on). In the example, probe 6 is tied to GND (i.e., low), all others are high.
<small>
$ '''sigrok-cli --output-format binary --samples 1000 > somefile.dat'''
$ '''hexdump -Cv somefile.dat'''
00000000  bf bf bf bf bf bf bf bf  bf bf bf bf bf bf bf bf  |................|
00000010  bf bf bf bf bf bf bf bf  bf bf bf bf bf bf bf bf  |................|
00000020  bf bf bf bf bf bf bf bf  bf bf bf bf bf bf bf bf  |................|
00000030  bf bf bf bf bf bf bf bf  bf bf bf bf bf bf bf bf  |................|
[...]
</small>
=== VCD (Value Change Dump) ===
[[File:Sigrok vcd output in gtkwave.png|thumb|320px|right|sigrok VCD output viewed in gtkwave]]
<small>
$ '''sigrok-cli --output-format vcd --samples 1000'''
$date Wed Apr  2 00:01:40 2011 $end
$version sigrok 0.2 $end
$comment
  Acquisition with 8/8 probes at 200 kHz
$end
$timescale 1 ns $end
$scope module sigrok $end
$var wire 1 ! channel1 $end
$var wire 1 " channel2 $end
$var wire 1 # channel3 $end
$var wire 1 $ channel4 $end
$var wire 1 % channel5 $end
$var wire 1 & channel6 $end
$var wire 1 ' channel7 $end
$var wire 1 ( channel8 $end
$upscope $end
$enddefinitions $end
$dumpvars
#0
1!
#0
0"
#0
1#
#0
1$
#0
1%
#0
0&
#0
1'
#0
1(
#3
1&
[...]
$dumpoff
$end
</small>
=== Gnuplot ===
[[File:Sigrok gnuplot output.png|thumb|right|320px|sigrok gnuplot output format, PNG format]]
<small>
$ '''sigrok-cli --output-format gnuplot --samples 1000'''
# Sample data in space-separated columns format usable by gnuplot
#
# Generated by: sigrok 0.2 on Fri Apr 15 20:25:58 2011
# Comment: Acquisition with 8/8 probes at 500 kHz
# Period: 500 ms
#
# Column        Probe
# -----------------------------------------------------------------------------
# 0            Sample counter (for internal gnuplot purposes)
# 1            1
# 2            2
# 3            3
# 4            4
# 5            5
# 6            6
# 7            7
# 8            8
0              1 0 1 1 1 0 1 1
6              1 0 1 1 1 1 1 1
11              1 0 1 1 1 0 1 1
14              1 0 1 1 1 1 1 1
[...]
</small>
=== OLS ===
The [https://github.com/jawi/ols/wiki/OLS-data-file-format OLS file format], as supported by [http://www.lxtreme.nl/ols/ jawi's "Alternative" OLS client] (>= 0.9.4-rc1).
[[File:Ols output in jawis client.png|thumb|right|320px|sigrok OLS output format in jawi's OLS client]]
<small>
$ '''sigrok-cli --driver demo --config pattern=random \'''
  '''--output-format ols --samples 1000'''
;Rate: 200000
;Channels: 8
;EnabledChannels: -1
;Compressed: true
;CursorEnabled: false
00000067@0
000000c6@1
00000069@2
00000073@3
00000051@4
000000ff@5
0000004a@6
000000ec@7
00000029@8
000000cd@9
000000ba@10
000000ab@11
000000f2@12
000000fb@13
000000e3@14
00000046@15
0000007c@16
[...]
</small>
=== ChronoVu LA8 ===
This is the file format understood by the [[ChronoVu LA8]] software. The usual file name extension is '''.kdt'''.
[[File:Chronovu la8 software.png|thumb|right|320px|sigrok chronovu-la8 output format in the [[ChronoVu LA8]] software]]
<small>
$ '''sigrok-cli --output-format chronovu-la8 \'''
  '''--output-file foo.kdt --samples 1000'''
<br clear=all/>
</small>
'''Limitations:'''
* The file size must be exactly 8388613 bytes (8 MB samples + 5 bytes metadata).
=== Comma-separated values (CSV) ===
TODO.
[[Category:APIs]]

Revision as of 18:34, 3 December 2014

libsigrok supports a number of different input modules (a.k.a. file formats) and output modules, and has a generic API which allows easily adding more input/output modules.

Supported input/output formats

Name Input Output Description
Analog supported Analog data and types.
ASCII supported ASCII art.
Binary supported supported Raw binary data output without any metadata attached.
Bits supported 0/1 digits.
ChronoVu LA8 supported supported ChronoVu LA8 software file format (usually with .kdt file extension).
CSV supported supported Comma-separated values.
gnuplot supported Gnuplot data file format (tab-separated columns of '1' and '0' characters). You need another gnuplot input file such as this one in addition.
hex supported Hexadecimal digits.
ols supported The file format used by the "Alternative" Java client for the Openbench Logic Sniffer.
srzip supported supported The current (v2) sigrok session file format (*.sr).
VCD supported supported The Value Change Dump format (can also be visualized in gtkwave, for instance).
WAV supported supported The waveform audio (WAV) file format.

Possible candidates for future input/output formats

Name Description
Scanalogic Used by the IKALOGIC Scanalogic-2 and IKALOGIC ScanaPLUS logic analyzers.
Rigol ROF Used by the Rigol DP800 series power supplies.
Rigol RAF Used by the Rigol DG1000Z, DG4000, and DG5000 series signal generators. See DG1000Z User Guide page 2-75, also this post at eevblog.