SPRUHM9H October 2014 – May 2024 TMS320F28075 , TMS320F28075-Q1 , TMS320F28076
An SPI interface with the McBSP used as the master is shown in Figure 20-41. When the McBSP is configured as a master, the transmit output signal (DX) is used as the SPISIMO signal of the SPI protocol and the receive input signal (DR) is used as the SPISOMI signal.
The register bit values required to configure the McBSP as a master are listed in Table 20-16. After Table 20-16 are more details about the configuration requirements.
Required Bit Setting | Description |
---|---|
CLKSTP = 10b or 11b | The clock stop mode (without or with a clock delay) is selected. |
CLKXP = 0 or 1 | The polarity of CLKX as seen on the MCLKX pin is positive (CLKXP = 0) or negative (CLKXP = 1). |
CLKRP = 0 or 1 | The polarity of MCLKR as seen on the MCLKR pin is positive (CLKRP = 0) or negative (CLKRP = 1). |
CLKXM = 1 | The MCLKX pin is an output pin driven by the internal sample rate generator. Because CLKSTP is equal to 10b or 11b, MCLKR is driven internally by CLKX. |
SCLKME = 0 | The clock generated by the sample rate generator (CLKG) is derived from the CPU clock. |
CLKSM = 1 | |
CLKGDV is a value from 1 to 255 | CLKGDV defines the divide down value for CLKG. |
FSXM = 1 | The FSX pin is an output pin driven according to the FSGM bit. |
FSGM = 0 | The transmitter drives a frame-synchronization pulse on the FSX pin every time data is transferred from DXR1 to XSR1. |
FSXP = 1 | The FSX pin is active low. |
XDATDLY = 01b | This setting provides the correct setup time on the FSX signal. |
RDATDLY = 01b |
When the McBSP functions as the SPI master, the McBSP controls the transmission of data by producing the serial clock signal. The clock signal on the MCLKX pin is enabled only during packet transfers. When packets are not being transferred, the MCLKX pin remains high or low depending on the polarity used.
For SPI master operation, the MCLKX pin must be configured as an output. The sample rate generator is then used to derive the CLKX signal from the CPU clock. The clock stop mode internally connects the MCLKX pin to the MCLKR signal so that no external signal connection is required on the MCLKR pin and both the transmit and receive circuits are clocked by the master clock (CLKX).
The data delay parameters of the McBSP (XDATDLY and RDATDLY) must be set to 1 for proper SPI master operation. A data delay value of 0 or 2 is undefined in the clock stop mode.
The McBSP can also provide a slave-enable signal (SPISTE) on the FSX pin. If a slave-enable signal is required, the FSX pin must be configured as an output and the transmitter must be configured so that a frame-synchronization pulse is generated automatically each time a packet is transmitted (FSGM = 0). The polarity of the FSX pin is programmable high or low; however, in most cases the pin must be configured active low.
When the McBSP is configured as described for SPI master operation, the bit fields for frame-synchronization pulse width (FWID) and frame-synchronization period (FPER) are overridden, and custom frame-synchronization waveforms are not allowed. To see the resulting waveform produced on the FSX pin, see the timing diagrams in Section 20.7.4. The signal becomes active before the first bit of a packet transfer, and remains active until the last bit of the packet is transferred. After the packet transfer is complete, the FSX signal returns to the inactive state.