The Mikey UART is a pretty standard serial kind of thing. However, since most of the communicating world has managed lo bolix up the definitions and use of the so- called standards of serial communications, I will attempt to explain all of our UARTs functions. Yes, I will leave something out so as to continue to trick earthlings into thinking that I am human.
The UART connects to the REDEYE connector which has pins. There is 1 data pin. This signal is bi-directional serial data. Its idle state is open-collector with a pull- up resistor to +5. There is one ground pin, and one VCC pin.
(A design error causes the power up state of the output to be TTL high, ALL code must set the TXOPEN bit in order to fix this. Its not my fault.)
There is also a signal called NOEXP which indicates the presence of a plug in the REDEYE socket.
Any devices other than RedEye will need to have an intelligent protocol to distinguish themselves from a RedEye type device. See the RedEye specification for protocol details.
The baud rate is generated by TIMER4 according to the equation
CLOCK4 / (TIMER4 + 1) / 8
The minimum number that can be used in TIMER4 is 1, the maximum number is 255. The fastest CLOCK4 is 1MHz, the slowest is 15625 Hz. This gives a baud rate maximum of 62.5 Kbaud and a minimum of 7.63 baud. The settings for the common baud rates are:
The serial data format is the standard 11 bits. We do not offer a choice.
The standard bits are:
The parity (or 9th) bit operates as follows:
If PAREN is '1' and PAREVEN is '0', then the 9th bit
will be the result of an 'odd' parity calculation on the
transmit data byte.
If PAREN is '0', then the 9th bit will be whatever the state of PAREVEN is.
A break of any length can be transmitted by setting the
transmit break bit in the control register. The break will
continue as long as the bit is set.
A 'break' is defined as a start bit, a data value of 0 (same as a permanent start bit), and the absence of a stop bit at the expected time.
The receiver requires that a break lasts 24 bit times before it is recognized. There are many 'standard' break lengths, this is the one we chose.
There are 2 status bits for the transmitter, TXRDY
(transmit buffer ready) and TXEMPTY (transmitter totally
If TXRDY is a '1', then the contents of the transmit holding register have been loaded into the transmit shift register and the holding register is now available to be loaded with the next byte to be transmitted. This bit is also set to '1' after a reset. If TXEMPTY is a '1', then BOTH the transmit holding register and the transmit shift register have been emptied and there are no more bits going out the serial data line.
There are 3 receive errors, parity error (already
explained), framing error, and overrun error. Once received,
these error bits remain set until they are cleared by writing
to the control byte with the reset error bit set. Writing to
the control byte with the reset error bit cleared has no
effect on the errors. Note that the reset error bit is NOT an
error enable bit. Receive errors are always enabled.
Framing error indicates that a non-zero character has been received without the appropriate stop bit.
Overrun error indicates that a character (of any kind or error) has been received and the previously received character has not yet been read from the receive buffer.
Well, we did screw something up after all. Both the
transmit and receive interrupts are 'level' sensitive, rather
than 'edge' sensitive. This means that an interrupt will be
continuously generated as long as it is enabled and its UART
buffer is ready. As a result, the software must disable the
interrupt prior to clearing it.
I left something out. I know what it is but by the next time I revise this spec, I may have forgotten.
I have forgotten.