How Can I Write and Read Contiguous Multi-Byte SPI Messages?

Question from the Customer:

I have successfully used the Aardvark I2C/SPI Host Adapter with Control Center Serial Software on many projects. Today, I need advice to write and read messages with an SPI target slave device. This project is different, as the messages are contiguous. Here is a description:

  • Write messages comprised of 8 bytes, which has been successful.
  • Read messages (from the SPI target device) comprised of 46 bytes, which has not been successful. In this case, the message is broken into multiple SPI reads. I observed that the chip select signal was asserted multiple times.

This project requires the read to occur in a single SPI bus transaction. Only one chip select should occur during the entire read transaction. How can I fulfill this requirement with this SPI target device?

Response from Technical Support:

Thanks for your question! The Aardvark adapter supports 8-bit SPI word data. The non-8-bit word lengths that your target device requires are not supported. For more information, please refer to SPI Signaling Characteristics in the Aardvark I2C/SPI Host Adapter User Manual.

To support your project, we recommend the Promira Serial Platform. Alternately, you can also consider the Cheetah SPI Host Adapter. In both cases, in addition to using GUI software, you can create the scripts that provide the operations you need for your projects with Promira IC2/SPI Active API Software.

Support for Multi-Byte Data Messages

The following sections summarize how our tools can support your project.

Promira Serial Platform

The Promira Serial Platform supports active communication on the bus, including I2C, SPI, and eSPI. For your project, three SPI applications are available, at least one of which is required for interacting with the SPI bus protocol. Note: Each application level supports a single slave response of up to 256 bytes.

  • SPI Active - Level 1 Application, supports clock speeds of up to 12.5 MHz for master and 8 MHz for slave functionality.
  • SPI Active - Level 2 Application supports clock speeds of up to 40 MHz for master and 20 MHz for slave functionality. Note: SPI Active - Level 1 must also be installed in the Promira device.
  • SPI Active - Level 3 Application, supports clock speeds of up to 80 MHz for master and 20 MHz for slave functionality. Note: SPI Active - Level 1 and Level 2 must also be installed in the Promira device.

For sending any number of bits from Promira, you can use Promira Software API I2C/SPI Active, which supports multiple operating systems and programming languages. Functional API scripts are provided, which you can use as is, or modify for your requirements.

For example, here are two API write functions that apply to your project:

  • Queue SPI Master Write (ps_queue_spi_write)
  • Queue SPI Master Write Word (ps_queue_spi_write_word)

Note: the word size that you can set with our Promira API should have a minimum of 2 bits, and a maximum of 32 bits.

Cheetah SPI Host Adapter

The Cheetah SPI Host Adapter also supports multiple 8-bit SPI word data. The article Using Cheetah to Send Multiple SPI Packets with One Transfer describes using Cheetah Software API in synch and asynch modes. These concepts can also be applied to the Promira platform.

Total Phase SPI Tools

Here is a table to easily compare all our tools for SPI (and I2C) devices:

Chart of Total Phase SPI and I2C Tools Total Phase I2C/SPI Tools

We hope this answers your questions. Additional resources that you may find helpful include the following:

If you want more information, feel free to contact us with your questions, or request a demo that applies to your application.