Article ID: 000085677 Content Type: Troubleshooting Last Reviewed: 09/11/2012

Why does Nios II take longer than expected when executing the usleep() C function?

Environment

BUILT IN - ARTICLE INTRO SECOND COMPONENT
Description

The specification of the usleep function is to cause a delay at least equal to the value specified. The actual time that is taken to return from the function can be longer than this, but should never be shorter.

The Nios® II implementation of usleep is tuned to ensure that the processor accurately enforces the delay requirements. However, as with any software function call, there can be added latency due to the fetching of instructions from slower memories. These delays could be proportionally large for very small values of usleep.

If an very precise delay is required, it is recommended that an interrupt-driven timer is used as this will be cycle-accurate. However, for a delay of at least the specified value, usleep is recommended.

Related Products

This article applies to 1 products

Intel® Programmable Devices