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.

about C6678 timer interrupts

Hello ,

everyone

I have a question about timer interrupts on C6678 .

I'm trying to set a timer interrupt on C6678, but i don't know how to do it . please help me , Thanks!

your sincerely

Bin Chen

  • Have You already view the example in the PDK (<your-ccs-dir>\pdk_C6678_1_0_0_12\packages\ti\csl\example\timer) ?

  • Thanks, Alberto Chessa

    yes i do, but there are a lot of question. Would you mind give me a sample simple example about timer interrupts.

    Thanks!

    sincerely

    Bin Chen

  • Hi,

    Can You specifcy better your question? Your question are about the interrupt/event mapping and handling or timer programming?

  • Hi,

    Alberto Chessa

    My queation is that how can i set the timer interrupt  speed rate

    Thanks!

    sincerely

    Bin chen

  • Hi,

    If you look at the routine test_high_continuous_timer() in example timer_test.c you can see that CSL_tmrHwControl(hTmr, CSL_TMR_CMD_LOAD_PRDHI, (void *)&LoadValue) is used to set the period.

    In spru818b you can find detail on how calculate the right period. I have to admit that so far I have some problem i ncalculating the right value for the required period. Anyway, I obtained a 10ms periodic interrupt by programming it in unchained 32 bits, low counter enable, internal clock use and a period low of 0x00196E64. I program it directly, so I can  only guess how to setup it with the CSL:

        CSL_TmrHwSetup              hwSetup = CSL_TMR_HWSETUP_DEFAULTS;

        CSL_TmrEnamode              TimeCountMode = CSL_TMR_ENAMODE_CONT;

        hTmr =  CSL_tmrOpen(&TmrObj, IntcInstance, NULL, &status);
        CSL_tmrHwSetup(hTmr, &hwSetup); /* Open the timer with the defaults. */
        CSL_tmrHwControl(hTmr, CSL_TMR_CMD_RESET_TIMHI, NULL); /* Stop the Timer */
        CSL_tmrHwControl(hTmr, CSL_TMR_CMD_RESET_TIMLO, NULL); /* Stop the Timer */
         
        /* Set the timer mode to unchained dual mode */
        hwSetup.tmrTimerMode = CSL_TMR_TIMMODE_DUAL_UNCHAINED;
        CSL_tmrHwSetup(hTmr, &hwSetup);

        unsigned long LoadValue=0;
        CSL_tmrHwControl(hTmr, CSL_TMR_CMD_LOAD_PRDHI, (void *)&LoadValue);


        LoadValue=0x00196E64;   //<--------------- set-up a 10ms period

        CSL_tmrHwControl(hTmr, CSL_TMR_CMD_LOAD_PRDLO, (void *)&LoadValue);

        CSL_tmrHwControl(hTmr, CSL_TMR_CMD_START_TIMLO, (void *)&TimeCountMode);
        ....

    The event and interrupt canbe enable as timer_test.c.

  • Hi.

    Alberto chessa

    This question has been solved already.

    Thank you very much!

    sincerely

    Bin Chen