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.

Clock_create() less than 1 msec

Other Parts Discussed in Thread: SYSBIOS

Hi, I'm still studying SYS/BIOS with EVM6678. :)

This time I want to create timer module in C code rather than in .cfg.

The following code is what I made to do 'clock_create.

    Clock_Params clkprms;
    Clock_Handle clkOBJ;
    Error_Block eb;

    platform_write("enter main()\n");

    Error_init(&eb);
    Clock_Params_init(&clkprms);
    clkprms.period = 1; //in msec
    clkprms.startFlag = TRUE;
    clkprms.arg = (UArg)0x5555;
    clkOBJ = Clock_create(clk_handler_function, 10, &clkprms, &eb);
    if (clkOBJ == NULL) {
     platform_write("clock_create() failed!\n");
        BIOS_exit(0);
    }
    else {
     platform_write("clock_create() succeeded\n");
    }

Here I have some questions.

1. What if I want to create a clock that the time tick is less than 1 msec?

2. I adopted some lines from an example.    But I don't know the meaning of "clkprms.arg = (UArg)0x5555;"

    Does anyone know what it is?

3.  in the statement "clkOBJ = Clock_create(clk_handler_function, 10, &clkprms, &eb);" , what is '10' means?

I tried to find answers here but I couldn't.

Please answer my questions or let me know the links if they were answered already.

Thank you. :)

  • 1. The tick period for Clock would need to be changed to be smaller than 1 msec. You can change the 'Clock.tickPeriod' at static config time. See the following post for some suggestions:
    e2e.ti.com/.../1471981

    2. clkprms.arg is the argument for the clock function. You could pass in an argument that you specifiy when your clock function is called.

    3. The '10' is the timeout value for one-shot timers or delay value. See the SYSBIOS cdoc that comes with the installation for more info.

    Judah
  • Thank you for your reply.

    1.

    I have found that there is a 'extern const' variable whose name is 'Clock_tickPeriod'.

    This constant is in a automatically generated .c file like 'my_project_name_pe66.c' somewhere in the project (sub)folder.

    I will try to change the value and see what will happen.

    2.

    Thank you for your answer. Now I understand that it is an optional argument that I can use when I need it.

    3. 

    I see. Maybe it makes some delay to call 'clk_handler_function' from the time when the clock module starts.

    Thank you for your clarification.

    James

  • Hi, I don't know the meanings of 'Verify Answer' and 'Suggested Answer' etc.
    I clicked the 'Suggest as answer'. I don't know it made ths question answered. :)
    I'm new to this E2E forum.
  • 1.
    I tried change the clock_tickPeriod in 'my_project_name_pe66.c' and cleaned and rebuilded the project.
    But the automatically created .c file ('my_project_name_pe66.c') was created again and it didn't make any change.
    The answer was insert some lines in .cfg file.

    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    Clock.tickPeriod = 2000;
    //in usec

    I think TI should explain this in the SYS/BIOS Manual.
  • "Verify Answer" - is when someone answers your question, then you click "Verify Answer".
    "Suggested Answer" - is just that...a suggest answer.

    If you look in the 'cdoc' documentation for SYSBIOS, we do mention 'Clock.tickPeriod'.