I2C SPI USB CAN eSPI Cable Testing View All Quick Start Guides User Manuals Software Downloads Knowledge Base Videos Case Studies App Notes White Papers Sales Support About Us
Products Blog Sales Support Contact Search
Can I send an SPI response of more than 256 bytes with the Promira Serial Platform?
Kathleen Chan

Question from the Customer:

Our Promira Serial Platform is configured as a slave and is connected to a processor which acts as the master. The master sends 3 bytes of data on the MOSI and later reads 3 bytes and multiple dummy data bytes. The slave must then respond with the 3 bytes and the multiple dummy data bytes. The total bytes are more than 256 bytes.

If we set the slave’s response accordingly using the ps_spi_std_slave_set_resp function from the Promira Software API for I2C/SPI Active, the slave will only send the initial 256 bytes of the buffer repeatedly. Moreover, we are not able to change the slave’s response while transactions are taking place.

Is there a way in which we can send a single response that is composed of more than 256 bytes which are not repeated?

Response from Technical Support:

The buffer size of Promira Serial Platform is limited to 256 bytes. In a single transaction, it is not possible for both the Control Center Serial Software and Promira Software API I2C/SPI Active to send more than 256 bytes of data in a single response.

If there are more bytes than requested in a response, the Promira API ps_spi_std_slave_set_resp function will wrap the response string as many times as necessary to complete the message.

Control Center Serial Software

The Control Center Serial Software lets developers make use of I2C, SPI, and GPIO functionality for our Promira Serial Platform, Aardvark I2C/SPI Host Adapter, and the Cheetah SPI Host Adapter. By using this software, users can emulate a master or slave by writing and reading I2C or SPI messages on the bus.

This software truncates SPI data if it is more than 256 bytes, but it does not wrap the rest of the data in the next transaction since the MISO is set up manually. When "Set MISO" is clicked again, the same data is being treated as new data and hence, the data is being sent from starting location, until the maximum buffer size.

Promira Software API for I2C/SPI Active

In order to send continuous data with data wrapped in the next transaction if data size is greater than read size, we recommend the Promira Software API for I2C/SPI Active. For additional information about the Promira Serial Platform API, take a look at the Promira Serial Platform User Manual.

Promira Serial Platform

The API's that fulfill this requirement are:

  1. Set SPI Slave Host Read Size (ps_spi_slave_host_read_size)– This function sets the SPI slave host read size. Instead of waiting for an entire SPI transaction to complete before sending the data to the PC, this function sets a limit for the amount of data to collect before sending it back to the PC. For example, say the host read size is set to 64KB. If the Promira platform receives a large transaction of 1MB from the master, the user will receive the 1MB worth of data in 64KB chunks when calling the ps_spi_slave_read function.
  2. Slave Set Response (ps_spi_std_slave_set_resp)– This function sets the slave response in the event the SPI subsystem is put into slave mode and contacted by a master. Due to limited buffer space on the SPI subsystem, the device may only accept a portion of the intended response. If the value returned by this function is less than num_bytes the SPI subsystem has dropped the remainder of the bytes. If more bytes are requested in a transaction, the response string will be wrapped as many times as necessary to complete the transaction.

We provide downloadable example code in various programming languages such as C, C#, Python, .NET, and VB.NET.

We hope this answers your question. 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.

Request a Demo