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
How and Why to use the API to Send a Stream of Continuous Data when the Promira Serial Platform is in SPI Slave Mode
Rena

Question from the Customer:

I have found it easy to use the Control Center Serial Software with the Promira Serial Platform but I seem to have a project that is more challenging. I need to send a stream of continuous data.

The configuration I am using:

  • The Promira platform in is SPI Slave mode
  • The Control Center Software MISO data is set filled for 255 bytes.

The results I am getting:

  • When the SPI Master starts a new transfer, the data sent from the Promira SPI Slave resets the data to the starting location, not continuing the data stream from the current location.
  • For the first SPI Master transaction, the SPI Slave sends bytes 1-10.
  • For the next SPI Master transaction, the SPI Slave again sends bytes 1-10, not bytes 11–20.

What should I do to enable sending continuous data?

Response from Technical Support:

Thanks for your question! For many setups, the Control Center Serial Software is a great tool, making it easy to directly interact with the Promira platform and run batch mode. However, for your setup, we recommend using the Promira Software API.  Here’s why -

The buffer size of Promira platform is limited to 256 bytes. In a single transaction, it is not possible for both Control Center GUI and Promira Serial Platform to send more than 256 bytes of data. If the data exceeds the read size, the data is truncated; the rest of the data is not wrapped in the next transaction. Effectively, Set MISO is triggered again, causing the same stream of data to be treated as new data – the data is sent from the starting location until the buffer is full.

The Promira Software API, however, can be written to send continuous data by wrapping the data (that exceeds the read size) in the next transaction. Here are the API commands that fulfill your requirements:

  • Set SPI Slave Host Read Size (ps_spi_slave_host_read_size).  This command 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, 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 of data in 64KB chunks by calling the ps_spi_slave_read function.
  • Slave Set Response (ps_spi_std_slave_set_resp) . This command sets the slave response in the event the SPI subsystem is put into slave mode and contacted by a master. Due to the limited buffer space, the device may only accept a portion of the intended response.

    •  If the value returned by this function is less than num_bytes, the remainder of the bytes will be dropped.
    • If more bytes are requested in a transaction, the response string will be wrapped as many times as necessary to complete the transaction.

For more help with your project, we suggest looking at the example programs, provided with the API, that you can download to use as is or modify for your use. For more information about the API, please refer to the API Documentation section in the Promira Serial Platform I2C/SPI Active User Manual.

Additional resources that you may find helpful:

We hope this answers your question. If you have other questions about our 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.