I2C SPI USB CAN eSPI Cable Testing View All Videos Quick Start Guides Software Downloads App Notes White Papers User Manuals Knowledge Base Sales Support About Us
Products Blog Sales Support Contact Search
Is there a Way to Adjust the Duty Cycle of the I2C Master Clock?
Rena Ayeras

Question from the Customer:

I am using the Aardvark I2C/SPI Host Adapter. For my application, I need to adjust the I2C Master Clock Duty Cycle from 30% to 50%. How can I adjust the duty cycle?

Response from Technical Support:

Thanks for your question! The Aardvark adapter operates within the I2C specification, including the clock (SCLK); the duty cycle cannot be changed. However, a GPIO signal pin can be programmed with API commands to create the desired duty cycle.

For this application, we strongly recommend using the Promira Serial Platform with an I2C Active Level x Application (Level 1, Level 2). There are speed limitations for generating a clock pulse, which are described below.

Speed Limitations of Generated Clocks

There are latencies that apply to both the Aardvark adapter and the Promira platform:

  • Operating system overhead
  • Latencies caused by the bus
Aardvark-specific limitations include its maximum clock rate, and the API commands are handled in blocks, not queues. A block function waits for the response from the device. Also, the Aardvark adapter is a only full-speed USB device, which limits its speed over the USB connection to the PC. With all these factors, the maximum clock rate via GPIO would be far below 800kHz, which is why we recommend the Promira platform. Promira-specific advantages include its higher clock rates (determined by the licensed application level) and processing commands are queued up and shifted to the device at once. The Promira platform is a High-speed USB device allowing it to communicate faster over the USB connection. There is also option of interfacing via Ethernet which further reduces latency.

Using the API for Generating SCLK of Specified Duty Cycle

Promira API

Using the Promira API Software, we recommend these API commands to create a 50% duty cycle. The GPIO signal is switched on and off.

ps_queue_gpio_set(queue, STATE0)

ps_queue_delay_ms(queue, on_time_in_ms)

ps_queue_gpio_set(queue, STATE1)

ps_queue_delay_ms(queue, off_time_in_ms)

For the target duty cycle of 50%, on_time_in_ms = off_time_in_ms. The STATE0 and STATE1 parameters are set in terms of bitmasks of the available GPIOs.

Aardvark API

Although programming with the Aardvark adapter is not recommended, an example is provided should the slower clock rate work for some applications.

The GPIO values are set using bit-masks in the aa_gpio_set(). The delay function can be replaced with aa_sleep_ms(). However, high frequencies of several hundred KHz cannot be achieved with the GPIO switching speed.

For more information, please refer to the API Documentation section of the Aardvark I2C/SPI Host Adapter User Manual.

For an easy comparison, here’s a table that summarizes the features of I2C/SPI Total Phase tools.

Promira Applications Comparison Chart

 

Additional resources that you may find helpful include the following:

For information about specific applications:

We hope this answers your question. Looking for more information? You can contact us and request a demo that applies to your application, as well as ask about Total Phase products.

Request a Demo