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.

RTOS/TM4C1292NCPDT: Timer configuration

Part Number: TM4C1292NCPDT


Tool/software: TI-RTOS

Hi,

I configured a timer for my application as shown below.

By default this timer is configured as 32 bit, right?

I want a period upto 65 seconds. I set period 65535000 using the function Timer_setPeriodMicroSecs(). But after 32 seconds, timeout occurs. When period is upto 32768000, timer works as expected. Do I need to do any other configuration to get period upto 65 seconds?

I use CCS v7.4.0 , TI RTOS v2.16.01.14 and TivaWare_C_Series-2.1.4.178.

Thanks

Sandra

  • Sorry, I am attaching configuration file now.

     project.cfg

  • Hi,


    When you use the function call Timer_setPeriodMicroSecs(), check the return value. If it is false, it means that timer period register cannot support the requested period.

    If i assume that you are running at 120 Mhz, I think that issue is due to the fact that total count for your requirement would be
    = 65535000 x 120 = 7864200000; which is more that what a 32 bit register can hold (4294967296).

    BTW, why dont you try the period filed in Timer's GUI (which you have kept 1 right now) ?

    BR,
    Pranav.
  • Hi Pranav,

    Pranav Saraswala said:

    If i assume that you are running at 120 Mhz

    Yes. we are running at 120Mhz. how this is frequency is going to relate directly with Timer_setPeriodMicroSecs() API count. here if the frequency is 120MHz then the time is about 8.33nano second. 65535000 * 8.33 = 545906550 still within the boundary only.

    meanwhile I have tried increasing the timer period to 1000 also. but it still its not going beyond the limit.

    Regards

    Sandra

  • The value that is loaded in timer count register by function Timer_setPeriodMicroSecs() depends on what frequency you are running at.
    At 120Mhz, for period of 1 microsec, clock cycle (and timer count) required are 120. As such, for period of 65,000,000 microsec (65 sec), you need count of 65,000,000x120 = 7800,000,000. This much count cannot be accommodated in 32 bit register.
    Did you checked return value of your function call Timer_setPeriodMicroSecs() ?

    The calculation you did above is erroneous; give it a though for a moment and you will understand.

    In my above post, when i said that try period filed, you need to put in exact no. of microsecs in that field. Using this field in GUI, you no more need to call function Timer_setPeriodMicroSecs(). It is easier way to define timer period.

    If you want higher time delay, i would suggest you to use unit of field period to be 'clock' instead of 'period in microsecs'.
    In that case, you will have to add 'clock' module in your application.
    Go through this video to learn how to use clock module of RTOS: training.ti.com/ti-rtos-workshop-series-7-10-using-clk

    BR,
    Pranav.
  • Hi Pranav,

    Pranav Saraswala said:
    Did you checked return value of your function call Timer_setPeriodMicroSecs() ?

    Yes. we tried and its returning error.

    Pranav Saraswala said:
    In that case, you will have to add 'clock' module in your application.

    Thank you for your suggestion. by changing to clock module its works fine for higher timer value.

    Regards,

    Sandra