UART: Difference between revisions

From WSdev Wiki
Jump to navigationJump to search
m (forgot start bits in byte rates)
m (Register formatting.)
Line 34: Line 34:
---- ----
---- ----
ebO. .tor
ebO. .tor
|||  |||
|||  ||+- 1 if the receive buffer contains a byte
|||  ||+- 1 if the receive buffer contains a byte
|||  |+-- 1 on overrun (receive buffer overflow)
|||  |+-- 1 on overrun (receive buffer overflow)

Revision as of 10:51, 22 August 2023

The WonderSwan's EXT port features an UART operating with the following configuration:

  • 9,600 or 38,400 bps (bauds per second),
  • 8N1 (8 data bits followed by 1 stop bit, no parity).

This allows for an effective maximum transfer speed of 960 or 3840 bytes per second, respectively.

The hardware also features a one-byte transmit and receive buffer, which allows for a slight delay in code when handling data to/from the console.

Interrupts

The UART features two interrupts:

  • UART Send Ready - constantly active while the transmit buffer is empty (Serial Control bit 2),
  • UART Receive Ready - constantly active while the receive buffer contains a byte (Serial Control bit 0).

I/O ports

Serial Data

7  bit  0
---- ----
dddd dddd
|||| ||||
++++-++++- Read a byte from the transmit buffer;
           Write a byte into the receive buffer.

Serial Control

7  bit  0
---- ----
ebO. .tor
|||   |||
|||   ||+- 1 if the receive buffer contains a byte
|||   |+-- 1 on overrun (receive buffer overflow)
|||   +--- 1 if the transmit buffer is empty (can transmit another byte)
||+------- Write 1 to reset overrun
|+-------- UART speed: 0 = 9600 bps, 1 = 38400 bps
+--------- UART enable: 0 = off, 1 = on