]> sigrok.org Git - libsigrokdecode.git/blame - decoders/uart/__init__.py
uart: Drop extensive protocol info (moved to wiki).
[libsigrokdecode.git] / decoders / uart / __init__.py
CommitLineData
64c29e28 1##
50bd5d25 2## This file is part of the libsigrokdecode project.
64c29e28
UH
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
8e828d2a 21'''
156509ca
UH
22UART protocol decoder.
23
8e828d2a
UH
24Universal Asynchronous Receiver Transmitter (UART) is a simple serial
25communication protocol which allows two devices to talk to each other.
26
3091f4e0
UH
27This decoder should work on all "UART-like" async protocols with one
28start bit (0), 7-9 databits, an (optional) parity bit, and one or more
29stop bits (1), in this order.
30
31It can be run on one signal line (RX or TX) only, or on two lines (RX + TX).
32
33There are various standards for the physical layer specification of the
34signals, including RS232, (TTL) UART, RS485, and others. However, the logic
35level of the respective pins is only relevant when acquiring the data via
36a logic analyzer (you have to select the correct logic analyzer and/or
37the correct place where to probe). Once the data is in digital form and
38matches the "UART" description above, this protocol decoder can work with
39it though, no matter whether the source was on TTL UART levels, or RS232,
40or others.
8e828d2a
UH
41
42Protocol output format:
43
44UART packet:
45[<packet-type>, <rxtx>, <packet-data>]
46
71077f34 47This is the list of <packet-type>s and their respective <packet-data>:
1541976f 48 - 'STARTBIT': The data is the (integer) value of the start bit (0/1).
8e828d2a
UH
49 - 'DATA': The data is the (integer) value of the UART data. Valid values
50 range from 0 to 512 (as the data can be up to 9 bits in size).
1541976f 51 - 'PARITYBIT': The data is the (integer) value of the parity bit (0/1).
8e828d2a 52 - 'STOPBIT': The data is the (integer) value of the stop bit (0 or 1).
1541976f
UH
53 - 'INVALID STARTBIT': The data is the (integer) value of the start bit (0/1).
54 - 'INVALID STOPBIT': The data is the (integer) value of the stop bit (0/1).
8e828d2a
UH
55 - 'PARITY ERROR': The data is a tuple with two entries. The first one is
56 the expected parity value, the second is the actual parity value.
57 - TODO: Frame error?
58
59The <rxtx> field is 0 for RX packets, 1 for TX packets.
60'''
61
24c74fd3 62from .pd import *
64c29e28 63