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.

SYSBIOS CLock configuration on DM8148

Other Parts Discussed in Thread: SYSBIOS

I'm developing DSP software to run on a DM8148 platform. I'm using SYSBIOS v6.31.04.27 and XDC version 3.20.08.88.

I have several questions regarding the SYSBIOS clock, and DSP clock frequency.

My software uses a periodic function that is to be called at a 1 ms rate. I dynamically create a SYSBIOS clock object in my main ( ) function:

 

#include <ti/sysbios/knl/Clock.h>

Clock_Params clkParams;

Clock_Params_init(&clkParams);

clkParams.period = 500;    // this setting is part of the issue!

clkParams.startFlag = TRUE;

Clock_create(GpakSchedulingTimer, 1, &clkParams, NULL);

 

To get a rough idea of whether the clock period is set correctly, I compare a 10-second interval as measured on a stopwatch with a 10 second interval measured in software (i.e., hit a breakpoint after 10,000 interrupts). Both counts begin when I set a variable in the watch window.

In addition, each time the periodic function runs, the Timestamp_get32() API function is called and the delta number of ticks between interrupts is computed.

Here are the results I see for two different clock period settings:

Period       time for 10,000 ints         delta-ticks between ints

500         about 10 seconds        425,000

1000        about 18 seconds        850,000

 

I'm trying to understand these results, I first need a few more pieces of information.

The DSP clock PLL configuration is performed by u-boot, and supposedly sets the clock to 500 MHz. I'm unable to find the PLL_DSP configuration registers in the DM8148 datasheet to verify this(tms320dm814x.pdf SPRS647B, September 2011). Where can I find the PLL_DSP register descriptions and their addresses?

I also want to determine the clock source for the timer that was configured when I created the clock. I assume this clock object is also used by SYSBIOS to provide the system tick - is that correct?

Which timer (1-7) does SYSBIOS claim, and is there a guarantee that Linux on the ARM will not use that timer?

Section 2.3.9 of the TMS320DM814x Technical Reference Manual (SPRUGZ8, September 2011) indicates that each timer has an 8-to-1 mux to select its functional clock. The mux is denoted as DMTIMERm_CLKSRC. I'm unable to locate a register or bit-field by that name in either the datasheet or Technical Reference. How can I determine A) which timer SYSBIOS is using, and B)what clock signal is driving the timer?

Does the clock frequency of the timer's functional clock need to be taken into account when configuring the period parameter during clock creation?

I realize I'm asking a lot of questions here, and thank you in advance for your help and patience.

Thanks,

Jim

 

 

 

 

 

  • Hi Jim,

    I can help you to understand all of this better.  First off, the Clock *module* is responsible for generating the system tick ... the config code you  have added above is adding a Clock *instance*.  Clock instances are used to cause a specific function to run after a certain number of clock ticks.

    I think it would be good to verify that the system clock is running correctly first.  Can you try to verify the clock frequency another way?  The SYS/BIOS Clock module has a default of 1ms tick, so this means that the tick should increment by 10,000 if you run for 10 seconds.

    You can see the tick count easily using the tool called ROV (tools -> ROV).  If you navigate to the Clock module, select it and you should see the tick count (in the 'module' tab) and check that after you run for 10 or 20 seconds.

    Do you see the tick incrementing as expected?

    Jim conway said:
    I also want to determine the clock source for the timer that was configured when I created the clock. I assume this clock object is also used by SYSBIOS to provide the system tick - is that correct?

    I believe the default timer used is timer 0.  Using the below table, this would correspond to GPTimer3. (you can find this table in the SYS/BIOS API documentation; for example it's here on my machine: file:///C:/Program%20Files/Texas%20Instruments/bios_6_33_00_07_eng/docs/cdoc/index.html).

    I'll ask another team member to chime in more on your timer questions you had in your post.

    Steve

    TMS320DM8148
    Timer ID Timer Name Timer Base Address
    0 GPTimer3 0x8042000
    1 GPTimer4 0x8044000
    2 GPTimer5 0x8046000
    3 GPTimer6 0x8048000
    4 GPTimer7

    0x804a000

  • Jim,

    Using ROV you can identify which timer is being used as the system tick source for the Clock module by viewing the Timer instances in the Timer module view. Look for the Timer instance who's "tickFxn" is "ti_sysbios_knl_Clock_doTick".

    For the DM8148 devices, SYS/BIOS assumes that the default 32,768Hz clock is routed to the timers. If this is NOT the case, then the Timer module must be informed of the correct frequency. The following code demonstrates how to configure the Timer module for a 20MHz clock source:

     var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');

     Timer.intFreq.lo = 20000000; /* set clock frequency to 20MHz */

    SYS/BIOS purposely avoids the use of GPTimers 0,1,2 to reduce the chance of conflict with the Linux host.

    Alan

  • Alan and Steve,

    I've determined that SYSBIOS is using timerID 0, corresponding to physical timer 3. By inspecting the uboot initialization code where the timer 1 is initialized, I found the address of the DMTIMER_CLKSRC register, and after inspecting the register's contents in CCS, learned that Timer 3's clock source is configured to a value of 4, which appears to specify a 20 MHz clock (according to the uboot comments).

    I subsequently changed the dmtimer's intFreq setting to 20000000 as Alan suggested, and also changed the clock period setting to 1. After these two changes, I receive 10,000 interrupts in 10 seconds, and the delta-number of ticks per interrupt as determined by the Timestamp_get32 ( ) API consistently reads 500, 000 - which is exactly what I expected given a 500 MHz DSP clock.

    Although setting the clock period to 1, gives results that make sense, it's not clear from the SYSBIOS documentation whether the period represents microseconds or milliseconds. Apparently 1 system tick is a milisecond.

    I think my issue has been resolved, but I must say that the documentation for the 814x part is lacking. The addresses and their bit-fields of many important registers are not listed.

    Thanks for your help,

    Jim