How Do I Get the SPI Host Adapter to Drive the SPI Clock?

Question from the Customer:

I have been working with your Aardvark I2C/SPI Host Adapter and it’s been working great on all my projects. I have a question for you.

Using the Aardvark adapter for SPI, I programmed a script in python to handle a more complex communication with a µC-System. Here is the problem I want to solve:

  • I’m using a GPIO of the Aardvark adapter as the CS, the original SPI CS (chip select) is ignored
  • The communication is handled by sending single bytes - to be able to set a delay between two bytes
  • The SPI-Mode should be Mode 0
  • The problem is, the Aardvark adapter seems to set Mode 0 right before every transmission. SCK is changing from always idle high to Mode 0 (idle low) right before the original CS, the Aardvark adapter transmits the payload, deselects the slave, and then releases SCK back to idle high.
  • As I’m using a separate GPIO controlled CS, I cannot use Mode 0.

Here’s the diagram of what I need to fix:

 user's example of using aa_api_write

 

Response from Technical Support:

Thanks for your question! The project may be complex, but in this case the solution is simple: an external pull-up resistor.

In general, the Aardvark adapter starts driving the SPI clock only where a transactions occurs.  Until then, that signal may be in high impedance tri-state mode. With a pull-up resister attached from the SPI clock line to VCC, the Aardvark adapter will detect a logical ‘1’ and then start driving the SPI clock. You won’t need much current – a 100k resistor should do the job.

For more information, please refer to section Pin Driving of the Aardvark I2C/SPI Host Adapter User Manual.

Additional resources that you may find helpful include the following:

We hope this answers your questions. If you have other questions about our protocol analyzers or other Total Phase products, feel free to email us at sales@totalphase.com, or if you already own one of our devices and have a technical question, please submit a request for technical support.

Leave a Reply