To enable and initialize the SPI, the
following steps are necessary:
- Configure the IOMUX with the appropriate GPIO pins for which the SPI signals
are multiplexed to
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.
For each of the frame formats, the SPI is configured using the following steps:
- Ensure that the ENABLE bit in
the CTL1 register is clear before making any configuration changes.
- Select and configure the clock prescale divisor by writing the CLKSEL and
CLKDIV register.
- Select whether the SPI is a controller or peripheral:
- For controller operations, set the MS bit in the CTL1 register.
- For peripheral mode, clear
the MS bit in the CTL1 register.
- Configure the clock divisor by writing the CLKCTL register.
- Please note that a SPI
Software reset ( See section 15.3.4) is required when switching SPI protocol
format.
- Configure the CTL0 and CTL1
register with based on the desired protocol, data width and other special
configurations.
- Optionally configure DMA
- Enable the SPI by setting the ENABLE bit in the CTL1 register.