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.

TM4C1294NCPDT: Timer reset function works for only for some cycles

Part Number: TM4C1294NCPDT

Hi all,

I want to reset my timer for every byte received from the UART. The Timer reset works for only some cycles ,After that the timer isn't working at all.

The code below for resetting timer.

               TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
               TimerDisable(TIMER0_BASE,TIMER_A);

               HWREG(TIMER0_BASE + 0x50) = 500000;
               TimerEnable(TIMER0_BASE,TIMER_A); 

so once the Full stack received the timer will be disabled and Reenabled when data transmitted again acting as the counter . The configuration was only working for 4 cycles of Timer enabling and disabling. And at that point the interrupt generation will be stopped and at that point the timer was  loaded with the above timer value.

  • "Works only for 4 cycles..."
    Cycles of what?

    Timers can be ONE SHOT, which counts only one timer cycle and then stops, or PERIODIC, which counts continuously. You are not showing how you configured your timer.

    Further, it appears to me that your issue has nothing to do with the timer, but rather to the fact that you are no longer receiving bytes on UART (or rather, maybe you only enabled the RX interrupt and not the RT interrupt, hence you are not getting UART receive timeout detection.

    Bruno
  • Hello Bruno,

    Thanks for the reply.
    The Configuration was been set as ONE SHOT and I didn't enabled the flow control in UART . And the flow of the of program work in the manner when I receive the byte the timer gets rested to the value 0 and then whole packet of data received the timer by through an interrupt saying that communication completed and then gets disabled in the interrupt handler , then the same process happens for every query.But the problem here is I am to able query and get flow working only 4 times though how many times I try to reflash the code. At the 4th time when saw debug window the timer was reset to load value but the timer isn't counting But the whole packet of data received so the process is waiting for the interrupt to parse the data.

    sorry if I mislead you in the question

  • Santhosh,
    You are looking for the rabbit in the wrong bush. The problem does not rely on your timer settings.
    Try a simpler arrangement: maybe just configure one of the GPIO's of your board as OUTPUT, and toggle it when you receive the UART byte (I mean REMOVE the timer control lines, and just toggle a pin in the very same program location in which you would turn the timer on).
    You will probably find out that you are not getting uart interrupts after some time... If that is not the real cause, it will at least help you to isolate the real issue.
    Let us know, good luck.
    Bruno
  • It sounds like you are trying to respond to time-out of communication, where if a byte does not arrive for some time, you trigger some action, but if the byte does arrive, you don't trigger the action.

    If so, then I had a similar issue a few days ago. Look at the thread below...

    e2e.ti.com/.../2254622

    I am using a timer to respond to a time-out of an expected event. If the event does not occur, the timer runs out and triggers an interrupt. If the event occurs, the timer is restarted so that it will not trigger the interrupt, and the process starts over again.

    Restarting the timer in my case only requires a call to TimerLoadSet(). Read carefully the comments from the other users in that thread, because for TimerLoadSet() to achieve that result, it is important that TimerUpdateMode(TIMER1_BASE, TIMER_B, TIMER_UP_LOAD_IMMEDIATE) be called when configuring the timer, so that the TnILD bit in the GPTMTnMR register will be clear (0). Otherwise TimerLoadSet() won't do what you want it to do.
  • hello twelve12,

    Thanks for reply and sharing the undocumented information, the above situation clearly describes the problem I am facing