uart-analyzer
¶
CLI reference¶
glasgow run uart-analyzer¶
Capture data exchange on a full duplex UART link. The rx
and tx
pins are always inputs;
they only affect the channel to which data is attributed.
The capture file format is Comma Separated Values, in the following line formats:
<CH>,<HEX-DATA>
, where <CH> isrx
ortx
, and <HEX-DATA> is a sequence of 8-bit hexadecimal values. (Unless--ascii
is used.)<CH>,"<ASC-DATA>"
, where <CH> is the same as above, and <ASC-DATA> is a sequence of ASCII characters or escape sequences. Characters 0x00, 0x09, 0x0A, 0x0D, 0x22, 0x5C are escaped as\0
,\t
,\n
,\r
,\x22
,\\
, and all other characters not in the range 0x20..0x7E (inclusive) are escaped as\x<HEX>
, where <HEX> is two hexadecimal digits. (If--ascii
is used.)<CH>,#F
, where <CH> is the same as above, to indicate a frame error on this channel.<CH>,#P
, where <CH> is the same as above, to indicate a parity error on this channel.
usage: glasgow run uart-analyzer [-h] [-V SPEC] [--rx PIN] [--tx PIN]
[--parity PARITY] [-b RATE] [--rx-baud RATE]
[--tx-baud RATE] [--ascii]
[FILE]
- file¶
save communications to FILE as comma separated values
- -h, --help¶
show this help message and exit
- -V <spec>, --voltage <spec>¶
configure I/O port voltage to SPEC (e.g.: ‘3.3’, ‘A=5.0,B=3.3’, ‘A=SA’)
- --rx <pin>¶
bind the applet I/O line ‘rx’ to PIN (default: ‘A0’, optional)
- --tx <pin>¶
bind the applet I/O line ‘tx’ to PIN (default: ‘A1’, optional)
- --parity {none,zero,one,odd,even}¶
receive parity bit as PARITY (default: none)
- -b <rate>, --baud <rate>¶
set RX and TX baud rates to RATE bits per second (default: 115200)
- --rx-baud <rate>¶
set RX baud rate to RATE bits per second (default: same as –baud)
- --tx-baud <rate>¶
set TX baud rate to RATE bits per second (default: same as –baud)
- --ascii, -A¶
format output data as ASCII with escape sequences
API reference¶
- enum glasgow.applet.interface.uart_analyzer.UARTAnalyzerError(value)¶
Valid values are as follows:
- Good = <UARTAnalyzerError.Good: 0>¶
- Frame = <UARTAnalyzerError.Frame: 1>¶
- Parity = <UARTAnalyzerError.Parity: 2>¶
- class glasgow.applet.interface.uart_analyzer.UARTAnalyzerInterface(logger: Logger, assembly: AbstractAssembly, channels: dict[str, GlasgowPin | None], parity='none')¶
- baud(channel: str) ClockDivisor ¶
Clock divisor for
channel
.- Raises:
ValueError – If no such channel exists.
- async capture() list[tuple[str, bytearray | UARTAnalyzerError]] ¶
Capture a sequence of messages.
Returns a list of
(channel, data)
or(channel, error)
tuples. Thedata
indicates a byte sequence transmitted on thechannel
, whileerror
indicates that an error has occurred. (TheUARTAnalyzerError.Good
error code will never appear in results.)This function concatenates consecutive data messages to improve readability; despite this, protocol decoders must be prepared to handle data being split across any number of messages at any boundaries.