How Can I Easily Label and Sort SPI Read and Write Transactions?

Question from the Customer:

I am using the Beagle I2C/SPI Protocol Analyzer and the Data Center Software for running tests on SPI devices. This SPI data has 8 bits, the first of which tells me whether it is a read or a write. It would really help me to assign a read or write label so that the data can be separated automatically. For now, I must do that manually.

Here is a screenshot of a data capture from the Beagle analyzer:

Data capture of SPI read write transactions SPI Data Capture

What I have in mind is adding a column that indicates if the transaction is a read or write. All the transactions below are on the same register. In my example of data, the 3F (0011 1111) is a write and the BF (1011 1111) is a read.

Is there a way I can sort and name this data by the first digit?

Response from Technical Support:

Thank you for your question! The Data Center Software provides many features, but the one that you request is not available. However, the customization that you want is possible with the Beagle Software API. We will provide a summary of the data that the Data Center Software provides and how you can create options with API commands.

How SPI Transactions are Displayed

The SPI Transaction window of the Data Center Software displays all the transactions that were captured on the SPI bus in real time. For the top-level SPI transactions, data is displayed as a sequence of 2-byte words.

  • The first byte of the word is the MOSI data.
  • The second byte is the MISO data.

The data is paired because SPI is a bidirectional protocol, and the MOSI and MISO bytes appear on the bus at the same time. SPI transactions can be expanded into separate MISO and MOSI records, both of which contain the normal sequence of 1-byte words. However, distinguishing them based on custom requirement is not supported.

However, you can implement a custom application built using Beagle API commands.

Customize Data Extractions

With Beagle Software API commands, you can extract any data that is sniffed by the Beagle protocol analyzer. In other words, you can customize the analysis side of the setup per your requirements. The Beagle Software API if a free-for-download package for our customers. It enables you to write a custom program to achieve user goals. The API supports multiple OS (Windows, Linux, and Mac) and multiple languages (C, Python, Visual Basic, and C#), and includes examples. A detailed description of the API is available in the API Documentation section of the Beagle Protocol Analyzer User Manual. Many functional examples are provided, which you can use as is or modify as needed.

Here is a working API example that gives you a good jump start: capture_spi. This command is a simple capture for SPI. By default, it operates as follows:

  • Open the Beagle analyzer on port 0.
  • Set the sampling rate to 10000 KHz.
  • Set the idle timeout set 500 ms.
  • Set the latency to 200 ms.
  • Set the host interface to high speed.
  • Configure the Beagle analyzer for SPI.
  • Output the captured data.

You can customize this example to save the data as desired, such as the standard comma-separated (CSV) format, which can then be viewed in a spreadsheet.

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