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.

DMTimer doesn't toggle output pin in one-shot mode?

I am trying to create a limited number of 50% duty cycle pulses on timer 4's output pin with the timer in one-shot mode, but I'm running into some unexpected behaviour. I'm been using Starterware and a beaglebone to prototype.

I've configured timer 4 to toggle the ouput pin upon match and overflow, and in auto-reload mode and everything works as expected (verified with an oscilloscope). However, whenever I change the AR bit of the TCLR register to use one-shot mode, I only get a pulse on overflow and nothing upon match. I can see that the interrupt for the match is being set, but nothing is output to the pin.

From sections 20.1.3.1.3 and 20.1.3.1.5 of the TRM, I am led to believe that this should work. Is there some documentation or errata that I am missing?

Thanks,
Patrick

  • Hi Patrick,
     
    Once you clear the AR bit the timer is set to one-shot and the counter is frozen on overflow. Check the TCLR ST bit in Table 20-18.
     
    Best Regards
    Biser
  • Hi Biser,

    Thanks for the reply!

    I'm already resetting the counter, then starting the timer by setting the ST bit of TCLR in my ISR, so that isn't really an issue.  The problem is that all I see on the output pin is a single cycle length pulse upon overflow (per timer loop). 

    Upon reviewing the TRM again, I think I've discovered what is going on.  From 20.1.3.1.5 Pulse-Width Modulation:

    "In case of overflow and match mode, the match event will be ignored from the moment the mode was set-up until the first overflow event occurs"

    So, it looks like overflow and match mode will never toggle the output pin as I would like in one-shot mode because the match will always be ignored since it comes before the overflow.

    regards,
    Patrick