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.

C6670 1ms clock

Other Parts Discussed in Thread: SYSBIOS

I am trying to configure a 1ms system clock for:

-         TMDSEVM6670LE,

-         XDS560V2 mezzanine

-         CCS6.0

-         Sysbios 6_33_06_50

The example below runs for 60s if the clock period is set up correctly at 1ms.  In the .cfg file provided with the original example, a clock is defined with Tick Period (us)=1000, and no timer is defined.  Using these settings, the clock is updated every 8ms instead of 1ms measured by the time it takes the example to run to completion.  If I change the clock Tick Period(us) to 122 instead of 1000, the clock is updated approximately every 1ms, and the example runs for 60s as it should.

// Simplified example from bios_6_33_06_50\packages\ti\sysbios\examples\generic\clock\clock.

Void main()
{
    Clock_Handle clk1; 
    Clock_Params clkParams;

    Clock_Params_init(&clkParams);
    clkParams.period = 0;
    clkParams.startFlag = FALSE;
    clk1 = Clock_create(clk1Fxn, 60000, &clkParams, NULL);

    Clock_start(clk1);

    BIOS_start();

}

Void clk1Fxn(UArg arg0)

{

    UInt32 time;

    time = Clock_getTicks();

    System_printf("System time in clk1Fxn = %lu\n", (ULong)time);

    System_printf("Calling BIOS_exit() from clk1Fxn\n");

    BIOS_exit(0);

}

I haven't found an explanation of how a timer is connected to a clock in SysBios references.  I'm especially interested in eventually setting up the 1ms clock in startup code without using a .gel file.

Questions:

  1. How does changing Tick Period(us) from 1000 to 122 in the example produce a clock period of 1ms?
  2. Which timer does SysBios use as the default if a timer isn't specified?
  3. Where is this default timer configured in SysBios?
  4. If SysBios uses the timer configuration in evmc6670l.gel, where does it read these values?
  • Hi Henlee,

    Documentation for the Clock module can be found here.

    henlee said:
    1. How does changing Tick Period(us) from 1000 to 122 in the example produce a clock period of 1ms?

    The Clock_tickPeriod specifies how many microsecond for each Clock tick.  If you want to set a clock period to 1ms, you need to set it in the clockParams.period field to the appropriate number of clock ticks.

        Clock_Handle clk1; 
        Clock_Params clkParams;
    
        Clock_Params_init(&clkParams);

    // assuming Clock_tickPeriod = 1000 microseconds. clkParams.period = 1; // Clock will timeout every 1 tick. ...

    The default for the Clock module is to operate in one-shot mode.  If you want the Clock to timeout every 1ms you will need to set the Clock module to periodic mode in your .cfg file: 

    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    
    // Tell the Clock module to use TickMode_PERIODIC
    Clock.tickMode = Clock.TickMode_PERIODIC;

    henlee said:
    1. Which timer does SysBios use as the default if a timer isn't specified?

    By default, SYS/BIOS is set to use any timer not already used by your code.  Warning, this has changed in later releases.  You can manually assign one in the .cfg file with:

    Clock.timerId = 2;

    henlee said:
    1. Where is this default timer configured in SysBios?

    The clock module configures the timer.  You need only to use the clock module.  

    henlee said:
    1. If SysBios uses the timer configuration in evmc6670l.gel, where does it read these values?

    Either a bootloader or a gel file must be used to enable the clocks.  SYS/BIOS requires these peripherals to be enabled before running.