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
I Need to Transfer 24-bit Words to Configure an SPI Device – What are my Options?
Rena Ayeras

Option cards

Illustration by Geralt

Question from the Customer:

I am using the Aardvark I2C/SPI Host Adapter and Aardvark Software API, specifically the aardvark.c file. I am following the examples on the Total Phase website to create a set of SPI transactions. However, configuring one of the SPI devices requires 24-bit transactions. To do so, I send three consecutive 8-bit words. The issue I am having is that the signal select (SS) line is not staying low for the duration of the 3-byte transactions. Instead, the SS line toggles.

I am using the aa_spi_write command. Can you suggest how to keep that SS line logically low?

Response from Technical Support:

Thanks for your question! The Aardvark adapter only supports 8-bit SPI data, which is why you see the SS link toggle between 8-bit transactions. It is possible to keep the SS line low by adding pull-down resistors to your setup or running the Aardvark adapter in GPIO mode.

Keeping Signal Select Lines Low in GPIO Mode

In the Aardvark adapter, there are two pull-up resistors on each line, 2.2Kohm and 100Kohm in parallel. The 2.2Kohm resistor is configurable - it can be turned on and off. However, the 100Kohm resistor, which is extremely weak, is not configurable – it cannot be turned off when the Aardvark adapter is in SPI mode.

The 100Kohm pull-up resistor ensures the lines provide a logic high state when nothing is connected on the other side of the connector. Otherwise, the signal level could be in a floating state, neither logical high nor low, which would affect communication.

There are two ways to resolve this with the Aardvark adapter:

  • Add an external pulldown, about 20Kohm, to offset the weak internal pullup.
  • Use the Aardvark Software API to switch to GPIO mode. This allows you to fully disable the pullups. With your customized script, you could incorporate similar functionality to enable GPIO mode when not communicating in SPI mode.

If adding resistors to your setup is an issue, or if a faster transfer rate would be effective, we have another recommendation - the Promira Serial Platform.

Transferring Larger Data Words Faster without Resistors

The following sections describe how the Aardvark adapter and the Promira platform work with SPI data, and why we recommend the Promira Serial Platform.

Aardvark Adapter Supports 8-bit SPI Data Transfers

Here is a summary of how the Aardvark adapter handles data:

  • Only 8-bit SPI words are supported.
  • Non 8-bit SPI word data, including multiples of 8 bits per word, are not supported.
  • Data is only managed in multiples of bytes – sending data bit by bit is not supported.
  • Each byte is sent in 8 clock cycles.
  • There is a setup time (td) between each byte. In master mode, td is 7ms to 9m In slave mode, td is a minimum of 4 ms.

The setup time is required between each byte, which adds to the transmission time for multiple bytes. In terms of bits, the Aardvark adapter transfers up to 8 bits of data without td delay. Maximum bitrates are only achievable within each individual byte. That bitrate does not extend across bytes. The delay between each byte of data sent is due to the characteristics of the Aardvark device – it cannot be removed.

SPI Waveforms and Byte Timing

Here is a diagram of an SPI waveform:

SPI Waveform for SS, MOSI and MISO signals

SPI waveform timing:

  • t1 is the time from the assertion of SS# to the first clock cycle.
  • t2 is the time from the last clock cycle and the deassertion of SS#.
  • tp is a clock period.

Here is an illustration of SPI byte timing:

SPI Byte Waveform for SS, MOSI and MISO signals

SPI byte timing:

  • t d is the setup time between SPI bytes.
  • tb is the total byte-to-byte time.

Promira Platform Transfers Larger Data Words Faster without Pull-Down Resistors

For your application, to send 24 bits in a single transaction, we recommend the Promira Serial Platform. This device can be licensed up to the level of capability that you need:

The Promira Serial Platform provides options that support your requirements:

  • The SS line does not toggle.

    • You configure word lengths in the API, such as 24 bits, and send them in a single transaction in 32 clock cycles.
    • Because of the freedom from the 8-bit word limit, there is no inter-byte setup delay as with the Aardvark adapter.
  • Promira Software API, similar to Aardvark Software API, supports many programming languages and operating systems, and is provided with functional scripts that you can use as is or modify as needed.

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.