SSI
Serial Synchronous Interface
Overview
The SSI is a bi-directional communications interface between the DPU and ICU
which is carried on the DEM backplane.
The definition of the SSI is in XMM-OM/MSSL/SP/0007 "Electrical Interfaces Specification".
Hardware
Both the ICU and the DPU can send and receive data on this interface but the
ICU is the master.
The interface consists of:
- SSI_CLK: a continuous clock signal generated by the ICU
- SSI_ENV_TX: active high when data present
- SSI_DATA_TX: 16-bit data
- SSI_ENV_RX: active high when data present
- SSI_DATA_RX: 16-bit data
- Signal return
Commands are sent from the ICU to the DPU.
Science data is passed from the DPU to the ICU when demanded by the ICU.
Alerts are sent (unrequested) by the DPU to the ICU.
There is no direct feedback as part of the protocol and there is no
error correction nor checksums.
The interface can be thought of as the same irrespective of direction.
The SSI clock frequency is 125 kHz producing a period of 8 us (1 bit-period).
The SSI 16-bit data words are separated by at least one bit-period and at most
the SSI block gap (defined in software).
The SSI data blocks are separated by at least the SSI block gap (defined in software).
Transmitting data
The words that constitute the block are sent not more than the SSI block gap
apart and, when finished, the software must wait for at least the SSI block gap
before sending more data. The receiving software must wait for a little longer
than the transmitting software's block gap to be sure to see the gap. A
factor of two is sufficient.
Receiving data
The data being received must be read suitably fast and if the time between any
two words is greater than the SSI block gap, the gap will be considered a block
gap. All blocks contain a length as their second word so errors caused by an
accidentally lengthened word gap may be identified (see
data format).
SSI block gaps
Because the SSI block gaps are defined and used only in software they can be
set to different values in different versions of the code and they can be
different depending on the direction of the data (ICU->DPU or
DPU->ICU).
SSI block gaps as defined by the ICU software
| EPROM code | Uploadable code |
---|
ICU -> DPU | >4 ms | >4 ms |
---|
DPU -> ICU | 6 ms | 4 ms |
---|
SSI block gaps as defined by the DPU software
| EPROM code | Uploadable code |
---|
ICU -> DPU | 2 +/- 1 ms | 2 +/- 1 ms |
---|
DPU -> ICU | 15 +/- 1 ms | 15 +/- 1 ms |
---|
The ICU's SSI hardware will give an interrupt 10 (used by the ICU's software) at
the end of the first word of each block. The ICU software must then read this
first word before the end of the second word. The time for this is 16
bit-periods for the word and a minimum of 1 bit-period for the word gap. So
the software must be able to respond to the interrupt and read the word in 136
us.
An overflow (OVF) bit in the hardware SSI status word is made active (low) if
a data word is not read before the arrival of another.
SSI errors
If the DPU resets whilst transmitting the first part of a word, that
word will be truncated and the envelope will be truncated resulting in an
earlier than expected "data receive" flag which will not be able to be
processed in time and cause an overflow on the ICU.
If the DPU resets whilst transmitting the last part of a word, that word and
the envelope will be truncated but not so much that the ICU's software cannot
keep up as in the previous case. This will result in a corrupt last word and,
except in the case of a reset during the last word, a truncated SSI block.
This will be detected and handled properly by the ICU's software.
Data format
The data format is described in XMM-OM
ICU-DPU Protocol Definitions
Each SSI data block consists of
- 16-bit type - the block type
- 16-bit length - the number of 16-bit words following this word (i.e. total
length - 2)
- the rest of the data
The data types are grouped into categories as follows:
- Regular DPU to ICU data blocks
- Regular science data.
- DPU priority data
- These contain science data that is sent out as soon as it is available
rather than at the end of an exposure.
- DPU RAM dumps
- RAM dumps.
- DPU to ICU alerts
- Alerts from the DPU to signify something is has happened, is ready or
an error has occured.
- ICU to DPU commands
- Commands to the DPU.
Further detail on the ICU software
The first, fast part of the SSI interrupt handler is written in assembler (the
first word of the SSI block is read) and the rest in written in Ada (the
reading of the rest of the words in the block and the timeout.)
SSI status register
D_TX | 2**4 |
DATA_FULL | 2**3 |
OVF | 2**2 |
D_RX | 2**1 |
INT | 2**0 |
Sequence of actions
- SSI INTERRUPT happens
- Read first word (from i/o address f241h) into input software fifo in less than 136 us after the interrupt
- Remember location where next word will be stored for a later check
- Start stopwatch
- Set interrupt mask to only allow RBI interrupts
- Enable interrupts but don't get interrupted for too long!
- loop
- read SSI status (i/o address f240h)
- if the DATA_FULL bit (2**3) is set and there is data to output
- write a data word to output i/o address (7241h)
- if input software fifo is full
- if D_RX bit is reset
- read input word (i/o address f241h) into input software fifo
- re-start stopwatch because there is still data on input
- else
- if stopwatch is after 4 ms
- read ssi status word (i/o address f240h)
- if OVF bit (2**2) is 0
- clear overflow (write fffb (hex) to status register i/o address 7240h)
- read a word (from i/o address f241h) and dispose of it
- end loop
-
- read the second word (length) of this SSI block from the software input buffer
- if it is greater then 1027
- if no of words read doesn't equal the value of the second word (see above) minus 2
- read ssi status word (i/o address f240h)
- if OVF bit (2**2) is 0
- clear overflow (write fffb (hex) to status register i/o address 7240h)
- read a word (from i/o address f241h) and dispose of it
- clear SSI interrupt by writing fffe (hex) to the SSI status i/o address 7240h
To Reset
- reset software input and output fifos and error value
- write OVR_WR fffb (hex) to status address 7240 (hex)
- write INT_WR fffe (hex) to status address 7240 (hex)
SSI error codes
- error = C
- The SSI input circular buffer has filled so fast or not been emptied fast
enough and incoming data is about to overwrite outgoing data.
- error = 2
- The word count is too large while receiving data in the block. The number
of words has exceeded that indicated by the second "block length" word or has
exceeded the maximum allowed (1029).
- error = 8
- An overflow (OVF) has been indicated by the ICU's SSI hardware.
- error = 7
- An overflow occured at the end of the block.
- error = 11
- The second word of the block indicated a length which exceeds the maximum
allowed (1029).
- error = 1
- The length indicated by the second word is inconsistent with the real
length of the block.
- error = 89
- An overflow was found during SSI_DRIVER.PUT
- error = 9
- The length found in SSI_DRIVER.PUT exceeded the maximum allowed (1029).
- error = b
- The output block length in SSI_DRIVER.PUT exceeded the maximum allowed
(1029).
Further detail on the DPU software
The DSP converts a serial SSI word to parallel word. Each received word
generates an interrupt. The SSI ISR pushes the word into a circular buffer.
The 1ms ISR checks the COLLECTING_A_COMMAND bit. If it is zero (cleared), it
decrementes the delay count (stopwatch), else the delaycount (stopwatch) is
reset. When the delaycount reaches 0, it is assumed a valid comand has been
received (a full block has been received), and the command interpreter is
called. The command interpreter checks for integrity of command: it checks the
block has:
- a valid command ID
- a legal length for command ID
It does not count the number of words received and compare this with the length
stored as the second word.
The command interpreter is written in C and the rest of the SSI code in
assembler.
On a hardware error the code will:
- Reset fill pointer.
- Send out bad block.