]> sigrok.org Git - libsigrokdecode.git/blob - decoders/onewire_transport/__init__.py
28db017107c5f92891868f6493f233df18e5e319
[libsigrokdecode.git] / decoders / onewire_transport / __init__.py
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 '''
22 1-Wire protocol decoder.
23
24 The 1-Wire protocol enables bidirectional communication over a single wire (and
25 ground) between a single master and one or multiple slaves. The protocol is
26 layered, 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)
29 The higher layers (transport, presentation) are not decoded, since they are
30 mostly device specific and it would take a lot of code to interpret them.
31
32 Sample rate:
33 A high enough sample rate is required to properly detect all the elements of
34 the protocol. A lower sample rate can be used if the master does not use
35 overdrive 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
39 Probes:
40 1-Wire requires a single signal, but some master implementations might have a
41 separate signal use to deliver power to the bus during temperature conversion
42 as an example. This power signal is currently not parsed.
43 - owr (1-Wire bus)
44 - pwr (1-Wire power)
45
46 Options:
47 1-Wire is an asynchronous protocol, so the decoder must know the sample rate.
48 The timing for sampling bits, presence and reset is calculated by the decoder,
49 but in case the user wishes to use different values, it is possible to
50 configure 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)
58 This options should be configured only on very rare cases and the user should
59 read the decoder source code to understand them correctly.
60
61 Annotations:
62 Annotations 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)
66 If link layer annotations are shown, possible issues with sample rate and sample
67 timing are also shown.
68
69 TODO:
70 - add CRC checks for network layer
71 - add transport layer code
72 - review link layer code, to check for protocol correctness
73 - define output protocol
74 '''
75
76 from .onewire_transport import *