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> isrxortx, and <HEX-DATA> is a sequence of 8-bit hexadecimal values. (Unless--asciiis 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--asciiis 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 VOLTS] [--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 <volts>, --voltage <volts>¶
bus power (voltage reference of the inputs) (range: 1.8..5 V, or ‘S<port>’ to follow the voltage sensed on a port; default: unchanged)
- --rx <pin>¶
bind receive channel to PIN (default: ‘A0’, optional)
- --tx <pin>¶
bind transmit channel 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.UARTAnalyzerPorts(*, supply: glasgow.abstract.GlasgowSupply, rx: amaranth.lib.io.PortLike | None, tx: amaranth.lib.io.PortLike | None)¶
- supply: GlasgowSupply¶
bus power (voltage reference of the inputs)
- class glasgow.applet.interface.uart_analyzer.UARTAnalyzerInterface(logger: Logger, assembly: AbstractAssembly, ports: UARTAnalyzerPorts, 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. Thedataindicates a byte sequence transmitted on thechannel, whileerrorindicates that an error has occurred. (TheUARTAnalyzerError.Gooderror 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.