Follow the high-level UNICOMM configurations in
Section 22.3 before executing the below SPI-specific
configurations.
Note: Pull-ups can
be used to avoid unnecessary toggles on the SPI pins, which
can take the peripheral to a wrong state. In addition, if
the SCLK signal is programmed to steady state High through
the SPO bit in the CTL0 register, then software must also
configure the GPIO port pin corresponding to the SCLK signal
as a pull-up.
To enable and initialize the SPI, perform the
following initialization steps:
- Clear the
ENABLE bit in the CTL1 register before making any of
the below configuration changes.
- Select
whether the SPI is a controller or peripheral:
- For controller mode, set the CP bit in the CTL1
register.
- For peripheral mode, clear the CP bit in the CTL1
register.
- Configure
the CTL0 and CTL1 registers based on the desired
protocol, data width and other SPI-specific
configurations.
- Configure
the desired FIFO trigger levels in the IFLS
register.
- Enable desired interrupts and/or DMA event
by using CPU_INT, DMA_TRIG_RX, DMA_TRIG_TX group
IMASK registers.
- (Optionally) Configure the emulation mode for the
peripheral in the PDBGCTL register.
- Enable
the SPI by setting the ENABLE bit in the CTL1
register.