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.

C5535 TIMCNT1 register access (write) while timer is running

Hello,

I wonder if it is possible to update "manualy" the counter value TIMCNT1 while the timer is running.

Using CSL, I've check that it was possible to read it, but I don't find anything to update/write any value to it.

I am using the ezc5535 evm.

Thanks for your help,

Nicolas

  • Hi Nicolas,

    It is not possible to write to the Timer Counter Register ever.

    The way to put a new value into the TIMCNT1 is to write TIMPRD1 with the value desired, then clear the START bit of TCR to stop the countdown, then set the START bit of TCR to load value from TIMPRD1 into TIMCNT1 and start the counter counting down again.

    Similarly, I believe you could modify the TIMPRD1 during timer execution, then with autoreload mode enabled, the timer will load the new value into TIMCNT1 after the timer counts down and autoreloads.

    See Section 5.2.2 Using the 32-bit General Purpose Timer in the C5535 Technical Reference Manual:

    When the START bit is set to 1 in the TCR, the contents of the Timer Period Registers (TIMPRD1 and
    TIMPRD2) are loaded into the concatenated Timer Counter Registers (TIMCNT1 and TIMCNT2) and the
    timer starts to count down with every cycle of the prescale divided clock. When TIMCNT1 and TIMCNT2
    reach 0, the timer sends an interrupt request (TINT) to the CPU and a DMA event to the four DMAs.

    Hope this helps,
    Mark

  • Hi Mark,

    Thanks for these information. I know that it is nevertheless possible to update TIMCNT register while timer is running on other MCUs.

    We have used your proposal it works.

    Thanks.

    Nicolas