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.

CCS/K2GICE: rtos clock speed half of set +

Part Number: K2GICE

Tool/software: Code Composer Studio

Hi

I have set ti rtos clock ticks to 1000 us so 1 ms. Waiting 10000 tics ends up taking 20 s so tick ends up being 2ms. Where things could go wrong.

My GEL file:

Set_Main_Pll(int index)
{
    int i, TEMP;
    unsigned int BYPASS_val;     
    unsigned int BWADJ_val;     
    unsigned int OD_val;            

    float CLKIN_val;
    unsigned int PLLM_val;
    unsigned int PLLD_val;
    unsigned int PLLDIV3_val; //SYSCLK3 - Used to clock the C66x DSP CorePac emulation
    unsigned int PLLDIV4_val; //SYSCLK4 - Used for trace module.
 
    unsigned int debug_info_on;
    unsigned int delay;

    if(_GEL_Global_clkMode == 1)  // Check if external clock mode is selected
    {
        CLKIN_val   = 25;  // setup CLKIN to 25.00 MHz
        PLLM_val    = 96;  // setup PLLM (PLL multiplier) 
    }
    else
    {
        CLKIN_val   = 24;   // setup CLKIN to 24.00 MHz
        PLLM_val    = 100;  // setup PLLM (PLL multiplier)      original 100 fast 164 
    }
    
    if(index == 400){                     
        PLLD_val    = 1;            // setup PLLD (reference divider)
        OD_val      = 6;            // setup OD 
    }
	else if(index == 600){        
        PLLD_val    = 1;            // setup PLLD (reference divider)
        OD_val      = 4;            // setup OD 
    }
	else if(index == 100){            
        PLLD_val    = 2;            // setup PLLD (reference divider)
        OD_val      = 12;           // setup OD 
    }
	else if(index == 200){            
        PLLD_val    = 1;            // setup PLLD (reference divider)
        OD_val      = 12;           // setup OD 
    }

    PLLDIV3_val = 2;            // setup PLL output divider 3 to /2
    PLLDIV4_val = 5;            // setup PLL output divider 4 to /5

    BYPASS_val      = PLL1_SECCTL & ~BYPASS_MASK;   // get value of the BYPASS field
    BWADJ_val       = (PLLM_val-1) >> 1;              // setup BWADJ to be 1/2 the value of PLLM
	
    debug_info_on   = 0;
    delay           = 1000; // fix this!

    /* Step 1: Unlock Boot Config Registers */
    KICK0 = KICK0_UNLOCK;
    KICK1 = KICK1_UNLOCK;

    /* Step 2 - Check the status of BYPASS */
    if(BYPASS_val != 0x00000000){ // PLL bypass enabled - Execute PLL setup for PLL fresh out of power on reset
        if(debug_info_on){
            GEL_TextOut("Detected PLL bypass enabled: SECCTL[BYPASS] = %x\n",,,,, BYPASS_val);
        }
	
        /* Step 2a: Set MAINPLLCTL1[ENSAT] = 1 - This enables proper biasing of PLL analog circuitry */                  
        MAINPLLCTL1 |= (1 << MAIN_ENSAT_OFFSET); 
        if(debug_info_on){
            GEL_TextOut("(2a) MAINPLLCTL1 = %x\n",,,,, MAINPLLCTL1);
        }        

        /* Step 2b: Set PLLCTL[PLLEN] = 0 This enables bypass in PLL controller MUX *///PLLEN_OFFSET = 0 
        PLL1_PLLCTL &= ~(1 << PLLEN_OFFSET);        
        if(debug_info_on){    
            GEL_TextOut("(2b) PLLCTL = %x\n",,,,, PLL1_PLLCTL);
        }    

        /* Step 2c: Set PLLCTL[PLLENSRC] = 0 - This enables PLLEN to control PLL controller MUX */    
		//PLLENSRC_OFFSET = 5
        PLL1_PLLCTL &= ~(1 << PLLENSRC_OFFSET);
        if(debug_info_on){    
            GEL_TextOut("(2c) PLLCTL = %x\n",,,,, PLL1_PLLCTL);
        }    

        /* Step 2d: Wait 4 reference clock cycles (slowest of ALTCORE or SYSCLK) to make sure 
           that the PLL controller MUX switches properly to bypass. */
        if(debug_info_on){    
            GEL_TextOut("(2d) Delay...\n",,,,,);
        }        
        //Step 2d - Wait 4 cycles of the reference clock (to make sure the PLL controller mux switches properly to the bypass)		
        for(i = 0; i < delay; i++); // this delay is much more than required         

        /* Step 2e: Set SECCTL[BYPASS] = 1 - enables bypass in PLL MUX */    
		//BYPASS_OFFSET = 23
        //Step 2e - In SECCTL, write BYPASS = 1		
        PLL1_SECCTL |= (1 << BYPASS_OFFSET);        
        if(debug_info_on){    
            GEL_TextOut("(2e) SECCTL = %x\n",,,,, PLL1_SECCTL);
        }    

        /* Step 2f: Set PLLCTL[PLLPWRDN] = 1 - power down the PLL */      
		//PLLPWRDN_OFFSET = 1
        //Step 2f - In PLLCTL, write PLLPWRDN = 1		
        PLL1_PLLCTL |= (1 << PLLPWRDN_OFFSET);
        if(debug_info_on){    
            GEL_TextOut("(2f) PLLCTL = %x\n",,,,, PLL1_PLLCTL);
        }    

        /* Step 2g: Wait for at least 5us for the PLL to power down */
        if(debug_info_on){    
            GEL_TextOut("(2g) Delay...\n",,,,,);
        }    
        //Step 2g - Wait for at least 5 us		
        for(i = 0; i < delay; i++); // this delay is much more than required 

        /* Step 2h: Set PLLCTL[PLLPWRDN] = 0 - Power the PLL back up */    
		//PLLPWRDN_OFFSET = 1
        //Step 2h - In PLLCTL, write PLLPWRDN = 0		
        PLL1_PLLCTL &= ~(1 << PLLPWRDN_OFFSET);
        if(debug_info_on){    
            GEL_TextOut("(2h) PLLCTL = %x\n",,,,, PLL1_PLLCTL);
        }            

    }
    else{ // PLL bypass disabled - Execute PLL setup for PLL that has previously been locked (skip to Step 3)
	
        if(debug_info_on){    
            GEL_TextOut("Detected PLL bypass disabled: SECCTL[BYPASS] = %x\n",,,,, BYPASS_val);
        }

        /* Step 3a: Set PLLCTL[PLLEN] = 0 This enables bypass in PLL controller MUX *///PLLEN_OFFSET = 0        
        PLL1_PLLCTL &= ~(1 << PLLEN_OFFSET);        
        if(debug_info_on){    
            GEL_TextOut("(3a) PLLCTL = %x\n",,,,, PLL1_PLLCTL);
        }    

        /* Step 3b: Set PLLCTL[PLLENSRC] = 0 - This enables PLLEN to control PLL controller MUX */    
		//PLLENSRC_OFFSET = 5
        PLL1_PLLCTL &= ~(1 << PLLENSRC_OFFSET);
        if(debug_info_on){    
            GEL_TextOut("(3b) PLLCTL = %x\n",,,,, PLL1_PLLCTL);
        }

        /* Step 3c: Wait 4 reference clock cycles (slowest of ALTCORE or SYSCLK) to make sure that the PLL controller MUX switches properly to bypass. */
        if(debug_info_on){    
            GEL_TextOut("(3c) Delay...\n",,,,,);
        }        
        for(i = 0; i < delay; i++); // this delay is much more than required       
	
    }

    /* Step 3 - PLLCTL, write PLLRST = 1 (PLL is reset) */
	PLL1_PLLCTL |= (1 << PLLRST_OFFSET);

    /* Step 4: Programming PLLM[5:0] in the PLLM register of the PLL controller and
       programming PLLM[12:6] in the MAINPLLCTL0 register */        	
    PLL1_PLLM &= PLLM_MASK;             // clear the PLLM[5:0] bit field

    //Step 4a - PLLM in PLLM	
	PLL1_PLLM |= ~PLLM_MASK & (PLLM_val - 1);   // set the PLLM[5:0] bit field to the 6 LSB of PLLM_val
	
    if(debug_info_on){
        GEL_TextOut("(4)PLLM[PLLM] = %x\n",,,,, PLL1_PLLM);
    }    
	  
	//MAIN_PLLM_MASK = 0xFFF80FFF
	//MAIN_PLLM_OFFSET = 12
	MAINPLLCTL0 &= MAIN_PLLM_MASK;      // clear the PLLM[12:6] bit field
    //Step 4b - PLLM in MAINPLLCTL0	
    MAINPLLCTL0 |= ~MAIN_PLLM_MASK & (( (PLLM_val - 1) >> 6) << MAIN_PLLM_OFFSET);  // set the PLLM[12:6] bit field to the 7 MSB of PLL_val

    if(debug_info_on){
        GEL_TextOut("MAINPLLCTL0 = %x\n",,,,, MAINPLLCTL0);
    }

    /* Step 5: Programming BWADJ[7:0] in the MAINPLLCTL0 register and BWADJ[11:8] in MAINPLLCTL1 register */            
    MAINPLLCTL0 &= MAIN_BWADJ0_MASK;    // clear the MAIN_BWADJ0 bit field
	//BWADJ_val = (PLLM_val) >> 1;
	//MAIN_BWADJ0_MASK = 0x00FFFFFF		
    //Step 5a - BWADJ in MAINPLLCTL0
    MAINPLLCTL0 |= ~MAIN_BWADJ0_MASK & ((BWADJ_val - 1) << MAIN_BWADJ0_OFFSET); // set the MAIN_BWADJ[7:0] bit field to the 8 LSB of BWADJ_val
	//~MAIN_BWADJ0_MASK  = 0xFF000000
    if(debug_info_on){
        GEL_TextOut("(5) MAINPLLCTL0 = %x\n",,,,, MAINPLLCTL0);
    }

    MAINPLLCTL1 &= MAIN_BWADJ1_MASK;    // clear the MAIN_BWADJ1 bit field
	//MAIN_BWADJ1_MASK = 0xFFFFFFF0
	//Step 5b - BWADJ in MAINPLLCTL1
    MAINPLLCTL1 |= ~MAIN_BWADJ1_MASK & (( (BWADJ_val - 1) >> 8) << MAIN_BWADJ1_OFFSET); // set the MAIN_BWADJ[11:8] bit field to the 4 MSB of BWADJ_val

    if(debug_info_on){
        GEL_TextOut("(5) MAINPLLCTL1 = %x\n",,,,, MAINPLLCTL1);
    }
	
    /* Step 6: Programming PLLD[5:0] in the MAINPLLCTL0 register */            
    MAINPLLCTL0 &= MAIN_PLLD_MASK;      // clear the PLLD bit field
	//MAIN_PLLD_MASK = 0xFFFFFFC0
		
    //Step 6 - Program PLLD in MAINPLLCTL0    
	MAINPLLCTL0 |= ~MAIN_PLLD_MASK & (PLLD_val - 1);    // set the PLLD[5:0] bit field of PLLD to PLLD_val

    if(debug_info_on){
        GEL_TextOut("(6) MAINPLLCTL0 = %x\n",,,,, MAINPLLCTL0);
    }

    /* Step 7: Programming OD[3:0] in the SECCTL register */            
    PLL1_SECCTL &= OUTPUT_DIVIDE_MASK;  // clear the OD bit field
	//OUTPUT_DIVIDE_OFFSET = 19
	// OUTPUT_DIVIDE_MASK = 0xFF87FFFF
	//~OUTPUT_DIVIDE_MASK = 0x00780000
	//0x00810000 & 0xFF87FFFF = 0x00810000
    //Step 7 - In SECCTL, write OD = 1 (divide by 2)	
	    PLL1_SECCTL |= ~OUTPUT_DIVIDE_MASK & (OD_val - 1) << OUTPUT_DIVIDE_OFFSET;  // set the OD[3:0] bit field of PLLD to OD_val    

    if(debug_info_on){
        GEL_TextOut("(7) SECCTL = %x\n",,,,, PLL1_SECCTL);
    }
	
    /* Step 8: Following steps are needed to change the default output dividers */            

    /* Step 8a: Check that the GOSTAT bit in PLLSTAT is cleared to show that no GO
       operation is currently in progress*/
    if(debug_info_on){    
        GEL_TextOut("(8a) Delay...\n",,,,,);
    }    
	
    //Step 8a - Check that the GOSTAT bit in PLLSTAT
    while((PLL1_STAT) & 0x00000001);

    /* Step 8b: Program the RATIO field in PLLDIVn to the desired new divide-down rate.
       If RATIO field is changed, the PLL controller will flag the change in the
       corresponding bit of DCHANGE*/
    //Step 8b - Program the RATIO field in PLLDIVn	
    PLL1_DIV3 = (PLLDIV3_val-1) | 0x8000;  //Set PLLDIV3 
	PLL1_DIV4 = (PLLDIV4_val-1) | 0x8000;  //Set PLLDIV4
	
    if(debug_info_on){
        GEL_TextOut("PLL1_DIV3 = %x\n",,,,, PLL1_DIV3);
        GEL_TextOut("PLL1_DIV4 = %x\n",,,,, PLL1_DIV4);
    }

    /* Step 8c: Set GOSET bit in PLLCMD to initiate the GO operation to change the divide
       values and align the SYSCLKs as programmed */
	PLL1_ALNCTL |= ((1 << 2) | (1 << 3)); // SYSCLK3 & SYSCLK4   
	   
    /* Step 8d - Set the GOSET bit in PLLCMD */
    PLL1_CMD |= 0x00000001;

    /* Step 8e: Read the GOSTAT bit in PLLSTAT to make sure the bit returns to 0 to
      indicate that the GO operation has completed */
    if(debug_info_on){    
        GEL_TextOut("(8e) Delay...\n",,,,,);
    }    
    //Step 8e - Read the GOSTAT bit in PLLSTAT to make sure the bit returns to 0 to indicate that the GO operation has completed.
    while((PLL1_STAT) & 0x00000001);
    
     /* Step 9: Wait for the at least 7us for the PLL reset properly (128 CLKIN1 cycles) */        
    if(debug_info_on){    
        GEL_TextOut("(9) Delay...\n",,,,,);
    }    
	
	//Step 9 - Wait for at least 7 us
    for(i=0;i<delay;i++);
	
    //Step 10 - In PLLCTL, write PLLRST = 0 (PLL reset is released)    
	PLL1_PLLCTL &= ~(1 << PLLRST_OFFSET);

    /* Step 11: Wait for PLL to lock (2000 CLKIN1 cycles) */
    if(debug_info_on){    
        GEL_TextOut("(11) Delay...\n",,,,,);
    }    
	
    //Step 11 - Wait for at least 500 * CLKIN cycles * (PLLD + 1) (PLL lock time)    
	for(i=0;i<delay;i++);

    //Step 12 - In SECCTL, write BYPASS = 0 (enable PLL mux to switch to PLL mode)	
    PLL1_SECCTL &= ~(1 << BYPASS_OFFSET);        
    if(debug_info_on){    
        GEL_TextOut("(12) SECCTL = %x\n",,,,, PLL1_SECCTL);
    }    

    //Step 13 - In PLLCTL, write PLLEN = 1 (enable PLL controller mux to switch to PLL mode)	
    PLL1_PLLCTL |= (1 << PLLEN_OFFSET);        
    if(debug_info_on){    
        GEL_TextOut("(13) PLLCTL = %x\n",,,,, PLL1_PLLCTL);
    }    

    /* Lock Boot Config Registers */
    KICK0 = 0x00000000;
    KICK1 = 0x00000000;

    //GEL_TextOut("PLL has been configured (CLKIN * PLLM / PLLD / PLLOD = PLLOUT):\n",,,,,);
    GEL_TextOut("C66x PLL has been configured (%f MHz * %d / %d / %d = %f MHz)\n",,,,, CLKIN_val, PLLM_val, PLLD_val, OD_val,(CLKIN_val * PLLM_val / PLLD_val / OD_val) );
}

