Controlling and Resetting the Port
9-12
Bit 0
DLB — Digital loopback mode. The DLB bit can be used to put the serial
port in digital loopback mode.
DLB = 0
Digital loopback mode is disabled. The DR, FSR, and CLKR
signals are connected to their respective device pins.
DLB = 1
Digital loopback mode is enabled. DR and FSR become inter-
nally connected to DX and FSX, respectively. The FSX and DX
signals appear on the device pins, but FSR and DR do not.
TXM must be set to 1 for proper operation in digital loopback
mode.
CLKX drives CLKR if you also set MCM = 1. If DLB = 1 and
MCM = 0, CLKR is taken from the CLKR pin of the device. This
configuration allows CLKX and CLKR to be tied together exter-
nally and supplied by a common external clock source.
9.3.1
Selecting a Mode of Operation (Bit 1 of the SSPCR)
Different applications require different modes of operation for the serial port.
The synchronous serial port supports two basic modes of operation:
-
Continuous mode (FSM = 0). The continuous mode of operation requires
only an initial frame sync pulse, as long as a write to SDTR (for transmis-
sion) or a read from SDTR (for reception) is executed during each trans-
mission/reception. Use continuous mode for transmitting a continuous
stream of information.
-
Burst mode (FSM = 1). In burst mode operation, a frame sync is required
for every transfer, and there are periods of serial port inactivity between
packet transmits. Use this mode for transmitting short packets of informa-
tion.
9.3.2
Selecting Transmit Clock Source and Transmit Frame Sync Source
(Bits 2 and 3 of the SSPCR)
The transmit clock is used to set the transmission rate of the serial port. Trans-
missions can be clocked by the internal clock source or by an external source:
-
To use the internal clock source, set the MCM bit in the SSPCR to 1. This
causes the serial port to take CLKX from the internal source. The internal
clock rate is (CLKOUT1 rate)/2.
-
To use an external clock source:
1) Connect the external clock to the CLKX pin of the transmitter and to
the CLKR pin of the receiver.
2) Set the MCM bit to 0 in the SSPCR to cause the serial port to get CLKX
from the CLKX pin.