For SPI Devices, How Do I Modify Data at the Bit Level During Read and Write Operations in Both Master and Slave Configurations?
Rena Ayeras

Question from the Customer:

I’m looking at three devices that interface with the SPI bus: Aardvark I2C/SPI Host Adapter, Cheetah SPI Host Adapter and the Promira Serial Platform. So far, the Promira platform looks best for our needs. Before I make a decision, I’d like some information about I/O buffers and data handling:

  • Is there a difference in the data size of I/O buffers between the three devices? It looks like the Promira platform can handle higher amounts of data (bytes) in read/write operations.
  • Is it possible to modify data at the bit level (instead of byte level) during read and/or write operations with the Promira platform, in both master and slave configurations?
Response from Technical Support:

Thanks for your questions! Here’s a comparison of the features you asked about:

I/O Buffer Size: volume of data (bytes) in read/write operations

  • The maximum buffer size of Aardvark and Cheetah adapters is 64 bytes. This applies to both slave and master modes. NOTE: The Cheetah adapter only functions as an SPI Master; the Aardvark adapter can function in either master or slave modes.
  • For the Promira Serial Platform, the I2C/SPI device receive buffer size is 2 Mbytes; the I2C/SPI slave response size is 256 bytes.

Here is some information about using the Promira Software API for read/write operations.

Modifying data at the bit level during read/write operations in Master and Slave configurations:

In SPI mode, the Promira Serial Platform has the capability to vary the word length between 2 and 32 bit words. You can modify the data at the bit-level during read and write operations, which you can do with the Promira Software API. Here is the Promira API function for SPI write - you queue a command that writes a stream of the same word to the downstream SPI slave device:

The function:

int ps_queue_spi_write_word (

PromiraQueueHandle queue,

PromiraSpiIOMode io,

u08 word_size,

u32 out_num_words,

u32 word);

The arguments:

queue: the queue handle, io: IO mode flag. The value of flas is related to the SPI device (see the table below) word_size: number of bits per word, between 2 and 32 out_num_words: number of words to send

Regarding the values of the I/O flag:

Promira-SPI-IO-flagsThe return value:

When successful, the status code is returned with PS_APP_OK. There are no error codes.

About queuing:NOTE: before using this function, enable the outputs with ps_queue_spi_oe

out_num_words: for queuing, this is number of words to send

For more information, please refer to the commands read(int ps_queue_spi_read) and SPI Master write(ps_queue_spi_write_word) in the API Documentation section of the Promira Serial Platform User Manual.

Here is a table that shows the main features of the Aardvark and Cheetah adapters, and the Promira platform and SPI Active Level 1-3 applications:

Promira Applications Comparison Chart

NOTE: For the Promira applications, the previous levels of the application must first be installed. For example, for SPI Active - Level 3, SPI Active - Levels 1-2 must already be installed.

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

More questions? Need more details? You can also contact us and request a demo that applies to your application, as well as ask questions about the Promira Serial Platform and other Total Phase products.

Request a Demo