part of main:

void myClockB(UArg arg1)
{
    // my periodic timer. arg1 will be 'B'
    // do processing...
    Log_write1(UIABenchmark_stop, (xdc_IArg)"1000");
    GPIO_toggle(USER_LED0);
    Log_write1(UIABenchmark_start, (xdc_IArg)"1000");
    return;
}


/*
 *  ======== main ========
 */
int main()
{
    Board_initGPIO();

    // GPIO initialization
    GPIO_init();

    // Set the callback function
    GPIO_setCallback(USER_LED0, AppGpioCallbackFxn);
    GPIO_setCallback(USER_LED1, AppGpioCallbackFxn);

    // Enable GPIO interrupt on the specific gpio pin
    GPIO_enableInt(USER_LED0);
    GPIO_enableInt(USER_LED1);

    Clock_Params clockParams;
    Clock_Params_init (&clockParams);
    clockParams.period = 10000;
    clockParams.startFlag = TRUE;
    clockParams.arg = 'B';
    myclock = Clock_create(myClockB, 10, &clockParams, Error_IGNORE);
    m

    /* Start BIOS */
    BIOS_start();
    return (0);

}

and on conf i have set:

Clock.tickPeriod = 1000;
Clock.timerId = -1;
Clock.tickSource = Clock.TickSource_TIMER;

  • Hi,
    Can you share the .cfg file in your project?
    Best Regards,
    Yordan

  • Hi yes:

    var Defaults = xdc.useModule('xdc.runtime.Defaults');
    var Diags = xdc.useModule('xdc.runtime.Diags');
    var Error = xdc.useModule('xdc.runtime.Error');
    var Log = xdc.useModule('xdc.runtime.Log');
    var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
    var Main = xdc.useModule('xdc.runtime.Main');
    var Memory = xdc.useModule('xdc.runtime.Memory')
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    var System = xdc.useModule('xdc.runtime.System');
    var Text = xdc.useModule('xdc.runtime.Text');
    
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    var Swi = xdc.useModule('ti.sysbios.knl.Swi');
    var Task = xdc.useModule('ti.sysbios.knl.Task');
    var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
    var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
    var Timer = xdc.useModule('ti.sysbios.hal.Timer');
    var ti_sysbios_timers_timer64_Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
    
    /*
     * Uncomment this line to globally disable Asserts.
     * All modules inherit the default from the 'Defaults' module.  You
     * can override these defaults on a per-module basis using Module.common$. 
     * Disabling Asserts will save code space and improve runtime performance.
    Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
     */
    
    /*
     * Uncomment this line to keep module names from being loaded on the target.
     * The module name strings are placed in the .const section. Setting this
     * parameter to false will save space in the .const section.  Error and
     * Assert messages will contain an "unknown module" prefix instead
     * of the actual module name.
    Defaults.common$.namedModule = false;
     */
    
    /*
     * Minimize exit handler array in System.  The System module includes
     * an array of functions that are registered with System_atexit() to be
     * called by System_exit().
     */
    System.maxAtexitHandlers = 4;       
    
    /* 
     * Uncomment this line to disable the Error print function.  
     * We lose error information when this is disabled since the errors are
     * not printed.  Disabling the raiseHook will save some code space if
     * your app is not using System_printf() since the Error_print() function
     * calls System_printf().
    Error.raiseHook = null;
     */
    
    /* 
     * Uncomment this line to keep Error, Assert, and Log strings from being
     * loaded on the target.  These strings are placed in the .const section.
     * Setting this parameter to false will save space in the .const section.
     * Error, Assert and Log message will print raw ids and args instead of
     * a formatted message.
    Text.isLoaded = false;
     */
    
    /*
     * Uncomment this line to disable the output of characters by SysMin
     * when the program exits.  SysMin writes characters to a circular buffer.
     * This buffer can be viewed using the SysMin Output view in ROV.
    SysMin.flushAtExit = false;
     */
    
    /*
     * The BIOS module will create the default heap for the system.
     * Specify the size of this default heap.
     */
    //BIOS.heapSize = 0x1000;
    
    /*
     * Build a custom SYS/BIOS library from sources.
     */
    BIOS.libType = BIOS.LibType_Custom;
    
    /* System stack size (used by ISRs and Swis) */
    Program.stack = 0x2000;
    
    /* Circular buffer size for System_printf() */
    SysMin.bufSize = 0x200;
    var Memory                      =   xdc.useModule('xdc.runtime.Memory');
    var BIOS                        =   xdc.useModule('ti.sysbios.BIOS');
    var HeapMem                     =   xdc.useModule('ti.sysbios.heaps.HeapMem');
    var HeapBuf                     =   xdc.useModule('ti.sysbios.heaps.HeapBuf');
    var Log                         =   xdc.useModule('xdc.runtime.Log');
    var Task                        =   xdc.useModule('ti.sysbios.knl.Task');
    var Semaphore                   =   xdc.useModule('ti.sysbios.knl.Semaphore');
    var CpIntc                      =   xdc.useModule('ti.sysbios.family.c66.tci66xx.CpIntc');
    var Hwi                         =   xdc.useModule('ti.sysbios.family.c64p.Hwi');
    var ECM                         =   xdc.useModule('ti.sysbios.family.c64p.EventCombiner');
    var core                        =   xdc.useModule('ti.sysbios.hal.Core');
    
    var devType = "k2g"
    
    /* Load the OSAL package */ 
    var osType = "tirtos"
    var Osal = xdc.useModule('ti.osal.Settings');
    Osal.osType = osType;
    Osal.socType = devType;
    
    /*use CSL package*/
    var Csl = xdc.loadPackage('ti.csl');
    Csl.Settings.deviceType = devType;
    
    /* Load the Board package and set the board name */
    var Board = xdc.loadPackage('ti.board');
    Board.Settings.boardName = "iceK2G";
    
    /* Load Profiling package */
    var Utils = xdc.loadPackage('ti.utils.profiling');
    
    /* Load the gpio package */
    var Gpio = xdc.loadPackage('ti.drv.gpio');
    Gpio.Settings.enableProfiling = true;    
    Gpio.Settings.socType = devType;
    
    /* Load the uart package */
    var Uart = xdc.useModule('ti.drv.uart.Settings');
    Uart.socType = devType;
    
    var System                      =   xdc.useModule('xdc.runtime.System');
    SysStd                          =   xdc.useModule('xdc.runtime.SysStd');
    System.SupportProxy             =   SysStd;
    
    /* Load and use the CSL packages */
    var Csl                         = xdc.useModule('ti.csl.Settings');
    Csl.deviceType                  = devType;
    
    /* Create a default system heap using ti.bios.HeapMem. */
    var heapMemParams1              =   new HeapMem.Params;
    heapMemParams1.size             =   8192 * 25;
    heapMemParams1.sectionName      =   "systemHeap";
    Program.global.heap0            =   HeapMem.create(heapMemParams1);
    
    
    /* No runtime stack checking is performed */
    Task.checkStackFlag             = false;
    
    
    /* Reduce the number of task priorities */
    Task.numPriorities              = 4;
    
    /* This is the default memory heap. */
    Memory.defaultHeapInstance      =   Program.global.heap0;
    
    Program.sectMap["systemHeap"]   =   Program.platform.stackMemory;
    Program.sectMap[".fardata:benchmarking"] = "DDR3";
    
    /* ================ Task configuration ================ */
    //var task0Params                 = new Task.Params();
    //task0Params.instance.name       = "echo";
    //task0Params.stackSize           = 0x1000;
    //Program.global.echo             = Task.create("&gpio_test", task0Params);
    
    /* 
     * Create and install logger for the whole system
    var loggerBufParams = new LoggerBuf.Params();
    loggerBufParams.numEntries = 16;
    var logger0 = LoggerBuf.create(loggerBufParams);
    Defaults.common$.logger = logger0;
    Main.common$.diags_INFO = Diags.ALWAYS_ON; */
    
    var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
    var UIABenchmark = xdc.useModule('ti.uia.events.UIABenchmark');
    LoggingSetup.sysbiosSwiLogging = true;
    LoggingSetup.sysbiosHwiLogging = true;
    var Load = xdc.useModule('ti.sysbios.utils.Load');
    
    System.SupportProxy = SysMin;
    
    LoggingSetup.benchmarkLogging = true;
    LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE;
    LoggingSetup.countingAndGraphingLogging = true;
    LoggingSetup.snapshotLogging = true;
    Clock.tickPeriod = 1000;
    Clock.timerId = -1;
    Clock.tickSource = Clock.TickSource_TIMER;

  • Hi

    Did the .cfg file i sent to you clear thing out?

  • Hi Tommi,

    Sorry for the late reply. Yes, I've inspected the cfg file and it seems correct. I am not sure what the problem might be. I am checking this internally with the team.

    Best Regards,
    Yordan

  • Hi, thanks

    If this helps I noticed that cahnging DSP clock speed by changing PLLM_val from gel file directly changes the timing.

  • Tommi,

    This is a common issue observed with TI RTOS code when the CPU frequency expected by SYSBIOS doesn`t match with the physical PLL setting. If you look at your project settings, you will notice that the platform setup looks like following.

    The default clock setting assumed by SYSBIOS is provided in the platform files specified in the following location:

    bios_6_7x_xx_xx\packages\ti\platforms\evmTCI66AK2G02\Platform.xdc

    The Default clock rate  for DSP in that seems to be set for 1220 MHz which is nearly twice the speed of 600 Mhz that may be set in GEL file.for the platform sets up.

    The clockrate specified in platform can be over riden from the BIOS configuration (.cfg) using the following:

    var BIOS        = xdc.useModule ("ti.sysbios.BIOS");
    BIOS.cpuFreq.lo = 600000000;

    The other thing that may be impacting the clock set is that the timer64 setup. If you look at the device clocking on K2G the timer is clocked using CHIP_CLK1/6 which is MAin PLL/6 = 100 Mhz.  BAsed on platform setup it will be 1220/6 =203 where as physically in the SOC it is 600/6 = 100 Mhz

    I would also add the following to the BIOS configuration:

    // Change Timer frequency
    // Set Timer64 freq to 100MHz
    var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
    for (var idx = 0; idx < 7; idx++) {
        Timer.intFreqs[idx].lo = 100000000;
        Timer.intFreqs[idx].hi = 0;
    }

    Please make the following updates and let me know if it fixes your issue.

    Regards,

    Rahul

    PS: We have explained this in the TI RTOS Tips and Tricks section of the Processor SDK RTOS software developers guide but my response above is customized for the DSP on K2G SOC that you are using for evaluation

    http://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_how_to_guides.html#how-to-get-accurate-clock-ticks-from-the-clock-module