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.

tskSleep does not match actual prd sleep time

Other Parts Discussed in Thread: SPRC223

Hi,

I have the clock manager properties set so that th microseconds/int is 1000.  This means that the low resolution clock or system tick is at 1ms?   If that is so doing a TSK_Sleep(1) should yield a 1ms sleep time?  when I do this I see that the task sleep for about 300usec.  I have a task that send message out and puting a scope on the hardware line shows that I have a 300usec delay.  Why am I not getting the 1ms

Dusty,

  • Dusty,

    The clock manager will 'tick' every 1ms in that scenario. The TSK_sleep will return after it sees a single 'tick.' Even though the timer generates an interrupt every 1ms, the TSK_sleep will be called anywhere between 0-1ms. This means that the next tick could be less than 1ms away. Try upping to the TSK_sleep argument 2 and see if the time ends up somewhere between 1-2ms.

  • Does TSK_Sleep() allow other task to run?

     

  • Yes. While the current task is asleep other tasks are able to run (assuming the system is not inside an HWI or SWI).

  • Hi all,

    I have a TMS302C6727 custom board configured at 300MHz DSP clock.

    My seconds/interrupt rate (CLK Manager properties) is 1000us, so I understand one tick takes one milisecond. However, when doing a TSK_sleep(100) I have experimentally checked that it spends just 1.5ms when it should take 100ms. Why this behaviour?

    Any suggestion would be appreciated.

    Thanks,

    best regards

  • Make sure that you have specified the correct frequency in the Global Settings Properties. The clock module feeds down from the speed you specify inside the Global Settings - it cannot "figure out" the actual frequency at run-time.

    Also, what testing method are you using to determine that this actually takes just 1.5ms?

  • Hi Tim,

    The DSP Speed in MHz (CLKOUT) is effectively 300 in the Global Settings Properties.

    The method I use is defining a TSK that alternatively pulls up and down a GPIO pin of the DSP, like this

    void pulse()
    {

        hMcasp->regs->PDCLR = 0x40;                      // pulls-down AXR0[6]

        while(1)
        {
            hMcasp->regs->PDIN_PDSET = 0x40;       
    // pulls-up AXR0[6]

            TSK_sleep(100);

            hMcasp->regs->PDCLR = 0x40;               
    // pulls-down AXR0[6]

            TSK_sleep(100);
        }
    }

    I still work in this issue,

    Thanks

     

  • At run time take a look at the timer's period register - does it look right for a 1ms interval? If you change the TSK_Sleep calls to 200 does it sleep for 3 seconds?

  • Hi Tim, Im deeply sorry for the delay to answer.

    I have checked the elapsed time for a TSK_Sleep(100) and it is of 1.22 seconds (not the 1.5 seconds I told before, I measured it wrong). And yes, for a double tick amount it sleeps the double of time (2.44 seconds).

    However, I don´t know how to check the prd register at run time. Whats is the register address if the programs loads at 0x10000000 IRAM? The only information I have found is in C672X CSL reference guide (sprc223, page 21)  regarding 0x01940000 and 0x01944000 addresses so I check them with View->Memory in CCS, but I am not completely sure if this is the procedure.

    Thanks again,

  • The easiest way is to check the Clock Manager Properties inside your BIOS Configuration File to see how the Timer is configured. See the attached photo.

  • Tim,

    I have just checked the Clock Manager Properties at run time and it displays the same values shown in your attached photo. I still do not know what happens.

    Regards,

  • I created an example project on my PADK eval board and I do see the 100ms output, so I am confident this is running properly. Please see the attached project and scope shot.

    You should be able to run this on your custom hardware as well, but depending on which peripherals you are using and which pins you have access to you may need to modify the example to use a different GPIO pin.

    100msSleep.zip
  • Thank you for the code Tim,

    However the problem persists with your code (1.22 sec output).

    The only change I made was to use my own .tcf for my custom board. Anyways I have compared both tcf and I do not see any difference.

    I'll continue researching,