Minimal configuration is required to set up the SPI master and the required I/O mapping.
The AUX_SPIM:SPIMCFG register configures the following:
- SCLK prescaler:
- The SCLK is derived from the peripheral clock by division, given by the value of the DIV field.
- Phase of MOSI and MISO data signals:
- The PHA field selects when to shift MOSI and when to sample MISO. MISO is always sampled by the SCLK edge in the middle of the bit period.
- SCLK polarity:
- The POL field selects the idle state of SCLK.
Connect the peripheral SPI signals to AUX I/Os by:
- SCLK:
- Determine the AUX I/O that connects to SCLK.
- Set the AUX I/O peripheral output to AUX_SPIM_SCLK.
- Enable peripheral output for the AUX I/O.
- Set the I/O mode to digital output.
- MOSI:
- Determine the AUX I/O that connects to MOSI.
- Set the AUX I/O peripheral output to AUX_SPIM_MOSI.
- Enable peripheral output for this AUX I/O.
- Set the I/O mode to digital output.
- MISO:
- Determine the AUX I/O that connects as MISO.
- Set I/O mode to input.
- Enable the digital input buffer.
- Configure AUX_SPIM:MISOFCG to the chosen AUX I/O.
Chip select (CS) is controlled separately by the host. Configure the AUX I/O that functions as CS as follows:
- Determine the AUX I/O that functions as CS.
- Disable peripheral output for this AUX I/O.
- Set the I/O mode to digital output.
Sensor Controller Studio handles the necessary configuration for the user.