]> sigrok.org Git - libsigrokdecode.git/blame - decoders/onewire_network/__init__.py
onewire: combined reset and presence detect events, avoid unneeded overdrive exit...
[libsigrokdecode.git] / decoders / onewire_network / __init__.py
CommitLineData
51990c45
IJ
1##
2## This file is part of the sigrok project.
3##
4## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
5##
6## This program is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation; either version 2 of the License, or
9## (at your option) any later version.
10##
11## This program is distributed in the hope that it will be useful,
12## but WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14## GNU General Public License for more details.
15##
16## You should have received a copy of the GNU General Public License
17## along with this program; if not, write to the Free Software
18## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19##
20
21'''
221-Wire protocol decoder.
23
a2b13347
IJ
24The 1-Wire protocol enables bidirectional communication over a single wire (and
25ground) between a single master and one or multiple slaves. The protocol is
26layered, the provided parser decodes the next layers:
27- Link layer (reset, presence detection, reading/writing bits)
28- Network layer (skip, search, match device ROM addresses)
29The higher layers (transport, presentation) are not decoded, since they are
30mostly device specific and it would take a lot of code to interpret them.
31
f4d0363d
IJ
32Sample rate:
33A high enough sample rate is required to properly detect all the elements of
34the protocol. A lower sample rate can be used if the master does not use
35overdrive communication speed. The next minimal values should be used:
36- overdrive available: 2MHz minimum, 5MHz suggested
37- overdrive not available: 400kHz minimum, 1MHz suggested
38
a2b13347
IJ
39Probes:
401-Wire requires a single signal, but some master implementations might have a
41separate signal use to deliver power to the bus during temperature conversion
42as an example. This power signal is currently not parsed.
43- owr (1-Wire bus)
44- pwr (1-Wire power)
45
46Options:
471-Wire is an asynchronous protocol, so the decoder must know the sample rate.
48The timing for sampling bits, presence and reset is calculated by the decoder,
49but in case the user wishes to use different values, it is possible to
50configure the next timing values (number of sample rate periods):
51- overdrive (if active the decoder will be prepared for overdrive)
52- cnt_normal_bit (time for normal mode sample bit)
53- cnt_normal_presence (time for normal mode sample presence)
54- cnt_normal_reset (time for normal mode reset)
55- cnt_overdrive_bit (time for overdrive mode sample bit)
56- cnt_overdrive_presence (time for overdrive mode sample presence)
57- cnt_overdrive_reset (time for overdrive mode reset)
58This options should be configured only on very rare cases and the user should
59read the decoder source code to understand them correctly.
60
61Annotations:
62Annotations can be shown for each layer of the protocol separately:
63- link (the value of each transmitted bit is shown separately)
64- network (the ROM command, and address are shown)
65- transport (only transport layer byte transfers are shown)
66If link layer annotations are shown, possible issues with sample rate and sample
67timing are also shown.
68
c08aea7e 69TODO:
c08aea7e
IJ
70- add CRC checks for network layer
71- add transport layer code
72- review link layer code, to check for protocol correctness
f4d0363d 73- define output protocol
51990c45
IJ
74'''
75
d37961b0 76from .onewire_network import *