Link initialisation is necessary to get both ends of the link fully synchronised and ready to receive data and EOP characters and time-codes. Bit synchronisation is performed by decoding the data-strobe signals to produce the bit clock and data stream. Character synchronisation is performed once during link initialisation. Both ends of the link have to be character synchronised or the link will automatically reset and attempt to resynchronise.

Following reset the SpaceWire interface is held in the reset state until it is instructed to start and attempt to make a connection with the SpaceWire interface at the other end of the link. A connection is made following a handshake that ensures both ends of the link are able to send and receive characters successfully. Each end of the link sends NULLs, waits to receive a NULL, then sends FCTs and waits to receive an FCT. Since a SpaceWire interface is not allowed to send FCTs until it has received a NULL, receipt of one or more NULLs followed by receipt of an FCT means that the other end of the link has received NULLs successfully and that full connection has been achieved. This exchange of Nulls and FCTs is known as the Null/FCT handshake.

Link initialisation is handled by a state machine in each of the SpaceWire interfaces at either end of the SpaceWire link. The basic state machine is illustrated in Figure 37. This diagram is simplified to highlight the link initialisation procedure.

SpaceWire Interface State Machine

Figure 37 SpaceWire Interface State Machine

On reset the SpaceWire interface state machine enters the ErrorReset state where both the transmitter and receiver in the SpaceWire interface are reset. The state machine remains in this state for 6.4 µs to ensure that the interface is properly reset, and then moves to the ErrorWait state where it keeps the transmitter reset but enables the receiver. The reason for this will become clear later. After waiting 12.8 µs in the ErrorWait state the SpaceWire interface moves to the Ready state, where it waits for a command to start the link. When the SpaceWire interface is instructed to start the link (by the local application logic using the SpaceWire interface) it moves to the Started state where it begins to send out Nulls. If the other end (End B) of the link is also sending Nulls then End A will receive the Null (gotNull) and move to the Connecting state. In the Connecting state the transmitter is allowed to send Nulls and FCTs. It will send out an initial burst of FCTs (see flow control section later on) as part of the initialisation handshake. The other end of the link (End B) will have received Nulls and with therefore also be in the Connecting state sending out FCTs and Nulls. The FCTs will be received at End A and the state machine will move to the Run state. In the Run state both ends of the link have made a connection (or are just about to) and the SpaceWire interface is ready to start transferring data. The link will now remain in the Run state until one of the SpaceWire interfaces are disabled by the local application logic asserting the Link Disabled control bit.

If the other end of the link (End B) is not ready and does not send Nulls and FCTs when expected, End A will wait in the Started or Connecting state for 12.8 µs and then give up waiting, move back to the ErrorReset state and try again to make a connection. This is illustrated in Figure 38.

SpaceWire Interface State Machine moves to ErrorReset when no Nulls or FCTs received

Figure 38 SpaceWire Interface State Machine moves to ErrorReset when no Nulls or FCTs received

To avoid having to set both the Start Link bit in both ends of the link to start a link, an Auto-Start mode is included in the SpaceWire state-machine. A SpaceWire interface in the Auto-Start mode will automatically start up when it receives a bit (gotBit) on its receiver. This functionality is achieved by adding an extra condition on the transition between the Ready and Started states. This addition is illustrated in Figure 39.

SpaceWire Interface State Machine with Auto-Start

Figure 39 SpaceWire Interface State Machine with Auto-Start

One end of the link (End B) has its AutoStart control bit set and has reset, moved through ErrorReset and ErrorWait, and is now sitting in the Ready state. The other end of the link (End A) the link has also reset and is waiting in the Ready state. When End A gets the command to Start Link, it moves to the Started state and begins sending Nulls. End B receives the start of the Null and gotBit is asserted causing it to also move to the Started state. The Null/FCT handshake now takes place with both ends moving through Started and Connecting to Run.

When one end of the link is trying to make a connection, i.e. Start Link is asserted, and the other end of the link (End B) is not ready to make a connection for whatever reason, End A will send Nulls for 12.8 µs and then go silent for 19.2 µs (6.4 µs + 12.8 µs) repeatedly. Observing bursts of Nulls from one end of a link while nothing is being sent in the other direction is a clear indication that one end is trying to send and the other end is not responding. This could be because that end of the link does not have its Auto-Start control bit asserted, or alternatively its Disable bit is asserted.

The link initialisation sequence is shown in Figure 40. The sequence of characters under A->B Event is for one direction of the link (characters being sent from End A to End B) while that under B->A Event is the other direction.

  1. The link is disconnected causing both ends of the link to reset, moving through the ErrorReset and ErrorWait states to the Ready state.
  2. End B of the link has Start Link asserted and so moves to the Started state and begins sending Nulls, which are received at End A initially causing GOT-BIT to be asserted and then a series of Nulls to be received.
  3. End A has AutoStart asserted, so as soon as it has received the first bit (GOT-BIT) it moves to the
  4. Started state and sends at least one Null, which is received at End B.
  5. When End A receives a Null and after it has sent at least one Null in response it moves to the Connecting state and is able to send one or more FCTs.
  6. The Null from End A is received at End B, so End B moves to the Connecting state, and is able to send one or more FCTs.
  7. The FCT from End A is received at End B, so End B moves to the Run state and switches to the required link operating speed (note the change in character timing).
  8. The FCT sent from End B is received at End A, so End A moves to the Run state and switches to the required link operating speed. The link is now running in both directions.

Link Initialisation

Figure 40 Link Initialisation

Note that during initialisation at least one Null must be sent before FCTs are sent, although this is not clearly stated in the SpaceWire standard.

If there is noise on the input to a receiver, possibly caused by the cable being disconnected, the random noise might occasionally correspond to a Null followed by an FCT. If the receiver is in auto-start mode, this will cause the receiver to start up and begin sending Nulls and FCTs. Eventually the noise will cause a parity error and a disconnect. If a SpaceWire interface is observed to periodically send short bursts of characters, it is likely that the cause is noise on its receiver inputs. To some extent unwanted noise can be overcome using biasing resistors on the receiver inputs.