Industry Standard I/O

The torii.lib.stdio module provides industry standard I/O modules.

Serial I/O

class torii.lib.stdio.serial.AsyncSerialRX(*args, src_loc_at: int = 0, **kwargs)

Asynchronous serial receiver.

Parameters:
  • divisor (int) – Clock divisor reset value. Should be set to int(clk_frequency // baudrate).

  • divisor_bits (int) – Optional. Clock divisor width. If omitted, bits_for(divisor) is used instead.

  • data_bits (int) – Data width.

  • parity ('none', 'mark', 'space', 'even', 'odd') – Parity mode.

  • pins (torii.lib.io.Pin) – Optional. UART pins. See torii_boards.resources.UARTResource for layout.

Variables:
  • divisor (Signal, in) – Clock divisor.

  • data (Signal, out) – Read data. Valid only when rdy is asserted.

  • err.overflow (Signal, out) – Error flag. A new frame has been received, but the previous one was not acknowledged.

  • err.frame (Signal, out) – Error flag. The received bits do not fit in a frame.

  • err.parity (Signal, out) – Error flag. The parity check has failed.

  • rdy (Signal, out) – Read strobe.

  • ack (Signal, in) – Read acknowledge. Must be held asserted while data can be read out of the receiver.

  • i (Signal, in) – Serial input. If pins has been specified, pins.rx.i drives it.

class torii.lib.stdio.serial.AsyncSerialTX(*args, src_loc_at: int = 0, **kwargs)

Asynchronous serial transmitter.

Parameters:
  • divisor (int) – Clock divisor reset value. Should be set to int(clk_frequency // baudrate).

  • divisor_bits (int) – Optional. Clock divisor width. If omitted, bits_for(divisor) is used instead.

  • data_bits (int) – Data width.

  • parity ('none', 'mark', 'space', 'even', 'odd') – Parity mode.

  • pins (torii.lib.io.Pin) – Optional. UART pins. See torii_boards.resources.UARTResource for layout.

Variables:
  • divisor (Signal, in) – Clock divisor.

  • data (Signal, in) – Write data. Valid only when ack is asserted.

  • rdy (Signal, out) – Write ready. Asserted when the transmitter is ready to transmit data.

  • ack (Signal, in) – Write strobe. Data gets transmitted when both rdy and ack are asserted.

  • o (Signal, out) – Serial output. If pins has been specified, it drives pins.tx.o.

class torii.lib.stdio.serial.AsyncSerial(*args, src_loc_at: int = 0, **kwargs)

Asynchronous serial transceiver.

Parameters:
  • divisor (int) – Clock divisor reset value. Should be set to int(clk_frequency // baudrate).

  • divisor_bits (int) – Optional. Clock divisor width. If omitted, bits_for(divisor) is used instead.

  • data_bits (int) – Data width.

  • parity ('none', 'mark', 'space', 'even', 'odd') – Parity mode.

  • pins (torii.lib.io.Pin) – Optional. UART pins. See torii_boards.resources.UARTResource for layout.

Variables: