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.

TMS320F28386S: CM CPUTIMER delays issue

Part Number: TMS320F28386S
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

Tool/software:

Good afternoon!

Please help me understanding:

I need a milliseconds delay routine for my project using CM core.

When I use DEVICE_DELAY_US(milliSeconds * 1000), the result seems to be reasonable. 

But when I am trying to use cpu timer to have more accurate delays, like this:

    CPUTimer_setPeriod(CPUTIMER2_BASE, (CM_CLK_FREQ / 1000) * milliSeconds - 1);
    CPUTimer_setPreScaler(CPUTIMER2_BASE, 0);
    CPUTimer_stopTimer(CPUTIMER2_BASE);
    CPUTimer_reloadTimerCounter(CPUTIMER2_BASE);
    CPUTimer_setEmulationMode(CPUTIMER2_BASE, CPUTIMER_EMULATIONMODE_RUNFREE);
    CPUTimer_startTimer(CPUTIMER2_BASE);
    CPUTimer_clearOverflowFlag(CPUTIMER2_BASE);
    while(!CPUTimer_getTimerOverflowStatus(CPUTIMER2_BASE));
    CPUTimer_stopTimer(CPUTIMER2_BASE);

The actual delay seems to be significantly shorter.

Where is the error?

UPDATE: I found the cause.

The SysConfig tool has an error, it ignores the CM CLK divider and alwais places the code in device.c:

    //
    // Set up CMCLK to use AUXPLL as the clock source and set the
    // clock divider to 1.
    //
    SysCtl_setCMClk(SYSCTL_CMCLKOUT_DIV_1,SYSCTL_SOURCE_AUXPLL);

regardless of the designated divider value.

So the CM core surprizingly runs at 250MHz.

  • hey oleg!
    thanks for bringing this to our attention , we are checking this,

    will get back to you shortly

    regards,

    Tanmay

  • Hi Oleg,

    Apologies for the delay. We have gone through the issue and have filed a JIRA to track this and get it updated in the next C2000Ware SDK release.

    Please replace the file at the location - C2000WARE\driverlib\.meta\device\functions_c\Clocktree\PLL_Ctl_Dividers.xdt and let me know if you are able to see the updated divider in the generated files.

    Thanks

    Aswin


    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/171/PLL_5F00_Ctl_5F00_Dividers.xdt