Synchronous Serial Interface (SSI0 and SSI1) : Section 8
Synchronous Serial Interface (SSI0 and SSI1) : Section 8
SECTION 8
Freescale Semiconductor, Inc...
MOTOROLA 8-1
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
SECTION CONTENTS
8.1 INTRODUCTION
The DSP56156 contains two identical Synchronous Serial Interfaces (SSI’s) named SSI0
and SSI1. This section describes both. In cases where the text or a figure applies equally
to both SSI’s, they will be referred to as the SSI. In cases where the information differs
between the SSI’s such as when pin numbers are mentioned, control addresses are men-
tioned or the operation affects only one of the two SSI’s like a personal reset, the SSI will
be referred to as SSIx meaning SSI0 or SSI1 – whichever applies.
The SSI is a full duplex serial port which allows the DSP to communicate with a variety of
serial devices including one or more industry standard codecs, other DSPs, or micropro-
Freescale Semiconductor, Inc...
The transmit and receive sections of this interface may be synchronous or asynchronous;
that is, the transmitter and the receiver may use common clock and synchronization sig-
nals or they may have independent frame sync signals but the same bit clock. The SYN
bit in SSI Control Register B selects synchronous or asynchronous operation. Since the
SSI is designed to operate either synchronously or asynchronously, separate receive and
transmit interrupts are provided.
Normal or network protocol may also be selected. For normal protocol the SSI functions
with one data word of I/O per frame. For network protocol, 2 to 32 data words of I/O may
be used per frame. Network mode is used in Time Division Multiplexed (TDM) networks
of codecs or DSPs. These distinctions result in the basic operating modes which allow the
SSI to communicate with a wide variety of devices.
• Transmit data STDx (PC0 for SSI0 and PC5 for SSI1)
• Receive data SRDx (PC1 for SSI0 and PC6 for SSI1)
• Serial clock SCKx (PC2 for SSI0 and PC7 for SSI1)
• Serial Control Pin 1 SC1x (PC3 for SSI0 and PC8 for SSI1)
• Serial Control Pin 0 SC0x (PC4 for SSI0 and PC9 for SSI1)
Figure 8-1 through Figure 8-5 show the main configurations and the following paragraphs
describe the uses of these pins for each of the SSIx operating modes.These figures do
not represent all possible configurations, e.g., SCKx and FS don’t have to be in the same
direction. Note that the first pin name in these figures apply to SSI0 and the second
applies to SSI1 i.e., PC2/PC7 means PC2 for SSI0 and PC7 for SSI1.
PC0/PC5 STDx
any
PC1/PC6 SRDx DSP
DSP56156 PC2/PC7 SCKx or
PC3/PC8–SC1x CODEC
PC4/PC9–SC0x FS
PC0/PC5 STDx
any
PC1/PC6 SRDx DSP
DSP56156 PC2/PC7 SCKx or
PC3/PC8–SC1x RFS CODEC
PC4/PC9–SC0x TFS
RDD
DSP56156 TDD
TDC/RDC CODEC
PC0/PC5 STDx 1
PC1/PC6 SRDx TDE/RDE
PC2/PC7 SCKx
PC3/PC8–SC1x F1
PC4/PC9–SC0x F0
RDD
TDD
Freescale Semiconductor, Inc...
TDC/RDC CODEC
0
TDE/RDE
Figure 8-5 SSIx Internal Clock, Synchronous Operation Dual Codec Interface
Figure 8-6 shows the internal clock path connections in block diagram form. The serial bit
clock can be internal or external depending on SCKD bit in the control register.
PSR PM0-PM7
Prescale Divider
Fosc /2 /1 or /8 /1 to /256
/2
RX Shift Rx Data
Register
TX Shift Tx Data
Register
Table 8-4 shows frame sync generation. When internally generated, both receive and
transmit frame sync are generated from the word clock and are defined by the frame rate
divider (DC4-DC0) bit and the word length (WL1-WL0) bits of CRA.
Figure 8-7 shows the functions of the two pins SC1x and SC0x according to the setting of
CRB flags.
word is transmitted.
SYN=0
RX
control
logic RX frame
sync in
F1 in
SC1x
DC0-DC4
word SYN&FSD0=1
clock Frame Frame FSL, FSI F1 out FSD1
rate
Freescale Semiconductor, Inc...
Sync
divider Type FSD0 | FSD1
F0 out
SYN&FSD0=1 SC0x
TX frame
sync out
TX frame F0 in
TX sync in Where & is the logical “and” operator,
control Where | is the logical “or” operator
logic
(FSD1&SYN&FSD0) = 1
DSP Reset This reset is generated by either the DSP hardware reset (generated by
asserting the RESET pin) or software reset (generated by executing the
RESET instruction). The DSP reset clears the Port Control Register bits,
which configures all I/O pins as general purpose input. The SSI will re-
main in the reset state while all SSI pins are programmed as general pur-
pose I/O (CC0-CC4/CC5-CC9 cleared) and will become active only
when at least one of the SSIx I/O pins is programmed as NOT general
purpose I/O. All status and control bits in the SSIx are affected as de-
scribed below.
SSIx Reset The SSIx personal reset is generated when CC0-CC4/CC5-CC9 bits are
cleared. This returns the SSIx pins to general purpose I/O pins. The SSIx
status bits are preset to the same state produced by the DSP reset; how-
ever, the SSIx control bits are unaffected. The SSIx personal reset is use-
Freescale Semiconductor, Inc...
ful for selective reset of the SSIx interface without changing the present
SSIx control bits setup and without affecting the other peripherals.
STOP Reset The STOP reset is caused by executing the STOP instruction. During the
STOP state no clocks are active in the chip. The SSI status bits are preset
to the same state produced by the DSP reset. The SSI control bits are un-
affected. The SSI pins remain defined as SSIx pins. The STOP reset con-
dition is like the personal reset condition except that the SSI pins do not
revert to general purpose I/O pins.
Note: The SSIx clock must go low for at least four complete periods to ensure proper SSIx
reset.
The data to be transmitted occupies the most significant portion of the shift register. The
unused portion of the register is ignored. Data is shifted out of this register with the most
significant bit (MSB) first when the SHFD bit of the control register B is cleared. If the
Freescale Semiconductor, Inc...
SHFD bit is set, the LSB is output first. The Transmit Shift Register cannot be directly ac-
cessed by the programmer.
15 8 7 0 READ-ONLY
SERIAL RECEIVE
HIGH BYTE LOW BYTE REGISTER
(SSI0 Address X:$FFF1
SSI1 Address X:$FFF9)
15 8 7 0 SERIAL TRANSMIT
SHIFT REGISTER
HIGH BYTE LOW BYTE (Cannot be accessed
directly)
15 8 7 0 WRITE-ONLY
SERIAL TRANSMIT
HIGH BYTE LOW BYTE REGISTER
(SSI0 Address X:$FFF1
SSI1 Address X:$FFF9)
15 14 13 12 11 10 9 8
READ-WRITE
Freescale Semiconductor, Inc...
7 6 5 4 3 2 1 0 READ-ONLY
SSIx STATUS
RDF TDE ROE TUE RFS TFS IF1 IF0 REGISTER (SR)
SSI0 ADDRESS $FFF0
SSI1 ADDRESS $FFF8
15 8 7 0 WRITE-ONLY
SSIx TIME SLOT
Dummy Register, No Content Is Actually Written REGISTER (TSR)
SSI0 ADDRESS $FFF0
SSI1 ADDRESS $FFF8
SSIx SLOT MASK REGISTERS
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 RSMBx
SSI0: $FFF3
RS RS RS RS RS RS RS RS RS RS RS RS RS RS RS RS
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 SSI1: $FFFB
READ-WRITE
SSIx RECEIVE
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 RSMAx SLOT MASK
SSI0: $FFF2 REGISTERS
RS RS RS RS RS RS RS RS RS RS RS RS RS RS RS RS
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 SSI1: $FFFA
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 TSMBx
SSI0: $FFF5
TS TS TS TS TS TS TS TS TS TS TS TS TS TS TS TS
SSI1: $FFFD
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 READ-WRITE
SSIx TRANSMIT
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 TSMAx SLOT MASK
SSI0: $FFF4 REGISTERS
TS TS TS TS TS TS TS TS TS TS TS TS TS TS TS TS
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 SSI1: $FFFC
Note: 1. When FSL=1, if the data is written into TX just between the frame sync and the
Freescale Semiconductor, Inc...
transmission of the first bit, the data will not be transmitted. TDE and TUE will
be set when the first bit is transmitted.
2. When the A/MU law is enabled, the data to be transmitted during the first en-
abled slot of a frame should be written to the TX register before the second to
last bit of the last slot of the previous frame. Otherwise a transmit underrun error
occurs.
clears all CRA bits. SSIx reset and STOP reset do not affect the CRA bits. CRA is memory
mapped to X:$FFD0 for SSI0 and X:$FFD8 for SSI1. The CRA control bits are described
in the following paragraphs.
15 14 13 12 11 10 9 8
The bit clock on the SSI can be calculated from the Fosc value using the following equa-
tion:
In normal mode, this ratio determines the word transfer rate. The divide ratio may range
from 1 to 32 (DC = 00000 to 11111) for normal mode and 2 to 32 (DC = 00001 to 11111)
for network mode.
Table 8-2 SSI Bit Clock as a Function of Fosc and PM0-PM7 (PSR=0)
Fosc Max bit PM0-PM7 Values for different SCK
Clock
(MHz) (MHz) 2.048MHz 1.544MHz 1.536MHz 128KHz 64KHz
Examples:
A divide ratio of one (DC=00000) in network mode is a special case. In normal mode, a
divide ratio of one (DC=00000) provides continuous periodic data word transfer. Note that
a 1-bit sync (FSL=1) must be used in this case.
Note: The frame divider control bits have to be written before the first three serial clock
cycles of the last slot of a frame in order to become active at the beginning of the
next frame.
These bits control the Word Length Divider shown in the SSI Clock Generator. The WL
control bits also controls the frame sync pulse length when FSL=0.
Note: When the A/MU law is enabled, the data to be transmitted should be written to the
Freescale Semiconductor, Inc...
TX register before the second to last clock of the previous slot. Otherwise a trans-
mit underrun error occurs.
0 0 8
0 1 8 with log exp/comp
1 0 12
1 1 16
15 14 13 12 11 10 9 8
8.12.2 Transmit and Receive Frame Sync Directions - (FSD0, FSD1) Bit 2,4
The Frame Sync Direction bits (FSD1, FSD0) determine the direction of SC1x and SC0x
and whether the frame sync or the flags are used. If FSD0=0 and FSD1=0, then both pins
are inputs. If FSD0=1 and FSD1=0, then SC1x is an input and SC0x is an output. If
FSD1=1, then both pins are outputs. SC0x and SC1x are both used as frame syncs (SC0x
only if SYN=1) and SSISR flag inputs. Output pins reflect either the frame sync (FSD0=0
and FSD1=1) or the flags (FSD0=1, FSD1=1, & SYN = 1). Table 8-4 shows the functions
of the two pins SC1x and SC0x according to the definition of CRB flags SYN, FSD1 and
FSD0.
RFS: Receive Frame Sync; TFS: Transmit Frame Sync; FS: Frame Sync
If A/Mu=0, the A law is selected and if A/MU=1, the µ law is selected. Companding/Ex-
panding hardware follows CCITT recommendation G.711.
Normal transmit enable sequence for transmit is to write data to TX or to TSR before set-
ting TE. Normal transmit disable sequence is to clear TE and TIE after TDE=1.
In the network mode, the operation of clearing TE and setting it again will disable the
transmitter after completion of transmission of a current data word until the beginning of
a new data frame period. During the disabled time period, the STD pin will remain in
three-state.
Note: TE does not inhibit TDE or transmitter interrupts. TE does not affect the generation
of frame sync.
In network mode, the operation of clearing RE and setting it again will disable the receiver
after reception of the current data word until the beginning of the new data frame.
Note: RE does not inhibit RDF or receiver interrupts. RE does not affect the generation
of a frame sync.
There are two transmit data interrupts which have separate interrupt vectors:
1. Transmit data with exception status - This interrupt is generated on the follow-
ing condition:
Freescale Semiconductor, Inc...
There are two receive data interrupts which have separate interrupt vectors:
1. Receive Data with exception status - This interrupt is generated on the following
condition:
READ-ONLY
7 6 5 4 3 2 1 0 SSIx STATUS
REGISTER (SR)
RDF TDE ROE TUE RFS TFS IF1 IF0 SSI0 ADDRESS $FFF0
SSI1 ADDRESS $FFF8
Note: All the flags in the SSISR are updated one SSI clock after the beginning of a time
slot.
The SSI always latches data present on the SC1x and SC0x pins during reception of the
first received bit. IF0 and IF1 are always updated with this data when the receive shift reg-
ister is transferred into the receive data register. Hardware, software, SSI individual, and
STOP resets will clear IF0 and IF1.
In network mode, TFS is set during transmission of the first active slot of the frame. It will
then be cleared when starting transmission of the next active slot of the frame. If the first
time slot of the frame is not enabled, this bit will be set on the leading edge of the first ac-
tive slot.
Note: In normal mode or in network mode with only one enabled slot, TFS will always
read as a one when transmitting data because there is only one time slot per frame.
TFS is cleared by DSP, SSIx or STOP reset and is not affected by TE.
In network mode, if the first slot is disabled, this flag will be set after reception in the first
active slot and will only be cleared after receiving the next enabled time slot into the RX
register.
Note: In normal mode or network mode with one enabled slot, RFS will always be set
when reading data because data is received only in the first active time slot.
RFS is cleared by DSP, SSIx or STOP reset and is not affected by RE.
TUE does not cause any interrupts; however, TUE does cause a change in the interrupt
vector used for transmit interrupts so that a different interrupt handler may be used for a
transmit underrun condition. If a transmit interrupt occurs with TUE set, the Transmit Data
With Exception Status interrupt will be generated and, if a transmit interrupt occurs with
TUE clear, the Transmit Data Without Errors interrupt will be generated.
TUE is cleared by the DSP, SSIx, or STOP reset. TUE is cleared by reading the SSISR
with TUE set followed by writing TX or TSR.
ROE is cleared by the DSP, SSIx, or STOP reset, and is cleared by reading the SSISR
with ROE set followed by reading the RX. Clearing RE does not affect ROE.
TDE is cleared when the DSP writes to the Transmit Data Register or when the DSP
writes to the TSR to disable transmission of the next time slot. If TIE is set, a SSI Transmit
Data interrupt request will be issued when TDE is set. The interrupt vector will depend on
the state of the Transmitter Underrun TUE bit. TDE is set by the DSP, SSIx, and STOP
reset.
RDF is cleared when the DSP reads the Receive Data Register. If RIE is set, a DSP re-
ceive data interrupt request will be issued when RDF is set. The interrupt vector request
will depend on the state of the Receiver Overrun ROE bit. RDF is cleared by the DSP,
SSIx, and STOP reset.
When bit number N in TSMx is cleared, the transmit data pin STD is three-stated during
transmit time slot number N. The data is still transferred from the Transmit Data Register
to the transmit shift register and the Transmitter Data Empty flag (TDE) is set. Also the
Transmitter Underrun Error flag is not set. This means that during a disabled slot, no
Transmitter Empty interrupt is generated (TDE=0). The DSP is interrupted by activity in
enabled slots only. Data that is written to the Transmit Data Register when servicing this
request is transmitted in the next enabled transmit time slot.
When bit number N in TSMx is set, the transmit sequence is as usual: data is transferred
from TX to the shift register, it is transmitted during transmit time slot number N, and the
TDE flag is set.
The 32-bit data written into TSMx is transferred to the Transmit Slot Mask Shift Register
(TSMS) during the last slot of the last frame. Writing to TSMx will not affect the state of
the active (enabled) transmit slots during the current transmit frame but only that of the
next frame.
Using the slot mask in TSMx does not conflict with using TSR. Even if a slot is enabled in
TSMx, the user may choose to write to TSR instead of writing to the transmit data register
TX. This will cause the transmit data pin to be three-stated during the next slot.
After DSP reset, the Transmit Slot Mask Register is preset to $FFFFFFFF, which means
that all 32 possible slots are enabled for data transmission.
Freescale Semiconductor, Inc...
Note: The Transmit Slot Mask Registers have to be written before the last three serial
clock cycles of a frame in order to become active at the beginning of the next frame.
When bit number N in RSMx is cleared, the data from the receive data pin is shifted into
the Receive Shift Register during slot number N. Data is not transferred from the Receive
Shift Register to the Receive Data Register and the Receiver Full flag (RDF) is not set.
Also the Receiver Overrun Error flag is not set. This means that during a disabled slot, no
Receiver Full interrupt is generated. The DSP is interrupted (RDF=0). The DSP is inter-
rupted by activity in enabled slots only.
When bit number N in RSMx is set, the receive sequence is as usual: data which is shifted
into the receive shift register is transferred to the Receive Data register and the RDF flag
is set.
The 32-bit mask which is written into RSMx, is transferred to the Receive Slot Mask Shift
Register (RSMS) during the last slot of the last frame. Writing to RSMx will not affect the
state of the active (enabled) receive slots during the current receive frame, but only that
of the next frame.
After DSP reset, the Receive Slot Mask Register is preset to $FFFFFFFF, which means
that all 32 possible slots are enabled for data reception.
Note: The Receive Slot Mask Registers have to be written before the last three serial
clock cycles of a frame in order to become active at the beginning of the next frame.
Freescale Semiconductor, Inc...
When the above conditions occur in normal mode, the next data word will be transferred
from TX to the Transmit shift register, the TDE flag will be set (transmitter empty), and the
transmit interrupt will occur if TIE=1 (Transmit interrupt is enabled). The new data word
will be transmitted immediately.
The transmit data output (STD) is three-stated except during the data transmission period.
The optional frame sync output and clock outputs are not three-stated even if both receiv-
er and transmitter are disabled.
The program must write another word to TX before the next frame sync is received or TUE
will be set and a Transmitter Underrun Error will be generated.
The DSP program has to read the data from RX before a new data word is transferred
from the Receive Shift Register, otherwise the Receiver Overrun error will be set (ROE).
Receive Shift Register and transferred to the RX when the corresponding time slot is en-
abled. The DSP will read the receive data register and either use or discard the data ac-
cording to the time slot register and mask.
The frame sync signal indicates the beginning of a new data frame. Each data frame is
divided into time slots and transmission or reception can occur in each time slot (rather
than in just the frame sync time slot as in the normal mode). The frame rate dividers, con-
trolled by DC4, DC3, DC2, DC1, and DC0 control the number of time slots per frame from
2 to 32.
The transmit portion of the SSI is enabled when TE=1. However, when TE is sets the
transmitter will be enabled only after detection of a new data frame sync. This allows the
SSI to synchronize to the network timing.
Normal start up sequence for transmission in the first time slot is to write the data to be
transmitted to the Transmit Register (TX), this clears the TDE flag. Then set TE and TIE
to enable the transmitter on the next frame sync and to enable transmit interrupts.
Alternatively, the DSP programmer may decide not to transmit in the first time slot by writ-
ing (any data) to the Time Slot Register (TSR). This will clear the TDE flag just as if data
were going to be transmitted, but the STD pin will remain in three-state for the first time
slot. The programmer then sets TE and TIE as above.
When the frame sync is detected (or generated), the first enabled data word will be trans-
ferred from TX to the Transmit Shift Register and will be shifted out (transmitted). TX now
being empty will cause TDE to be set which, if TIE is set, will cause a transmitter interrupt.
Software can (1) poll TDE, or (2) use interrupts to reload the TX register with new data for
the next time slot, or (3) write to the TSR to prevent transmitting in the next active time
slot. The transmit and receive slot mask registers control which time slots will be used.
Failing to reload TX (or writing to TSR) before the next active time slot will cause a trans-
mitter underrun and the TUE error bit will be set.
Clearing TE and setting it again will disable the transmitter after completion of transmis-
sion of the current data word until the beginning of the next frame sync period. During that
time the STD pin will be three-stated. TE should be cleared after TDE gets set to ensure
that all pending data is transmitted.
To summarize, the network mode transmitter generates interrupts every enabled time
slot (TE=1, TIE=1) and requires the DSP program to respond to each enabled time slot.
These responses may be:
1. Write TX data register with data for transmission in the next time slot
2. Write the time slot register to disable transmission in the next time slot
3. Do nothing - transmit underrun will occur at the beginning of the next active time
slot and the previous data will be transmitted
When the word is completely received, it is transferred to the RX which sets the RDF flag
(Receive Data register full). Setting RDF will cause a receive interrupt to occur if the re-
ceiver interrupt is enabled (RIE=1).
During the second active time slot, the second data word begins shifting in. The DSP pro-
gram must read the data from RX (which clears RDF) before the second data word is com-
pletely received (ready to transfer to RX) or a receive overrun error will occur (ROE gets
set).
If the RE bit is cleared and set again by the DSP programmer, the receiver, after receiving
the current time slot in progress, will be disabled until the next frame sync (first time slot).
This mechanism allows the DSP programmer to ignore data in the last portion of a data
frame.
Note: The optional frame sync output and clock output signals are not affected even if the
transmitter and/or receiver are disabled. TE and RE do not disable bit clock and
frame sync generation.
To summarize, in the Network mode, an interrupt can occur after the reception of each
enabled data word or the programmer can poll the RDF flag. The DSP program response
can be:
3. Do nothing - the receiver overrun exception will occur at the end of the next ac-
tive time slot
will not generate a periodic frame sync. A frame sync pulse will be generated only when
there is data available to transmit. The On-demand mode requires that the transmit frame
sync be internal (output) — i.e., the on-demand mode is disallowed whenever the transmit
frame sync is configured as an input. Data transmission is data driven and is enabled by
writing data into the TX register. Receive and transmit interrupts function with the TDE and
RDF flags as normally; however, transmit underruns (TUE) are impossible for on-demand
transmission.
Freescale Semiconductor, Inc...