0
\$\begingroup\$

Is it possible to use an AVR Timer such as Timer 0 or Timer 1 to time events, but leave the associated pins unaffected by the timer? For example, if you have GPIO connected to the timer pins, they can still be used for GPIO instead of being tied up for its timer?

\$\endgroup\$
  • 1
    \$\begingroup\$ Data sheet says? This might be helpful atmel.com/Images/… \$\endgroup\$ – Tyler Oct 24 '16 at 19:19
  • 2
    \$\begingroup\$ In general, yes. All MCUs (almost all, anyway) have methods for tying an external pin to a timer system and this also means that by default they are NOT tied to it. You need to specify the specific device, though, in order to find the exact proof you need to look at. The datasheet usually has a clear and detailed behavioral schematic available which can be used to show you exactly how and why. What is the device? \$\endgroup\$ – jonk Oct 24 '16 at 19:23
  • 1
    \$\begingroup\$ @jonk I am using the AVR XMEGA384C3. So, As long as it is not in Input Capture mode, I can use the Pins for GPIO for other things without the timer affecting them? \$\endgroup\$ – zacharoni16 Oct 24 '16 at 19:23
  • 1
    \$\begingroup\$ This white paper, AVR130: Setup and Use of AVR Timers, alludes to the fact that by saying, "The setting of the direction register will not be overwritten by the timer setup, because it is also allowed to implement a software clocked timer in the AVR. T0 and T1 are inputs by default." But again, the datasheet itself is the final arbiter. What's the part number? \$\endgroup\$ – jonk Oct 24 '16 at 19:25
  • 1
    \$\begingroup\$ I'm not familiar with this family. But I'm looking at atmel.com/images/… and find that they use multiplexers extensively. You can route ANY event, just about, to any port pin. Have you looked over the MUXes?? Figure 6-3 in particular? \$\endgroup\$ – jonk Oct 24 '16 at 19:32
1
\$\begingroup\$

Unless someone more knowledgeable about your device enters here (and I can hope they do), I'll point you to a few places where I think the answer becomes "yes, you can."

Take a look at the XMEGA C MANUAL on page 137. In particular, "Table 12-10. Clock Output Port Configurations" on that page. There, you can see how to disable the clock output, itself. I don't believe this addresses timer events, though. But on the same page, at the top where it says "Table 12-8. Event Output Pin Selection," you will also find out that you can similarly disable event outputs. Those two bits are part of the CLKEVOUT register.

What adds to my own questions is the fact that they also appear (prior page or two) to discuss the ability to map ports to virtual ports. And this brings in a whole other set of routing questions for me. This device family appears to have full crossbars on it and that makes telling you exactly what to do and how to do it very difficult for someone who has zero experience with this device. I'd have to do a lot of reading to make sure I knew what I was doing.

In the meantime, I think you can do what you want. But hold this as a tentative answer. Perhaps someone well informed with this device (or better able to interpret the datasheet) can provide a more comprehensive answer for you.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.