GR740-UM-DS, Nov 2017, Version 1.7
153
www.cobham.com/gaisler
GR740
the value of the outstanding credit counter is less than or equal to 48 and as long as there are at least 8
more empty FIFO entries available.
N-Chars are sent in the run-state when they are available from the transmit FIFO and credits are avail-
able. NULLs are sent when no other character transmission is requested or when the FSM is in a state
where no other transmission is allowed.
The credit counter (incoming credits) is automatically increased when FCTs are received and
decreased when N-Chars are transmitted. The credit counter for a SpaceWire port can be read from
the corresponding RTR.CREDCNT register.
13.3.1.1 Transmitter
The state of the FSM, the credit counters, a possible request to send a time-code / distributed interrupt
code, and requests from the transmit FIFO are used to decide which character is transmitted next. The
type of character and the character itself (for N-Chars and time-codes / distributed interrupt codes) are
presented to the low-level transmitter, which runs on the internal SpaceWire clock. For information on
how to change the transmission rate see Section 13.3.2.
The state of the FSM, credit counters, requests from the time-interface and requests from the transmit-
ter FIFO are used to decide the next character to be transmitted. The type of character and the charac-
ter itself (for N-Chars and Time-codes) to be transmitted are presented to the low-level transmitter
which is located in a separate clock-domain.
13.3.1.2 Receiver
The receiver detects connections from other nodes and receives characters as a bit stream recovered
from the data and strobe signals by the PHY module, which presents it as a data and data-valid signal.
The receiver is activated as soon as the link-interface leaves the error reset state. Then, after a NULL
is received it can start receiving any other characters. It detects parity, escape and credit errors, which
causes the link interface to enter the error-reset state.
Received L-Chars are handled automatically by the link-interface, whereas all N-Chars are stored in
the receive FIFO.
The max receive rate is 1.5 times the frequency of the internal SpaceWire clock. The system clock
must be higher or equal to the receive bit rate divided by eight. For example, if the receive bit rate is
100 Mbit/s then the system clock must be at least 12.5 MHz.
13.3.2 Setting link-rate
The initialization divisor register (RTR.IDIV) determines the link-rate during initialization (all states
up to and including the connecting-state) for all SpaceWire ports. The register is also used to calculate
the link interface FSM timeouts for all SpaceWire ports (6.4 us and 12.8 us, as defined in the Space-
Wire standard [SPW]). The RTR.IDIV register should always be set so that a 10 Mbit/s link-rate is
achieved during initialization. Then, the timeout values are also calculated correctly.
To achieve a 10 Mbit/s link-rate, the RTR.IDIV register should be set as follows:
RTR.IDIV = (<frequency in MHz of internal SpaceWire clock> / 10) - 1
The link-rate in run-state can be controlled individually per SpaceWire port with the run-state divisor
located in each port’s control register (RTR.PCTRL.RD field). The link-rate in run-state is calculated
as follows:
<link-rate in Mbits/s> = <frequency in MHz of internal SpaceWire clock> / (RTR.PCTRL.RD+1)
The value in RTR.PCTRL.RD only affects the link-rate in run-state and does not affect the 6.4 us or
12.8 us timeouts values.