]>
Commit | Line | Data |
---|---|---|
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 | ''' | |
22 | 1-Wire protocol decoder. | |
23 | ||
a2b13347 IJ |
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 | |
4633e258 | 26 | layered. |
a2b13347 | 27 | - Link layer (reset, presence detection, reading/writing bits) |
4633e258 | 28 | - Network layer (skip/search/match device ROM addresses) |
758d2ea9 | 29 | - Transport layer (transport data between 1-Wire master and device) |
4633e258 IJ |
30 | |
31 | Link layer | |
a2b13347 | 32 | |
f4d0363d IJ |
33 | Sample rate: |
34 | A high enough sample rate is required to properly detect all the elements of | |
35 | the protocol. A lower sample rate can be used if the master does not use | |
36 | overdrive communication speed. The next minimal values should be used: | |
37 | - overdrive available: 2MHz minimum, 5MHz suggested | |
38 | - overdrive not available: 400kHz minimum, 1MHz suggested | |
39 | ||
a2b13347 IJ |
40 | Probes: |
41 | 1-Wire requires a single signal, but some master implementations might have a | |
42 | separate signal use to deliver power to the bus during temperature conversion | |
43 | as an example. This power signal is currently not parsed. | |
44 | - owr (1-Wire bus) | |
45 | - pwr (1-Wire power) | |
46 | ||
47 | Options: | |
48 | 1-Wire is an asynchronous protocol, so the decoder must know the sample rate. | |
49 | The timing for sampling bits, presence and reset is calculated by the decoder, | |
50 | but in case the user wishes to use different values, it is possible to | |
51 | configure the next timing values (number of sample rate periods): | |
52 | - overdrive (if active the decoder will be prepared for overdrive) | |
53 | - cnt_normal_bit (time for normal mode sample bit) | |
4633e258 | 54 | - cnt_normal_slot (time for normal mode data slot) |
a2b13347 IJ |
55 | - cnt_normal_presence (time for normal mode sample presence) |
56 | - cnt_normal_reset (time for normal mode reset) | |
57 | - cnt_overdrive_bit (time for overdrive mode sample bit) | |
4633e258 | 58 | - cnt_overdrive_slot (time for overdrive mode data slot) |
a2b13347 IJ |
59 | - cnt_overdrive_presence (time for overdrive mode sample presence) |
60 | - cnt_overdrive_reset (time for overdrive mode reset) | |
61 | This options should be configured only on very rare cases and the user should | |
62 | read the decoder source code to understand them correctly. | |
63 | ||
64 | Annotations: | |
4633e258 IJ |
65 | Link layer annotations show the next events: |
66 | - NOTE/WARNING/ERROR | |
67 | Possible sample rate related timing issues are reported. | |
68 | - RESET/PRESENCE True/False | |
69 | The event is marked from the signal negative edge to the end of the reset | |
70 | high period. It is also reported if there are any devices attached to the | |
71 | bus. | |
72 | - BIT 0/1 | |
73 | The event is marked from the signal negative edge to the end of the data | |
74 | slot. The value of each received bit is also provided. | |
a2b13347 | 75 | |
c08aea7e | 76 | TODO: |
4633e258 IJ |
77 | - check for protocol correctness, if events are timed inside prescribed limits |
78 | - maybe add support for interrupts, check if this feature is deprecated | |
51990c45 IJ |
79 | ''' |
80 | ||
d37961b0 | 81 | from .onewire_link import * |