R32V2020 ACIA (UART)

From Land Boards Wiki
Jump to navigation Jump to search

6850 ACIA (UART) Interface

  • The ACIA interface implements a UART interface
  • UART is similar to 6850 part
  • Used by the USB-Serial Interface

Default Baud Rate

  • 115,200 baud default

Status/Data Address Select

  • PAR bit 0 (PAR0) is the status/data line
  • PAR0 = 0 is status/control register
  • PAR1 = 1 is data register

Status Register Bits

  • d0 = RDRF - Receiver Data Register Full
    • 1 = Receive data is in data register
    • 0 = No data in the receive data register
  • d1 = TDRE - Transmit Data Register Empty
    • 1 = Ready to send data out the serial port
    • 0 = Transmit Data Register is fulled
  • d2 = DCD - Data Carrier Detect
    • 0 = Carrier from the modem is present
    • 1 = No carrier from the modem
  • d3 = CTS - Clear to Send (not connected on most FPGA cards)
    • 0 = Modem is ready for data to be sent
    • 1 = Modem is not ready for data to be sent
  • d4 = FE - Framing Error
    • 1 = Received data had a framing error
    • 0 = Received data did not have a framing error
  • d5 = ROV - Receiver Overrun
    • 1 = One or more characters in the data stream were lost
    • 0 = No overrun occurred
  • d6 = PE - Parity Error
    • 1 = Receive parity error occurred
    • 0 = No receive parity error
  • d7 = IRQ - Interrupt Request
    • 1 = Interrupt present
    • 0 = Interrupt was not present

Control Register

  • d0-d4 - Not used
  • d6..d5 = Transmitter Control
    • 00 = RTS = Low Transmitting Interrupt Disabled (TIE)
    • 01 = RTS = Low Transmitting Enabled (TIE)
    • 10 = RTS = High Transmitting Interrupt Disabled (TIE)
    • 11 = RTS = Low Transmitting Interrupt Disabled and transmitting Break level on Transmit data out (TIE)
  • d7 = Receiver Interrupt Enable
    • 1 = Enable interrupts
    • 0 = Cleared by Receiver Data Register

Hardware Handshake - RTS

  • RTS is asserted when there are 8 characters in the receive buffer
  • RTS is deasserted when there are 2 characters in the receive buffer

Sample Code

Wait for a character from the ACIA and read it

;
; waitGetCharFromUART
; returns character received in r8
; function is blocking until a character is received from the UART
;

waitGetCharFromUART:
	push	PAR
	lix	PAR,0x1800	; UART Status
waitUartRxStat:
	lpl	r8			; Read Status into r8
	andi 	r8,r8,0x1
	bez 	waitUartRxStat
	lix 	PAR,0x1801
	lpl	r8
	pull	PAR
	pull	PC

Put a character to the ACIA

;
; putCharToUART - Put a character to the UART
; passed character in r8 is sent out the UART
; This function is blocking but that's not usually an issue
;	since the Serial-USB interfaces is much faster than the Serial port
;

putCharToUART:
	push	r9
	push	PAR
	lix	PAR,0x1800	; UART Status
waitUartTxStat:
	lpl	r9			; Read Status into r9
	andi 	r9,r9,0x2
	bez 	waitUartTxStat
	lix 	PAR,0x1801
	spl	r8			; echo the character
	pull	PAR
	pull	r9
	pull	PC