McBSP Pins as General-Purpose I/O
11-87
Multichannel Buffered Serial Ports
11.8 McBSP Pins as General-Purpose I/O
Two conditions allow the serial port pins (CLKX, FSX, DX, CLKR, FSR, DR,
and CLKS) to be used as general-purpose I/O rather than serial port pins:
-
The related portion (transmitter or receiver) of the serial port is in reset:
(R/X)RST = 0 in the SPCR
-
General-purpose I/O is enabled for the related portion of the serial port:
(R/X)IOEN = 1 in the PCR
Figure 11–3 shows the PCR bits that configure each of the McBSP pins as
general-purpose inputs or outputs. Table 11–22 shows how this is achieved.
In the case of FS(R/X), FS(R/X)M = 0 configures the pin as an input and
FS(R/X)M = 1 configures that pin as an output. When configured as an output,
the value driven on FS(R/X) is the value stored in FS(R/X)P. If configured as
an input, the FS(R/X)P becomes a read-only bit that reflects the status of that
signal. CLK(R/X)M and CLK(R/X)P work similarly for CLK(R/X). When the
transmitter is selected as general-purpose I/O, the value of the DX_STAT bit
in the PCR is driven onto DX. DR is always an input, and its value is held in
the DR_STAT bit in the PCR. To configure CLKS as a general-purpose input,
both the transmitter and receiver have to be in the reset state and (R/X)IOEN
has to be set to 1, because (R/X)IOEN is always an input to the McBSP and
it affects both transmit and receive operations.
Table 11–22. Configuration of Pins as General Purpose I/O
Pin
General-Purpose
I/O Enabled When...
Selected as
Output When...
Output Value
Driven From
Selected as
Input When ...
Input Value
Readable on
CLKX
XRST = 0
XIOEN = 1
CLKXM = 1
CLKXP
CLKXM = 0
CLKXP
FSX
XRST = 0
XIOEN = 1
FSXM = 1
FSXP
FSXM = 0
FSXP
DX
XRST = 0
XIOEN = 1
Always
DX_STAT
Never
N/A
CLKR
RRST = 0
RIOEN = 1
CLKRM = 1
CLKRP
CLKRM = 0
CLKRP
FSR
RRST = 0
RIOEN = 1
FSRM = 1
FSRP
FSRM = 0
FSRP
DR
RRST = 0
RIOEN = 1
Never
N/A
Always
DR_STAT
CLKS
RRST = XRST = 0
RIOEN = XIOEN = 1
Never
N/A
Always
CLKS_STAT