<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://sigrok.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=BartW</id>
	<title>sigrok - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://sigrok.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=BartW"/>
	<link rel="alternate" type="text/html" href="https://sigrok.org/wiki/Special:Contributions/BartW"/>
	<updated>2026-04-19T06:15:00Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Protocol_decoder:Modbus&amp;diff=16624</id>
		<title>Protocol decoder:Modbus</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Protocol_decoder:Modbus&amp;diff=16624"/>
		<updated>2023-10-10T09:05:11Z</updated>

		<summary type="html">&lt;p&gt;BartW: Add Modbus to Protocol Decoder category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox protocol decoder&lt;br /&gt;
| id              = Modbus&lt;br /&gt;
| name            = Modbus RTU&lt;br /&gt;
| description     = Modbus RTU&lt;br /&gt;
| status          = supported&lt;br /&gt;
| license         = GPLv3+&lt;br /&gt;
| source_code_dir = modbus&lt;br /&gt;
| image           = [[File:Pd modbus.png|250px]]&lt;br /&gt;
| input           = uart&lt;br /&gt;
| output          = Modbus&lt;br /&gt;
| probes          = &amp;amp;mdash;&lt;br /&gt;
| optional_probes = &amp;amp;mdash;&lt;br /&gt;
| options         = channel&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;modbus&amp;#039;&amp;#039;&amp;#039; decoder supports the [https://en.wikipedia.org/wiki/Modbus Modbus] bus protocol. Right now it only supports Modbus RTU, but it could be extended to support Modbus ASCII.&lt;br /&gt;
&lt;br /&gt;
== Protocol ==&lt;br /&gt;
Modbus RTU is a single client, multi-server protocol that is normally used over RS-485 for simple networks of devices. It can also be used over RS-232.&lt;br /&gt;
&lt;br /&gt;
It can be used in several different setups, but normally it&amp;#039;s used with the following settings:&lt;br /&gt;
&lt;br /&gt;
;Baud rate:19200&lt;br /&gt;
;Parity: none or even&lt;br /&gt;
;Stopbits: 1 or 2&lt;br /&gt;
&lt;br /&gt;
Modbus RTU is a client/server (or master/slave) protocol, where one device on the bus is a client, and the rest are servers. The client makes a request and (usually) a client responds; there is no other communication. Every server has an id between 1 and 247, these have to be set in advance.&lt;br /&gt;
&lt;br /&gt;
Every message starts with the server ID (or 0 for broadcast messages), then the function code. It ends with a 2 byte CRC. Because both client&amp;amp;rarr;server and server&amp;amp;rarr;client messages have the same format, it can be impossible for a logic sniffer to determine which is which.&lt;br /&gt;
&lt;br /&gt;
Modbus is an open protocol that is managed by the Modbus organization. The newest version of the specification at the time of writing is [http://modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf v1.1b3]&lt;br /&gt;
&lt;br /&gt;
== Decoding ==&lt;br /&gt;
The decoder always decodes the TX output from the UART decoder as client&amp;amp;rarr;server.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;channel&amp;#039;&amp;#039; setting determines which channel will be interpreted as server&amp;amp;rarr;client, RX or TX.&lt;br /&gt;
&lt;br /&gt;
=== RS-485 ===&lt;br /&gt;
Most Modbus RTU happens over a RS-485 bus. The problem is that the decoder can&amp;#039;t tell if a message is meant to be client&amp;amp;rarr;server or server&amp;amp;rarr;client. The solution Sigrok uses is to decode it as both, and let the user decide which of the two outputs it the correct one for that message.&lt;br /&gt;
&lt;br /&gt;
So for RS-485 you usually have only one UART channel, and that should be set to TX. Server&amp;amp;rarr;client communication is on the TX channel, so set the option in the Modbus decoder to TX.&lt;br /&gt;
&lt;br /&gt;
For the physical interface, the neatest thing to do is to use some kind of converter to convert the differential RS-485 bus to a signal line (relative to ground). In practice you can get away with other solutions.&lt;br /&gt;
&lt;br /&gt;
Properly terminating the RS-485 bus can do a lot to improve signal quality.&lt;br /&gt;
&lt;br /&gt;
=== RS-232 ===&lt;br /&gt;
In some applications the client will be connected though a RS-232/RS-485 converter. In these cases it&amp;#039;s easier to probe the signal on the RS-232 side. So the TX line of the UART decoder should be set to the client&amp;#039;s TX line.&lt;br /&gt;
&lt;br /&gt;
In this case the server&amp;amp;rarr;client communication is on the RX line, so set the channel setting to RX.&lt;br /&gt;
&lt;br /&gt;
You probably have to invert the signals, and you can do this with the UART decoder.&lt;br /&gt;
&lt;br /&gt;
Some logic analyzers are not rated for the high voltages that RS-232 is allowed to reach. For their older models, Saleae recommended putting a 10&amp;amp;nbsp;k&amp;amp;Omega; resistor in series with the probe.&lt;br /&gt;
&lt;br /&gt;
[[Category:Protocol decoder]]&lt;/div&gt;</summary>
		<author><name>BartW</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Protocol_decoder:Mdio&amp;diff=16623</id>
		<title>Protocol decoder:Mdio</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Protocol_decoder:Mdio&amp;diff=16623"/>
		<updated>2023-10-10T09:03:46Z</updated>

		<summary type="html">&lt;p&gt;BartW: Removed image that I copied from Modbus&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox protocol decoder&lt;br /&gt;
| id              = MDIO&lt;br /&gt;
| name            = IEEE 802.3 MII Management Interface&lt;br /&gt;
| description     = Two wire clocked bidirectional signal&lt;br /&gt;
| status          = supported&lt;br /&gt;
| source_code_dir = mdio&lt;br /&gt;
| input           = logic&lt;br /&gt;
| output          = mdio&lt;br /&gt;
| probes          = MDIO, MDC&lt;br /&gt;
| optional_probes = &amp;amp;mdash;&lt;br /&gt;
| options         = show_debug_bits&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;mdio&amp;#039;&amp;#039;&amp;#039; protocol decoder supports the [https://en.wikipedia.org/wiki/Management_Data_Input/Output Management Data Input and Output] protocol. This is a bidirection, single master protocol. It&amp;#039;s also known SMI (Serial Management Interface), or as the MII Management layer.&lt;br /&gt;
&lt;br /&gt;
The goal is to allow communication of settings and status between an Ethernet PHY and some device that needs Ethernet connectivity (the MAC).&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s defined in the IEE 802.3 standard. This standard is available for free from IEEE, but you do need to register to download it. It&amp;#039;s defined (amongst other things) in chapter 22.&lt;br /&gt;
&lt;br /&gt;
The protocol defines how to read and write registers. Registers 0-15 are defined by the standard, and 16-31 are left free for a specific PHY to have specific settings. These should be described in the PHY&amp;#039;s datasheet.&lt;br /&gt;
&lt;br /&gt;
== Protocol ==&lt;br /&gt;
&lt;br /&gt;
The clock line (MDC) goes between 0 and the chip&amp;#039;s logic level. The data from the MDIO signal is read on the clock rising edge. A high voltage is read as a 1, and a low voltage as a 0.&lt;br /&gt;
&lt;br /&gt;
The MAC provides the clock signal. The clock should be a maximum of 2.5 MHz (although a lot of PHY&amp;#039;s will accept faster clocks), but can be as slow as you want and doesn&amp;#039;t need to be a stable frequency.&lt;br /&gt;
&lt;br /&gt;
There should be a pullup on the MDIO signal. To start a message, the MAC takes over writing on the MDIO. If it&amp;#039;s a read command, control of the MDIO is given to the PHY during the &amp;quot;turnaround&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The frame structure is defined in chapter 22.2.4.5 of the standard. A message is structured as follows:&lt;br /&gt;
;Preamble: there are first 32 high bits. Some PHY&amp;#039;s allow this to be shorter under certain conditions, but this isn&amp;#039;t supported by the logic analyzer.&lt;br /&gt;
;Start of frame: this is a 0,1 pattern&lt;br /&gt;
;Operation code: 1,0 for a &amp;quot;read&amp;quot; message, 1,0 for a &amp;quot;write&amp;quot;.&lt;br /&gt;
;PHY address: 5 bits to select the PHY being addressed. Under certain contexts 0 is a broadcast address, check your PHY&amp;#039;s datasheet.&lt;br /&gt;
;Register address: 5 bits to select the address. Usually all registers are in the PHY&amp;#039;s datasheet, and 0-15 are also described in the standard in chapter 22.2.4.&lt;br /&gt;
;Turnaround: 1,0 signal to give the PHY the chance to take over the MDIO line (in the case of a read) and to make sure there are never 32 consecutive ones within a valid message&lt;br /&gt;
;Data: 16 data bits&lt;br /&gt;
&lt;br /&gt;
== Logic analyzer requirements ==&lt;br /&gt;
&lt;br /&gt;
According to the protocol the maximum clock speed is 2.5 MHz (400 ns per clock cycle), but some PHY&amp;#039;s allow faster speeds.&lt;br /&gt;
&lt;br /&gt;
According to the standard, the MDIO only needs to be stable for 10 ns around the rising clock. This means that although the clock signal is in theory only 2.5 MHz, you might need a much faster logic analyzer to actually read the signal. 100 MHz or more is recommended.&lt;br /&gt;
&lt;br /&gt;
[[Category:Protocol decoder]]&lt;/div&gt;</summary>
		<author><name>BartW</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Protocol_decoder:Mdio&amp;diff=16622</id>
		<title>Protocol decoder:Mdio</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Protocol_decoder:Mdio&amp;diff=16622"/>
		<updated>2023-10-10T09:02:30Z</updated>

		<summary type="html">&lt;p&gt;BartW: Created page with &amp;quot;{{Infobox protocol decoder | id              = MDIO | name            = IEEE 802.3 MII Management Interface | description     = Two wire clocked bidirectional signal | status          = supported | source_code_dir = mdio | image           = 250px | input           = logic | output          = mdio | probes          = MDIO, MDC | optional_probes = &amp;amp;mdash; | options         = show_debug_bits }}  The &amp;#039;&amp;#039;&amp;#039;mdio&amp;#039;&amp;#039;&amp;#039; protocol decoder supports the [https://en...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox protocol decoder&lt;br /&gt;
| id              = MDIO&lt;br /&gt;
| name            = IEEE 802.3 MII Management Interface&lt;br /&gt;
| description     = Two wire clocked bidirectional signal&lt;br /&gt;
| status          = supported&lt;br /&gt;
| source_code_dir = mdio&lt;br /&gt;
| image           = [[File:Pd modbus.png|250px]]&lt;br /&gt;
| input           = logic&lt;br /&gt;
| output          = mdio&lt;br /&gt;
| probes          = MDIO, MDC&lt;br /&gt;
| optional_probes = &amp;amp;mdash;&lt;br /&gt;
| options         = show_debug_bits&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;mdio&amp;#039;&amp;#039;&amp;#039; protocol decoder supports the [https://en.wikipedia.org/wiki/Management_Data_Input/Output Management Data Input and Output] protocol. This is a bidirection, single master protocol. It&amp;#039;s also known SMI (Serial Management Interface), or as the MII Management layer.&lt;br /&gt;
&lt;br /&gt;
The goal is to allow communication of settings and status between an Ethernet PHY and some device that needs Ethernet connectivity (the MAC).&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s defined in the IEE 802.3 standard. This standard is available for free from IEEE, but you do need to register to download it. It&amp;#039;s defined (amongst other things) in chapter 22.&lt;br /&gt;
&lt;br /&gt;
The protocol defines how to read and write registers. Registers 0-15 are defined by the standard, and 16-31 are left free for a specific PHY to have specific settings. These should be described in the PHY&amp;#039;s datasheet.&lt;br /&gt;
&lt;br /&gt;
== Protocol ==&lt;br /&gt;
&lt;br /&gt;
The clock line (MDC) goes between 0 and the chip&amp;#039;s logic level. The data from the MDIO signal is read on the clock rising edge. A high voltage is read as a 1, and a low voltage as a 0.&lt;br /&gt;
&lt;br /&gt;
The MAC provides the clock signal. The clock should be a maximum of 2.5 MHz (although a lot of PHY&amp;#039;s will accept faster clocks), but can be as slow as you want and doesn&amp;#039;t need to be a stable frequency.&lt;br /&gt;
&lt;br /&gt;
There should be a pullup on the MDIO signal. To start a message, the MAC takes over writing on the MDIO. If it&amp;#039;s a read command, control of the MDIO is given to the PHY during the &amp;quot;turnaround&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The frame structure is defined in chapter 22.2.4.5 of the standard. A message is structured as follows:&lt;br /&gt;
;Preamble: there are first 32 high bits. Some PHY&amp;#039;s allow this to be shorter under certain conditions, but this isn&amp;#039;t supported by the logic analyzer.&lt;br /&gt;
;Start of frame: this is a 0,1 pattern&lt;br /&gt;
;Operation code: 1,0 for a &amp;quot;read&amp;quot; message, 1,0 for a &amp;quot;write&amp;quot;.&lt;br /&gt;
;PHY address: 5 bits to select the PHY being addressed. Under certain contexts 0 is a broadcast address, check your PHY&amp;#039;s datasheet.&lt;br /&gt;
;Register address: 5 bits to select the address. Usually all registers are in the PHY&amp;#039;s datasheet, and 0-15 are also described in the standard in chapter 22.2.4.&lt;br /&gt;
;Turnaround: 1,0 signal to give the PHY the chance to take over the MDIO line (in the case of a read) and to make sure there are never 32 consecutive ones within a valid message&lt;br /&gt;
;Data: 16 data bits&lt;br /&gt;
&lt;br /&gt;
== Logic analyzer requirements ==&lt;br /&gt;
&lt;br /&gt;
According to the protocol the maximum clock speed is 2.5 MHz (400 ns per clock cycle), but some PHY&amp;#039;s allow faster speeds.&lt;br /&gt;
&lt;br /&gt;
According to the standard, the MDIO only needs to be stable for 10 ns around the rising clock. This means that although the clock signal is in theory only 2.5 MHz, you might need a much faster logic analyzer to actually read the signal. 100 MHz or more is recommended.&lt;br /&gt;
&lt;br /&gt;
[[Category:Protocol decoder]]&lt;/div&gt;</summary>
		<author><name>BartW</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Developers&amp;diff=10988</id>
		<title>Developers</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Developers&amp;diff=10988"/>
		<updated>2015-09-15T22:13:21Z</updated>

		<summary type="html">&lt;p&gt;BartW: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains documentation and resources for aspiring sigrok developers.&lt;br /&gt;
&lt;br /&gt;
== Source code browser ==&lt;br /&gt;
&lt;br /&gt;
* [http://sigrok.org/gitweb/ gitweb]&lt;br /&gt;
&lt;br /&gt;
== Tutorials and API descriptions ==&lt;br /&gt;
&lt;br /&gt;
* [http://sigrok.org/api/libsigrok/unstable/index.html libsigrok API]&lt;br /&gt;
* [http://sigrok.org/api/libsigrokdecode/unstable/index.html libsigrokdecode API]&lt;br /&gt;
* [[Protocol decoder HOWTO]]&lt;br /&gt;
* [[Protocol decoder API]]&lt;br /&gt;
* [[Formats and structures]]&lt;br /&gt;
* [[Hardware driver API]]&lt;br /&gt;
* [[Portability]]&lt;br /&gt;
&lt;br /&gt;
== Development guidelines ==&lt;br /&gt;
&lt;br /&gt;
Please check the respective sub-project&amp;#039;s HACKING file for coding guidelines and development tips.&lt;br /&gt;
&lt;br /&gt;
* [http://sigrok.org/gitweb/?p=libsigrok.git;a=blob;f=HACKING;hb=HEAD libsigrok]&lt;br /&gt;
* [http://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blob;f=HACKING;hb=HEAD libsigrokdecode]&lt;br /&gt;
* [http://sigrok.org/gitweb/?p=sigrok-cli.git;a=blob;f=HACKING;hb=HEAD sigrok-cli]&lt;br /&gt;
&amp;lt;!-- * [http://sigrok.org/gitweb/?p=sigrok-qt.git;a=blob;f=HACKING;hb=HEAD sigrok-qt]&lt;br /&gt;
* [http://sigrok.org/gitweb/?p=sigrok-gtk.git;a=blob;f=HACKING;hb=HEAD sigrok-gtk] --&amp;gt;&lt;br /&gt;
* [http://sigrok.org/gitweb/?p=pulseview.git;a=blob;f=HACKING;hb=HEAD PulseView]&lt;br /&gt;
* [http://sigrok.org/gitweb/?p=sigrok-firmware-fx2lafw.git;a=blob;f=HACKING;hb=HEAD sigrok-firmware-fx2lafw]&lt;br /&gt;
&lt;br /&gt;
== Design pages ==&lt;br /&gt;
&lt;br /&gt;
This is a list of pages we use while working through new features or designs. They are working documents, not official API or feature documentation.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;[[New trigger specification]]&amp;lt;/s&amp;gt;&lt;br /&gt;
* &amp;lt;s&amp;gt;[[High precision analog]]&amp;lt;/s&amp;gt;&lt;br /&gt;
* &amp;lt;s&amp;gt;[[Probe Groups‎]]&amp;lt;/s&amp;gt;&lt;br /&gt;
* [[Improved Configuration Enumeration]]&lt;br /&gt;
* &amp;lt;s&amp;gt;[[Input/output API revamp]]&amp;lt;/s&amp;gt;&lt;br /&gt;
* [[File format:sigrok/v3]]&lt;br /&gt;
* [[Domain-specific measurements and analysis]]&lt;br /&gt;
* [[Feeding hardware-decoded packets into libsigrok]]&lt;br /&gt;
* [[Sending data sequences to devices]]&lt;br /&gt;
&lt;br /&gt;
== Debugging ==&lt;br /&gt;
&lt;br /&gt;
If you would like to see the output of the sr_dbg() or sr_err() functions you can use one of the following [[sigrok-cli]] options:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;export SIGROK_DEBUG=1&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
or&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;sigrok-cli -l 5 &amp;#039;&amp;#039;&amp;lt;options&amp;gt;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;5&amp;#039;&amp;#039;&amp;#039; above is the log level. The following levels are available:&lt;br /&gt;
&lt;br /&gt;
* 0: no output at all&lt;br /&gt;
* 1: error messages&lt;br /&gt;
* 2: warnings (the default)&lt;br /&gt;
* 3: informational messages&lt;br /&gt;
* 4: debug&lt;br /&gt;
* 5: spew&lt;br /&gt;
&lt;br /&gt;
== PulseView and GDB ==&lt;br /&gt;
&lt;br /&gt;
[[PulseView]] can be a bit tricky to debug as running it in GDB can stall the entire X11 session when PulseView crashes. This can be worked around, however. One approach is running GDB with a script that automatically creates a backtrace and terminates GDB (and thus, PulseView):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;gdb --command=auto_bt.gdb build/bin/pulseview&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with auto_bt.gdb containing lines as these:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 run -l 5&lt;br /&gt;
 thread apply all bt&lt;br /&gt;
 quit&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another approach is to run gdb in tmux. When X11 freezes you can switch to a different virtual console, reattach to tmux, and continue the debugging process from there. This approach also makes it easier to use breakpoints.&lt;br /&gt;
&lt;br /&gt;
== Valgrind ==&lt;br /&gt;
&lt;br /&gt;
The following instructions outline how you can use [http://valgrind.org/ valgrind] to help find memory-related bugs in the sigrok libraries and frontends.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Debug packages setup (optional):&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
In order to get more useful output from valgrind you can (optionally) install various &amp;#039;&amp;#039;&amp;#039;-dbg&amp;#039;&amp;#039;&amp;#039; packages (if your distro provides them).&lt;br /&gt;
&lt;br /&gt;
Example for [[libsigrok]] / [[libsigrokdecode]] / [[sigrok-cli]] on Debian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;apt-get install libgcc1-dbg libpcre3-dbg libglib2.0-0-dbg libftdi1-dbg zlib1g-dbg libasound2-dbg python3-dbg valgrind-dbg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
For GTK+ based frontends (e.g. [[sigrok-gtk]]) additional packages might be helpful in some cases:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;apt-get install libgtk2.0-0-dbg libatk1.0-dbg libpango1.0-0-dbg libcairo2-dbg \&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
   &amp;#039;&amp;#039;&amp;#039;libfontconfig1-dbg libx11-6-dbg libxcomposite1-dbg libxfixes3-dbg libxdamage1-dbg \&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
   &amp;#039;&amp;#039;&amp;#039;libpixman-1-0-dbg libxcb1-dbg libx11-xcb1-dbg libxcb-render0-dbg libxcb-shm0-dbg \&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
   &amp;#039;&amp;#039;&amp;#039;libffi5-dbg libxau6-dbg libxdmcp6-dbg libxcursor1-dbg libxi6-dbg libxinerama1-dbg \&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
   &amp;#039;&amp;#039;&amp;#039;libxrender1-dbg libxext6-db libxrandr2-dbg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Qt and/or Boost based frontends (e.g. [[PulseView]]) additional packages might be helpful in some cases:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;apt-get install libboost1.50-dbg libqt4-dbg libstdc++6-4.7-dbg libaudiofile-dbg \&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
   &amp;#039;&amp;#039;&amp;#039;libsm6-dbg libice6-dbg libxt6-dbg libicu48-dbg libjpeg62-dbg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Building:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Here&amp;#039;s a short overview of how to build the sigrok subprojects for use with valgrind. Basically everything should be built with &amp;#039;&amp;#039;&amp;#039;-g O0&amp;#039;&amp;#039;&amp;#039; (enable debug output, and disable compiler optimizations). In this example, everything is installed into a custom install directory ($HOME/sr) in order to have a clean and consistent environment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;cd libsigrok; CFLAGS=&amp;quot;-g -O0&amp;quot; ./configure --prefix=$HOME/sr &amp;amp;&amp;amp; make install&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;cd libsigrokdecode; CFLAGS=&amp;quot;-g -O0&amp;quot; ./configure --prefix=$HOME/sr &amp;amp;&amp;amp; make install&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;cd sigrok-cli; CFLAGS=&amp;quot;-g -O0&amp;quot; PKG_CONFIG_PATH=$HOME/sr/lib/pkgconfig ./configure --prefix=$HOME/sr &amp;amp;&amp;amp; make install&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;!-- $ &amp;#039;&amp;#039;&amp;#039;cd sigrok-gtk; CFLAGS=&amp;quot;-g -O0&amp;quot; PKG_CONFIG_PATH=$HOME/sr/lib/pkgconfig ./configure --prefix=$HOME/sr &amp;amp;&amp;amp; make install&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;cd sigrok-qt; CFLAGS=&amp;quot;-g -O0&amp;quot; PKG_CONFIG_PATH=$HOME/sr/lib/pkgconfig qmake &amp;amp;&amp;amp; make &amp;amp;&amp;amp; cp sigrok-qt $HOME/sr/bin&amp;#039;&amp;#039;&amp;#039; --&amp;gt;&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;cd pulseview; CXXFLAGS=&amp;quot;-g -O0&amp;quot; PKG_CONFIG_PATH=$HOME/sr/lib/pkgconfig cmake . -DCMAKE_INSTALL_PREFIX:string=$HOME/sr &amp;amp;&amp;amp; make install&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Usage:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
You can now run valgrind with your preferred options against the tools/libs in $HOME/sr. Note that &amp;#039;&amp;#039;&amp;#039;G_SLICE=always-malloc G_DEBUG=gc-friendly&amp;#039;&amp;#039;&amp;#039; should be used to get valgrind-friendly glib behaviour.&lt;br /&gt;
&lt;br /&gt;
Different command-line options, attached hardware and so on, will test different code paths in the libs/tools (e.g. [[sigrok-cli]]), of course.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;LD_LIBRARY_PATH=$HOME/sr/lib G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind -v --tool=memcheck --leak-check=full \&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
   &amp;#039;&amp;#039;&amp;#039;--num-callers=40 --track-origins=yes --leak-resolution=high --track-fds=yes --fullpath-after=. \&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
   &amp;#039;&amp;#039;&amp;#039;--read-var-info=yes ~/sr/bin/sigrok-cli --help&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Release process ==&lt;br /&gt;
&lt;br /&gt;
See [[Developers/Release process|Release process]].&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
&lt;br /&gt;
* [[Current events]]&lt;br /&gt;
* [[Public relations]]&lt;br /&gt;
* [[News]] (obsoleted by [http://www.sigrok.org/blog the blog])&lt;br /&gt;
* [[sigrok-gtk]] (GTK+ based LA GUI, currently not actively maintained)&lt;br /&gt;
* [[sigrok-qt]] (Qt based LA GUI, currently not actively maintained)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:APIs]]&lt;/div&gt;</summary>
		<author><name>BartW</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Protocol_decoder:Modbus&amp;diff=10926</id>
		<title>Protocol decoder:Modbus</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Protocol_decoder:Modbus&amp;diff=10926"/>
		<updated>2015-07-28T19:14:30Z</updated>

		<summary type="html">&lt;p&gt;BartW: Looking back at the capture I was talking about, the trick I mentioned here didn&amp;#039;t actually work, so I shouldn&amp;#039;t mention it.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox protocol decoder&lt;br /&gt;
| id              = Modbus&lt;br /&gt;
| name            = Modbus RTU&lt;br /&gt;
| description     = Modbus RTU&lt;br /&gt;
| status          = supported&lt;br /&gt;
| license         = GPLv3+&lt;br /&gt;
| source_code_dir = modbus&lt;br /&gt;
| image           = [[File:Pd modbus.png|250px]]&lt;br /&gt;
| input           = uart&lt;br /&gt;
| output          = Modbus&lt;br /&gt;
| probes          = &amp;amp;mdash;&lt;br /&gt;
| optional_probes = &amp;amp;mdash;&lt;br /&gt;
| options         = channel&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;modbus&amp;#039;&amp;#039;&amp;#039; decoder supports the [https://en.wikipedia.org/wiki/Modbus Modbus] bus protocol. Right now it only supports Modbus RTU, but it could be extended to support Modbus Ascii.&lt;br /&gt;
&lt;br /&gt;
== Protocol ==&lt;br /&gt;
Modbus RTU is a single client, multi-server protocol that is normally used over RS485 for simple networks of devices. It can also be used over RS232.&lt;br /&gt;
&lt;br /&gt;
It can be used in several different setups, but normally it&amp;#039;s used with the following settings:&lt;br /&gt;
&lt;br /&gt;
;Baud rate:19200&lt;br /&gt;
;Parity: none or even&lt;br /&gt;
;Stopbits: 1 or 2&lt;br /&gt;
&lt;br /&gt;
Modbus RTU is a Client/Server (or Master/slave) protocol, where one device on the bus is a client, and the rest are servers. The client makes a request and (usually) a client responds; there is no other communication. Every server has an id between 1 and 247, these have to be set in advance.&lt;br /&gt;
&lt;br /&gt;
Every message starts with the server ID (or 0 for broadcast messages), then the function code. It ends with a 2 byte CRC. Because both client&amp;amp;rarr;server and server&amp;amp;rarr;client messages have the same format, it can be impossible for a logic sniffer to determine which is which.&lt;br /&gt;
&lt;br /&gt;
Modbus is an open protocol that is managed by the modbus organization. The newest version of the specification at the time of writing is [http://modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf V1.1b3]&lt;br /&gt;
&lt;br /&gt;
== Decoding ==&lt;br /&gt;
The decoder always decodes the TX output from the UART decoder as client&amp;amp;rarr;server.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;channel&amp;#039;&amp;#039; setting determines which channel will be interpreted as server&amp;amp;rarr;client, RX or TX. &lt;br /&gt;
=== RS485 ===&lt;br /&gt;
Most Modbus RTU happens over a RS485 bus. The problem is that the decoder can&amp;#039;t tell if a message is meant to be client&amp;amp;rarr;server or server&amp;amp;rarr;client. The solution Sigrok uses is to decode it as both, and let the user decide which of the two outputs it the correct one for that message.&lt;br /&gt;
&lt;br /&gt;
So for RS485 you usually have only one UART channel, and that should be set to TX. Server&amp;amp;rarr;client communication is on the TX channel, so set the option in the modbus decoder to TX.&lt;br /&gt;
&lt;br /&gt;
For the physical interface, the neatest thing to do is to use some kind of converter to convert the differential RS485 bus to a signal line (relative to ground). In practice you can get away with other solutions.&lt;br /&gt;
&lt;br /&gt;
Properly terminating the RS485 bus can do a lot to improve signal quality.&lt;br /&gt;
&lt;br /&gt;
=== RS232 ===&lt;br /&gt;
In some applications the client will be connected though a RS232/RS485 converter. In these cases it&amp;#039;s easier to probe the signal on the RS232 side. So the TX line of the UART decoder should be set to the clients TX line.&lt;br /&gt;
&lt;br /&gt;
In this case the server&amp;amp;rarr;client communication is on the RX line, so set the channel setting to RX.&lt;br /&gt;
&lt;br /&gt;
You probably have to invert the signals, you can do this with the UART decoder.&lt;br /&gt;
&lt;br /&gt;
Some logic analyzers are not rated for the high voltages that RS232 is allowed to reach. For their older models, Saleae recommended putting a 10k&amp;amp;Omega; resistor in series with the probe.&lt;/div&gt;</summary>
		<author><name>BartW</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Protocol_decoder:Modbus&amp;diff=10925</id>
		<title>Protocol decoder:Modbus</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Protocol_decoder:Modbus&amp;diff=10925"/>
		<updated>2015-07-28T18:35:33Z</updated>

		<summary type="html">&lt;p&gt;BartW: Added information on how to use the decoder&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox protocol decoder&lt;br /&gt;
| id              = Modbus&lt;br /&gt;
| name            = Modbus RTU&lt;br /&gt;
| description     = Modbus RTU&lt;br /&gt;
| status          = supported&lt;br /&gt;
| license         = GPLv3+&lt;br /&gt;
| source_code_dir = modbus&lt;br /&gt;
| image           = [[File:Pd modbus.png|250px]]&lt;br /&gt;
| input           = uart&lt;br /&gt;
| output          = Modbus&lt;br /&gt;
| probes          = &amp;amp;mdash;&lt;br /&gt;
| optional_probes = &amp;amp;mdash;&lt;br /&gt;
| options         = channel&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;modbus&amp;#039;&amp;#039;&amp;#039; decoder supports the [https://en.wikipedia.org/wiki/Modbus Modbus] bus protocol. Right now it only supports Modbus RTU, but it could be extended to support Modbus Ascii.&lt;br /&gt;
&lt;br /&gt;
== Protocol ==&lt;br /&gt;
Modbus RTU is a single client, multi-server protocol that is normally used over RS485 for simple networks of devices. It can also be used over RS232.&lt;br /&gt;
&lt;br /&gt;
It can be used in several different setups, but normally it&amp;#039;s used with the following settings:&lt;br /&gt;
&lt;br /&gt;
;Baud rate:19200&lt;br /&gt;
;Parity: none or even&lt;br /&gt;
;Stopbits: 1 or 2&lt;br /&gt;
&lt;br /&gt;
Modbus RTU is a Client/Server (or Master/slave) protocol, where one device on the bus is a client, and the rest are servers. The client makes a request and (usually) a client responds; there is no other communication. Every server has an id between 1 and 247, these have to be set in advance.&lt;br /&gt;
&lt;br /&gt;
Every message starts with the server ID (or 0 for broadcast messages), then the function code. It ends with a 2 byte CRC. Because both client&amp;amp;rarr;server and server&amp;amp;rarr;client messages have the same format, it can be impossible for a logic sniffer to determine which is which.&lt;br /&gt;
&lt;br /&gt;
Modbus is an open protocol that is managed by the modbus organization. The newest version of the specification at the time of writing is [http://modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf V1.1b3]&lt;br /&gt;
&lt;br /&gt;
== Decoding ==&lt;br /&gt;
The decoder always decodes the TX output from the UART decoder as client&amp;amp;rarr;server.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;channel&amp;#039;&amp;#039; setting determines which channel will be interpreted as server&amp;amp;rarr;client, RX or TX. &lt;br /&gt;
=== RS485 ===&lt;br /&gt;
Most Modbus RTU happens over a RS485 bus. The problem is that the decoder can&amp;#039;t tell if a message is meant to be client&amp;amp;rarr;server or server&amp;amp;rarr;client. The solution Sigrok uses is to decode it as both, and let the user decide which of the two outputs it the correct one for that message.&lt;br /&gt;
&lt;br /&gt;
So for RS485 you usually have only one UART channel, and that should be set to TX. Server&amp;amp;rarr;client communication is on the TX channel, so set the option in the modbus decoder to TX.&lt;br /&gt;
&lt;br /&gt;
For the physical interface, the neatest thing to do is to use some kind of converter to convert the differential RS485 bus to a signal line (relative to ground). In practice you can get away with other solutions.&lt;br /&gt;
&lt;br /&gt;
For the RS485 dump in the sigrok dumps library, the ground was left disconnected. Channel 0 was put on one of the lines, with a 10k&amp;amp;Omega; resistor in series to protect the logic analyzer (A Logic16 clone).&lt;br /&gt;
&lt;br /&gt;
Properly terminating the RS485 bus can do a lot to improve signal quality.&lt;br /&gt;
&lt;br /&gt;
=== RS232 ===&lt;br /&gt;
In some applications the client will be connected though a RS232/RS485 converter. In these cases it&amp;#039;s easier to probe the signal on the RS232 side. So the TX line of the UART decoder should be set to the clients TX line.&lt;br /&gt;
&lt;br /&gt;
In this case the server&amp;amp;rarr;client communication is on the RX line, so set the channel setting to RX.&lt;br /&gt;
&lt;br /&gt;
You probably have to invert the signals, you can do this with the UART decoder.&lt;br /&gt;
&lt;br /&gt;
Some logic analyzers are not rated for the high voltages that RS232 is allowed to reach. For their older models, Saleae recommended putting a 10k&amp;amp;Omega; resistor in series with the probe.&lt;/div&gt;</summary>
		<author><name>BartW</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=File:Pd_modbus.png&amp;diff=10924</id>
		<title>File:Pd modbus.png</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=File:Pd_modbus.png&amp;diff=10924"/>
		<updated>2015-07-28T16:58:15Z</updated>

		<summary type="html">&lt;p&gt;BartW: Modbus message being decoded in pulseview&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Modbus message being decoded in pulseview&lt;br /&gt;
== Licensing ==&lt;br /&gt;
{{PD}}&lt;/div&gt;</summary>
		<author><name>BartW</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Protocol_decoder:Modbus&amp;diff=10923</id>
		<title>Protocol decoder:Modbus</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Protocol_decoder:Modbus&amp;diff=10923"/>
		<updated>2015-07-28T16:53:05Z</updated>

		<summary type="html">&lt;p&gt;BartW: Created page with &amp;quot;{{Infobox protocol decoder | id              = Modbus | name            = Modbus RTU | description     = Modbus RTU | status          = supported | license         = GPLv3+ |...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox protocol decoder&lt;br /&gt;
| id              = Modbus&lt;br /&gt;
| name            = Modbus RTU&lt;br /&gt;
| description     = Modbus RTU&lt;br /&gt;
| status          = supported&lt;br /&gt;
| license         = GPLv3+&lt;br /&gt;
| source_code_dir = modbus&lt;br /&gt;
| image           = [[File:Pd modbus.png|250px]]&lt;br /&gt;
| input           = uart&lt;br /&gt;
| output          = Modbus&lt;br /&gt;
| probes          = &amp;amp;mdash;&lt;br /&gt;
| optional_probes = &amp;amp;mdash;&lt;br /&gt;
| options         = channel&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;modbus&amp;#039;&amp;#039;&amp;#039; decoder supports the [https://en.wikipedia.org/wiki/Modbus Modbus] bus protocol. Right now it only supports Modbus RTU, but it could be extended to support Modbus Ascii.&lt;br /&gt;
&lt;br /&gt;
== Protocol ==&lt;br /&gt;
Modbus RTU is a single client, multi-server protocol that is normally used over RS485 for simple networks of devices. It can also be used over RS232.&lt;br /&gt;
&lt;br /&gt;
It can be used in several different setups, but normally it&amp;#039;s used with the following settings:&lt;br /&gt;
&lt;br /&gt;
;Baud rate:19200&lt;br /&gt;
;Parity: none or even&lt;br /&gt;
;Stopbits: 1 or 2&lt;br /&gt;
&lt;br /&gt;
Modbus RTU is a Client/Server (or Master/slave) protocol, where one device on the bus is a client, and the rest are servers. The client makes a request and (usually) a client responds; there is no other communication. Every server has an id between 1 and 247, these have to be set in advance.&lt;br /&gt;
&lt;br /&gt;
Every message starts with the server ID (or 0 for broadcast messages), then the function code. It ends with a 2 byte CRC. Because both client&amp;amp;rarr;server and server&amp;amp;rarr;client messages have the same format, it can be impossible for a logic sniffer to determine which is which.&lt;br /&gt;
&lt;br /&gt;
Modbus is an open protocol that is managed by the modbus organization. The newest version of the specification at the time of writing is [http://modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf V1.1b3]&lt;/div&gt;</summary>
		<author><name>BartW</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=User:BartW&amp;diff=10902</id>
		<title>User:BartW</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=User:BartW&amp;diff=10902"/>
		<updated>2015-07-13T20:44:41Z</updated>

		<summary type="html">&lt;p&gt;BartW: Created page with &amp;quot;== Decode the test file == An example Modbus RTU capture can be found in the sigrok-dumps repository under [http://sigrok.org/gitweb/?p=sigrok-dumps.git;a=tree;f=uart/modbus_r...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Decode the test file ==&lt;br /&gt;
An example Modbus RTU capture can be found in the sigrok-dumps repository under [http://sigrok.org/gitweb/?p=sigrok-dumps.git;a=tree;f=uart/modbus_rtu;h=1525f12f8cc7e06c9d2ffb5b9c4f505a216acdb4;hb=HEAD uart/modbus_rtu].&lt;br /&gt;
&lt;br /&gt;
To decode this dump, you first need to add a uart decoder with the following settings:&lt;br /&gt;
;RX:0&lt;br /&gt;
;TX:1&lt;br /&gt;
;Baud rate:19200&lt;br /&gt;
;Invert RX: Yes&lt;br /&gt;
;Invert TX: Yes&lt;br /&gt;
&lt;br /&gt;
To that add a Stack decoder: Modbus.&lt;/div&gt;</summary>
		<author><name>BartW</name></author>
	</entry>
</feed>