Skip to content

Instantly share code, notes, and snippets.

@Meisaka
Last active October 18, 2015 21:59
Show Gist options
  • Save Meisaka/10000725 to your computer and use it in GitHub Desktop.
Save Meisaka/10000725 to your computer and use it in GitHub Desktop.
Serial / Communications Devices

KaiComm Galactic Asynchronous Serial Interface

		 |     \ Kai 
		>|     \\ Communications
		>|     \\\
		>|     ///
		>|    //
		 |   /

Item Value Comment
Vendor code 0xA87C900E (KaiComm)
Device type 0x02 (Communications)
Device Subtype 0x02 (Async serial)
Device ID 0x17 (GASI)
DCPU Device ID 0x8BC9D6C7 (KaiComm GASI 7)
Version 0x010A

The KaiComm GASI is a bi-directional multiuse data port using a 3 wire connection. Transmit and receive are independent, but must operate at the same baud. The size of the data primitive is selectable ranging from 1 to 4 octets, but each octet is framed seperately on the wire. All data are sent LSB first.

Commands

  • 0x0000: Query status
    Sets Register A with status, bits will be set/clear as follows:

    • Bit 0 - Line is busy/not-connected (1), or idle (0)
    • Bit 1 - Receiving Active (1), or idle (0)
    • Bit 2 - Data available (1), or not (0)
    • Bit 3 - Transmitting Active (1), or idle (0)
    • Bit 4 - Transmit buffer is free (1), or full (0)
    • Bit 5-13 Reserved always set to 0
    • Bit 14 - Receive interrupts enabled: yes (1), no (0)
    • Bit 15 - Transmit done interrupts enabled: yes(1), no (0)
  • 0x0001: Configure port
    Register A holds options:

    • bits 0-1 - octet size minus 1.
    • bit 2 - send/use parity - yes (1), no (0)
    • bit 3 - parity mode (defines bit 5 function) - assert (1), make (0)
    • bit 4 - (parity assert mode) - mark (1), space (0)
    • bit 4 - (parity make mode) - odd (1), even (0)
    • bit 5 - stop bit count - two (1), one (0)
    • bit 6-15 - ignored.

    Register B holds the baud selection (b) in bits 0-2, range of 0-7; bit 4 Divides the baud by 3 (d) The baud is calculated like so: baud = 115200 / (2 ^ b)), and then divided by 3 if bit 4 is set. Possible bauds range from 300 to 115,200 bits per second. Each octet is sent with 8 bits, 1 start bit, 1 or 2 stop bits, and optionally a "parity" bit. (10-14 bits per octet)

  • 0x0002: Receive data
    Register A is set to the lower 16 bits, register B is set to the upper 16 bits.
    Register C is set with the error status, receive error status is cleared when read.
    when configured for less than 4 octets unused bits are set to 0.

    Receive Error status codes:

    • 0x0000 - No error
    • 0x0001 - Receive buffer overflow
    • 0x0002 - Transmission framing error
    • 0x0003 - No data available
    • 0x0004 - Break
    • 0x0005 - Parity fail
  • 0x0003: Transmit data
    Register A contains the lower 16 bits, register B contains the upper 16 bits.
    when configured for less than 4 octets unused bits are ignored.
    Register C is set with error status.

    Transmit Error status codes:

    • 0x0000 - No error
    • 0x0001 - Transmit buffer overflow (data will not be sent)
    • 0x0002 - Line is busy or not connected (data will be queued)
  • 0x0004: Configure interrupts
    Register A defines which interrupts to enable.

    • Bit 0 - Interrupt on Receive enabled: yes (1), no (0)
    • Bit 1 - Interrupt on Transmit done enabled: yes(1), no (0)
    • Bit 2-15 Ignored.

    Register B contains message for Interrupt on Receive.
    Register C contains message for Interrupt on Transmit.

  • 0x0005: Configure interrupt on break
    Register A enables or disables.

    • Bit 0 - Interrupt on break received: enabled - yes (1), no (0)
    • Bit 1-15 Ignored.

    Register B contains message for Interrupt on break.

  • 0x0006: Assert break
    Transmits the break condition.
    Register C is set with error status.

    Transmit Error status codes:

    • 0x0000 - No error
    • 0x0001 - Transmitter is busy

Connector Pinout

Signal Port pin
Tx Data 1
Common 2
Rx Data 3

2014 Meisaka Yukara (CC-BY-SA 4.0)

KaiComm Synchronous Parallel Interface

		 |     \ Kai 
		>|     \\ Communications
		>|     \\\
		>|     ///
		>|    //
		 |   /
Item Value Comment
Vendor code 0xA87C900E (KaiComm)
Device type 0x02 (Communications)
Device Subtype 0x00 (Parallel port)
Device ID 0x10 (SPI)
DCPU Device ID 0xE0239088 (KaiComm SPI 2)
Version 0x0100

The KaiComm SPI is a bi-directional multipurpose data port. Transmissions in either direction are independent of each other and can operate asynchronously of one another. The size of the data primitive is selectable and can be either 2 or 4 octets. The device sends "upper" octets first, if a device set to 2 receives from a device set to 4 the "upper" octets will be received, followed by the "lower" octets.

