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.

EK-TM4C1294XL: Timer Cofiguration

Part Number: EK-TM4C1294XL


Hello TI,

I am trying to generate 1ms Interrupt frequency with a 16bit Timer, but I am not getting 1ms. Could you please let me know if there is something wrong with my prescaler and Load set?

    TimerConfigure(TIMER5_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_PERIODIC );
    TimerPrescaleSet(TIMER5_BASE, TIMER_B, 240);      
    TimerLoadSet(TIMER5_BASE, TIMER_B, 500);

and is there any possible way to check if the timer is configured correctly?

Thanks alot for you support!

Br

  • Those values worked for me. Did you configure the system clock for 120 MHz? What rate are you getting?

  • Hello Bob,

    thats right, my system clock is running on 120MHz.

    The thing is that I am running Timer 0 and Timer 5 parallel each with the different interrupt frequency.

    Timer 0 with 1ms and Timer 5 with 100ms. But they seem to be not synchronized.

    My method of counting: In both ISR´s I am incrementing (Timer0+=100 ms and TimerB++) a variable`s value each time the timers overflows and print their values.

    I am very thankful for your quick reply and appreciate it alot.

    Br,

    Ali Reza Noori

  • What baud rate are you printing at? At 115200 baud it will take 1.3 mS to print the 15 characters represented by your string.  I suspect you are missing some of your 1mS interrupts because of the time needed to output to the UART.

  • Thanks a heap for your quick replay.

    Well, I am running on a baud rate of 15200 thats right.

    That's a plausible explanation. Thanks! 

    Do you have any other idea how the problem could be solved or the time could be measured with the help of timers?

    Br,

    Ali Reza Noori

  • Several solutions. Print fewer characters. Use a faster baud rate. Only increment the counter in the interrupt routine and set a volatile flag. In the main loop, poll for the flag and then print only the even count values.

    Honestly, using a counter to verify a counter is not a good idea when they are running off of the same time base. Toggling a pin and using a digital scope or logic analyzer will give a better indication that the timer routines are correct.

  • Thanks alot for your inputs Bob :) I really appreciate it.

    Br,

    Ali Reza Noori