How can I change SPI modes between sample and setup phases?

Question from the Customer:
I’m working with an SPI device where I need to change modes between sample and setup. I’m using the Aardvark I2C/SPI Host Adapter. How do I change the clock polarity (CPOL) and clock phase and CPHA?

Response from Technical Support:

Thanks for your question! You can easily change the clock polarity with the Control Center Serial Software. For a more customized application, you can use the Aardvark Software API.  The figure below shows the variations that you can set:

The Clock Polarities and Clock Phases affect the SPI ModesControl Center Serial Software provides an easy GUI for setting up the clock polarity and clock phase, as well as the bitrate and bit order as shown below.

Control Center Serial Software - SPI optionsFor more information, please refer to the SPI section of the Control Center Serial Software User Manual.

Aardvark Software API supports many platforms and programming languages, and is provided with many examples that can be used as-is or customized for your application. Here is the API command for configuring clock polarity and clock phase, as well as bit order:

The command: Configure (aa_spi_configure)

  • For the polarity, you can specify which transition is the leading edge and which transition is the falling edge.
  • For the phase, you can specify whether to sample or setup on the leading edge.
  • For the bit order, you can specify if the LSB or the MSB is shifted first.

For additional information, please refer to API Documentation.

Additional resources that you may find helpful include the following:

 We hope this answers your question. Want more information? You can contact us and request a demo that applies to your application, as well as ask about our Total Phase products.

Request a Demo