![Texas Instruments AM1808 Technical Reference Manual Download Page 1238](http://html.mh-extra.com/html/texas-instruments/am1808/am1808_technical-reference-manual_10945581238.webp)
Architecture
1238
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Multichannel Buffered Serial Port (McBSP)
1.
The GPIO and McBSP signals are multiplexed together on the device. Start by programming the pin
multiplexing register (PINMUX) to select the GPIO function on the GPIO/McBSP multliplexed pins.
Program the GPIO peripheral so that these pins function as GPIO inputs.
2. Ensure that no portion of the McBSP is using the internal sample rate generator signal CLKG and the
internal frame sync generator signal FSG (GRST = FRST = 0 in SPCR). The respective portion of the
McBSP needs to be in reset (XRST = 0 and/or RRST = 0 in SPCR).
3. Program the sample rate generator register (SRGR) and other control registers as required. Ensure the
internal sample rate generator and the internal frame sync generator are still in reset (GRST = FRST =
0 in SPCR). Also ensure the respective portion of the McBSP is still in reset in this step (XRST = 0
and/or RRST = 0 in SPCR).
4. Wait for proper McBSP internal synchronization:
(a) If the external device provides the bit clock, wait for two CLKR or CLKX cycles. Skip step 5.
(b) If the McBSP generates the bit clock as a clock master, wait for two CLKSRG cycles. In this case,
the clock source to the sample rate generator (CLKSRG) is selected by the CLKSM bit in SRGR.
5. Skip this step if the bit clock is provided by the external device. This step only applies if the McBSP is
the bit clock master and the internal sample rate generator is used.
(a) Start the sample rate generator by setting the GRST bit in SPCR to 1. Wait two CLKG bit clocks for
synchronization. CLKG is the output of the sample rate generator.
(b) On the next rising edge of CLKSRG, CLKG transitions to 1 and starts clocking with a frequency
equal to 1/( 1) of the sample rate generator source clock CLKSRG.
6. A transmit sync error (XSYNCERR) may occur when it is enabled for the first time after device reset.
The purpose of this step is to clear any potential XSYNCERR that occurs on the transmitter at this
time:
(a) Set the XRST bit in SPCR to 1 to enable the transmitter.
(b) Wait for any unexpected frame sync error to occur. If the external device provides the bit clock, wait
for two CLKR or CLKX cycles. If the McBSP generates the bit clock as a clock master, wait for two
CLKG cycles. The unexpected frame sync error (XSYNCERR), if any, occurs within this time
period.
(c) Disable the transmitter (XRST = 0). This clears any outstanding XSYNCERR.
7. Setup data acquisition as required:
(a) If the EDMA controller is used to service the McBSP, setup data acquisition as desired and start
the EDMA controller in this step, before the McBSP is taken out of reset.
(b) If the CPU interrupt is used to service the McBSP, no action is required in this step.
(c) If CPU polling is used to service the McBSP, no action is required in this step.
8. Poll the GPIO pin (through reading the appropriate registers in the GPIO peripheral) to detect the first
transmit frame sync from the external device. Upon detection of the first frame sync, perform the
following in this order:
(a) Set the XRST bit and/or the RRST bit to 1 to enable the respective portion of the McBSP. The
McBSP is now ready to transmit and/or receive.
(b) Program PINMUX to switch the GPIO/McBSP multiplexed pins to the McBSP function.
9. Service the McBSP:
(a) If CPU polling is used to service the McBSP in normal operations, it can do so upon exit from the
ISR.
(b) If the CPU interrupt is used to service the McBSP in normal operations, upon XRDY interrupt
service routine is entered. The ISR should be setup to verify that XRDY = 1 and service the McBSP
accordingly.
(c) If the EDMA controller is used to service the McBSP in normal operations, it services the McBSP
automatically upon receiving the XEVT and/or REVT.
10. Upon detection of the second frame sync, DXR is already serviced and the transmitter is ready to
transmit the valid data. The receiver is also serviced properly by the CPU.