This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Is There An Easy Way To Get The System Clock Period?

Hi,

I'm using SEM_pendBinary and I want to provide a timeout appropriate to the semaphore's function. The documentation states that the timeout is based on system clock ticks.

My first mistake was thinking that system clock ticks were DSP clock ticks.

I now believe my system clock tick is configured by the 'Microseconds/Int' value on the CLK General tab (or bios.CLK.MICROSECONDS = 999.9960). In other words the system clock tick is approximately 1 ms. (My configuration is based on the DSK6455 platform.)

I want to write something like:

    const Uns timeoutInMicroseconds = 1000u;

    const Uns timeoutInTicks = timeoutInMicroseconds / SYSTEM_CLOCK_PERIOD;

    SEM_pend(&sem, timeoutInTicks);

I've been reading about CLK_getprd(), CLK_countspms(), etc. but after an hour I'm still not sure what to do with them and anyway, they are functions and I'd quite like a constant.

Any thoughts greatly appreciated.

Thanks,

Matt

  • Hi Matt,

    The recommended way to convert sleep time in microseconds to ticks is as follows. You can also take a look at Example 4.16 in BIOS 5.x User Guide.

         ticks = (sleepTimeInMicroSecs * CLK_countspms()) / CLK_getprd();

    There is no C constant for the system tick period.

    Nitya