Commands

  • 0x0000: Query status
    Sets Register A with status, bits will be set/clear as follows:

    • Bit 0 - Line is busy/not-connected (1), or idle (0)
    • Bit 1 - Always reads as 0
    • Bit 2 - Data available (1), or not (0)
    • Bit 3 - Always reads as 0
    • Bit 4 - Transmit buffer is free (1), or full (0)
    • Bit 5-13 Reserved always set to 0
    • Bit 14 - Receive interrupts: enabled (1), disabled (0)
    • Bit 15 - Transmit complete interrupts: enabled (1), disabled (0)
  • 0x0001: Configure port
    Register A selects data size, 16 bit (0) or 32 bit (1), other bits are ignored.

  • 0x0002: Receive data
    Register A is set to the lower 16 bits, register B is set to the upper 16 bits.
    Register C is set with the error status, receive error status is cleared when read.
    When configured for 2 octets, register B to 0.

    Receive Error status codes:

    • 0x0000 - No error
    • 0x0001 - Receive buffer overflow
    • 0x0002 - Receive error
    • 0x0003 - No data available
  • 0x0003: Transmit data
    Register A contains the lower 16 bits, register B contains the upper 16 bits.
    when configured for less than 4 octets unused bits are ignored.
    Register C is set with error status.

    Transmit Error status codes:

    • 0x0000 - No error
    • 0x0001 - Transmit buffer overflow (data will not be sent)
    • 0x0002 - Line is busy or not connected (data will be queued)
  • 0x0004: Configure interrupts
    Register A defines which interrupts to enable.

    • Bit 0 - Interrupt on Receive enabled: yes (1), no (0)
    • Bit 1 - Interrupt on Transmit done enabled: yes(1), no (0)
    • Bit 2-15 Ignored.

    Register B contains message for Interrupt on Receive.
    Register C contains message for Interrupt on Transmit.


2014 Meisaka Yukara (CC-BY-SA 4.0)

KaiComm Synchronous Serial Interface

		 |     \ Kai 
		>|     \\ Communications
		>|     \\\
		>|     ///
		>|    //
		 |   /
Item Value Comment
Vendor code 0xA87C900E (KaiComm)
Device type 0x02 (Communications)
Device Subtype 0x03 (Sync serial)
Device ID 0x20 (SSI)
DCPU Device ID 0xE57D9027 (KaiComm SSI 2)
Version 0x0103

The KaiComm SSI is a bi-directional data port with a 7 wire serial interface. Transmissions in either direction are independent of each other and can operate at different bauds. The size of the data primitive is selectable ranging from 1 to 4 octets. All data are assumed to be sent MSB first.

Commands

  • 0x0000: Query status
    Sets Register A with status, bits will be set/clear as follows:

    • Bit 0 - Line is busy/not-connected (1), or idle (0)
    • Bit 1 - Receiving Active (1), or idle (0)
    • Bit 2 - Data available (1), or not (0)
    • Bit 3 - Transmitting Active (1), or idle (0)
    • Bit 4 - Transmit buffer is free (1), or full (0)
    • Bit 5-13 Reserved always set to 0
    • Bit 14 - Receive interrupts enabled: yes (1), no (0)
    • Bit 15 - Transmit done interrupts enabled: yes(1), no (0)
  • 0x0001: Configure port
    Register A holds the octet size minus 1 in bits 0-1, other bits are ignored.
    Register B holds the baud selection in bits 0-7, giving a range of 0-255.
    The baud is calculated like so: baud = 3125 * (b+1)
    Possible bauds range from 3125 to 800,000 bits per second, in steps of 3125 bits per second.

  • 0x0002: Receive data
    Register A is set to the lower 16 bits, register B is set to the upper 16 bits.
    Register C is set with the error status, receive error status is cleared when read.
    when configured for less than 4 octets unused bits are set to 0.

    Receive Error status codes:

    • 0x0000 - No error
    • 0x0001 - Receive buffer overflow
    • 0x0002 - Transmission was not a multiple of 8 bits
    • 0x0003 - No data available
  • 0x0003: Transmit data
    Register A contains the lower 16 bits, register B contains the upper 16 bits.
    when configured for less than 4 octets unused bits are ignored.
    Register C is set with error status.

    Transmit Error status codes:

    • 0x0000 - No error
    • 0x0001 - Transmit buffer overflow (data will not be sent)
    • 0x0002 - Line is busy or not connected (data will be queued)
  • 0x0004: Configure interrupts
    Register A defines which interrupts to enable.

    • Bit 0 - Interrupt on Receive enabled: yes (1), no (0)
    • Bit 1 - Interrupt on Transmit done enabled: yes(1), no (0)
    • Bit 2-15 Ignored.

    Register B contains message for Interrupt on Receive.
    Register C contains message for Interrupt on Transmit.

Connector Pinout

Signal Port pin
Tx Data 1
Tx Enable 2
Tx Clk 3
Common 4
Common 5
Rx Clock 6
Rx Enable 7
Rx Data 8

2014 Meisaka Yukara (CC-BY-SA 4.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment