How Can I Program a Microwire Device with Specific Clock Cycles per Write Command?

Question from the Customer:

Is there a way I can use the Aardvark I2C/SPI Host Adapter to program a microwire device? Here is a summary of device requirements:

  • A specific number of clock cycles must coincide with the operation being sent.
  • The number of clock cycles is not a multiple of 8; this device is not constrained to a number of bytes being sent (like SPI devices).

For example, the write command has 29 clock cycles on the device being programmed. What complicates the programming is if the device does not detect the expected number of clocks, the operation is terminated. It looks like I cannot just pad the command with 0s.

What do you recommend?

Response from Technical Support:

Thanks for your question! Essentially, the Aardvark I2C/SPI Host Adapter interfaces with a microwire device in the same manner as a regular SPI device. The only difference is the labeling of the pins. We will start is a summary of how the Aardvark adapter works, then follow through with two recommendations.

How the Aardvark I2C/SPI Host Adapter Writes Data

  • The Aardvark adapter is not capable of sending data bit by bit, data is only sent in multiples of bytes
  • Each byte is sent in in 8 clock cycles.
  • The Aardvark adapter has td (Master: 7 to 9 µs; Slave: min 4 µs) between two bytes of 8 bits
  • There is approximately 9 µs of setup time required in between each byte, which results in a total transmission period of the byte transmission time plus 9 µs.

In summary, the Aardvark adapter can transfer up to 8 bits data without td delay. However, there will be a td delay when transferring 16 bits (or more) of data.

The delay between each byte of data sent is due to the characteristics of the Aardvark adapter. For more information, please refer to section SPI Signaling Characteristics of the Aardvark I2C/SPI Host Adapter User Manual

Using the Control Center Serial Software

Here is a basic example of writing two 8-bit bytes AB CD in the transaction log of the Control Center Serial Software, and then submit send: assert SS, send AB CD, de-assert SS.

In this case, there will be gaps in the middle, but it is still a single transaction with the slave select (SS) asserted at the beginning and de-asserted at the end. There will be a delay between each byte of data sent because of the signaling characteristics of the Aardvark adapter.

Aligning the Packet

You may be able to use padding, but it would occur before the first transmitted bit:

  • Pad the MSB with 0s at the front before the first transmitted 1. This action would “byte-align” the packet.

The caveat is this could work if the device is not affected by the 9 µs setup time between bytes. If that timing is an issue, then we have another recommendation.

More Programming Options with Promira Serial Platform

For your application, to send multiple bits in a single transaction, we recommend using the Promira Serial Platform. This device can be licensed with SPI Level 1 / SPI Level 2 / SPI Level 3 Application(s) as needed for your requirements.

The default is 32 bits per word. However, the word lengths can be configured by using the Promira Software API I2C/SPI Active to fit program in word lengths other than multiples of 8. This way, words would be transmitted without the 9 µs inter-byte delay of the Aardvark adapter.

The API supports multiple operating systems and programming languages. In addition, example programs are provided that can be used as-is or modified as needed. For more information, please refer to the section API Documentation of the Promira Serial Platform I2C/SPI Active User Manual.

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.

Request a Demo